Skip to:
Content
Pages
Categories
Search
Top
Bottom

Author Posts in Profile Page


  • ozanguzelkan
    Participant

    @ozanguzelkan

    Hi, actually there are a few issues i need to handle. I used @azchipka’s code

    in bp-custom.php author posts are been seeing in profile page. However as you’ ll see in this photo how can i solve these highlighted problems?

    – remove the rating showing on avatar.
    – give hyperlink to page titles.
    – post content must be deleted.

    Regards,

    Code is:

    //POSTS ON PROFILE STARTS HERE
    
    add_action( 'bp_setup_nav', 'add_profileposts_tab', 100 );
    function add_profileposts_tab() {
    global $bp;
    bp_core_new_nav_item( array(
    'name' => 'My Posts',
    'slug' => 'posts',
    'screen_function' => 'bp_postsonprofile',
    'default_subnav_slug' => 'My Posts', 
    'position' => 25
    )
    );
    }
    // show feedback when 'Posts' tab is clicked
    function bp_postsonprofile() {
    add_action( 'bp_template_content', 'profile_screen_posts_show' );
    bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'members/single/plugins' ) );
    }
    
    function profile_screen_posts_show() {
    query_posts( 'author=' . bp_displayed_user_id() );
    	if ( have_posts() ) :
    	get_template_part( 'author' );
    	else:?>
    	<div id="message" class="info">
    		<p><?php bp_displayed_user_username(); ?> has not published any post! </p>
    	</div>
        <?php endif; ?>    <?php
    
    }
    
    //POSTS ON PROFILE ENDS HERE
    
    ?>
Viewing 10 replies - 1 through 10 (of 10 total)

  • ozanguzelkan
    Participant

    @ozanguzelkan

    is there any ideas?

    Regards,


    peter-hamilton
    Participant

    @peter-hamilton

    Hi, first off all, hanks for sharing @azchipka‘s code, i have been looking for that function myself.

    I found a way to adjust the code to what you need

    function profile_screen_posts_show() {
    query_posts( 'author=' . bp_displayed_user_id() );
    	if ( have_posts() ) : ?>
    <div class="category-wrap" style="width:100%;">
    <ul class="two-post-wrap">
    
    <?php // Start the Loop.
    	while ( have_posts() ) : the_post(); 
    
    	/*
    	* Include the Post-Format-specific template for the content.
    	* If you want to override this in a child theme, then include a file
    	* called content-___.php (where ___ is the Post Format name) and that will be used instead.
    	*/ ?>
    <li>
    <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
    <?php the_post_thumbnail(); ?>
     <?php the_excerpt();?></span>
    </li>
    
    <?php // End the loop.
    
    endwhile; ?></ul></div>
    	<?php else:?>
    	<div id="message" class="info">
    		<p><?php bp_displayed_user_username(); ?> has not published any post! </p>
    	</div>
        <?php endif; ?>    <?php
    
    }
    
    //POSTS ON PROFILE ENDS HERE
    
    ?>

    You can remove thumbs, excerpt if you like, and/or add css classes.

    I used this code here on my site

    Changed posts to articles and working like a charm

    Thanks again


    peter-hamilton
    Participant

    @peter-hamilton

    Oops, just realized that there is a second list of posts after the first, weird and I do not know yet how to fix it.


    ozanguzelkan
    Participant

    @ozanguzelkan

    @peter-hamilton, thank you so much, i got closer to what i needed with your code. And like you i dont know how to remove second list either.

    Is there anyone to help on this issue?

    Regards,

    Ozan


    ozanguzelkan
    Participant

    @ozanguzelkan

    any ideas?

    thanks.


    peter-hamilton
    Participant

    @peter-hamilton

    I have skipped that code for now since I do not know how to solve that specific double list problem.

    Until then I have added a profile nav link to the archive page for viewed author which also works, but I would prefer to see posts on the actual profile.

    I will try to integrate somehow a part of the archive into the buddypress members plugin.php later tonight.


    ozanguzelkan
    Participant

    @ozanguzelkan

    Hi, can anyone knows this issue?

    I want to:

    – give hyperlink to page titles.
    – post content must be deleted.
    – get the thumbnail to page.

    `//POSTS ON PROFILE STARTS HERE

    add_action( ‘bp_setup_nav’, ‘add_profileposts_tab’, 100 );
    function add_profileposts_tab() {
    global $bp;
    bp_core_new_nav_item( array(
    ‘name’ => ‘My Posts’,
    ‘slug’ => ‘posts’,
    ‘screen_function’ => ‘bp_postsonprofile’,
    ‘default_subnav_slug’ => ‘My Posts’,
    ‘position’ => 25
    )
    );
    }
    // show feedback when ‘Posts’ tab is clicked
    function bp_postsonprofile() {
    add_action( ‘bp_template_content’, ‘profile_screen_posts_show’ );
    bp_core_load_template( apply_filters( ‘bp_core_template_plugin’, ‘members/single/plugins’ ) );
    }

    function profile_screen_posts_show() {
    query_posts( ‘author=’ . bp_displayed_user_id() );
    if ( have_posts() ) :
    get_template_part( ‘author’ );
    else:?>
    <div id=”message” class=”info”>
    <p><?php bp_displayed_user_username(); ?> has not published any post! </p>
    </div>
    <?php endif; ?> <?php

    }

    //POSTS ON PROFILE ENDS HERE


    itsmikeski
    Participant

    @itsmikeski

    Did anyone manage to solve the double post problem?

    @peter-hamilton?


    itsmikeski
    Participant

    @itsmikeski

    Also, can we get pagination in this?


    ronsenbln
    Participant

    @ronsenbln

    Hi, i am new with buddypress and i like to have the posts from the users on the profil page too. But i have the same double entries. This looks bad. Is there any news to fix this?

Viewing 10 replies - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.
Skip to toolbar