Skip to:
Content
Pages
Categories
Search
Top
Bottom

Echo buddypress profile header contents in sidebar


  • jameshh93
    Participant

    @jameshh93

    What is the best way to to echo the currently logged in users avatar, profile name, recent activity, and cover image that is usually found on the buddypress profile and put it in a sidebar created in the \activity\index.php?

    Simply copying and pasting the contents from the memeber-header.php does not seem to work.

    also how would I then be able to echo the same profile info but then place it on wordpress post pages and instead of using the currently logged in user use the profile info of the posts author?

    I have searched everywhere for this info online and there is zero mention of how to do this o the internet.

    ANyway would be awesome if got this to work.

Viewing 3 replies - 1 through 3 (of 3 total)

  • jameshh93
    Participant

    @jameshh93

    if I copy this code into my side bar div

    	<?php
    
    	/**
    	 * Fires before the display of member home content.
    	 *
    	 * @since 1.2.0
    	 */
    	do_action( 'bp_before_member_home_content' ); ?>
    
    	<div id="item-header" role="complementary">
    
    		<?php
    		/**
    		 * If the cover image feature is enabled, use a specific header
    		 */
    		if ( bp_displayed_user_use_cover_image_header() ) :
    			bp_get_template_part( 'members/single/cover-image-header' );
    		else :
    			bp_get_template_part( 'members/single/member-header' );
    		endif;
    		?>
    
    	</div>

    it tries to display links and cover images but doesn’t actually pull anything to display


    jameshh93
    Participant

    @jameshh93

    I have also tried this placing this code in my div in activity.php

    
    <div id="item-header" role="complementary">
    
    		<?php
    		/**
    		 * If the cover image feature is enabled, use a specific header
    		 */
    		if ( bp_displayed_user_use_cover_image_header() ) :
    			bp_get_template_part( 'members/single/cover-image-header' );
    		else :
    			bp_get_template_part( 'members/single/member-header' );
    		endif;
    		?>
    
    	</div><!-- #item-header -->

    but it not grabbing any data and just shows

    @
    Public Message
    Not recently active 

    with no reference to my user and no cover image.


    jameshh93
    Participant

    @jameshh93

    Okay I now have this above my my buddypress div in the activity.php

    <div class="activity-sidebar-left">
    
    	
    	<div id="item-header" role="complementary">
    
    		<?php
    		
    		add_filter('bp_displayed_user_id','bp_displayed_outside_bp');
    function bp_displayed_outside_bp($id){
    	return ($id==0) ? get_current_user_id() : $id;
    	
    }
    
    $cover_image_url = bp_attachments_get_attachment( 'url', array( 'item_id' => bp_displayed_user_id() ) ); 
    
    		if ( bp_displayed_user_use_cover_image_header() ) :
    			bp_get_template_part( 'members/single/cover-image-header' );
    		else :
    			bp_get_template_part( 'members/single/member-header' );
    		endif;
    		?>
    		
    		
    
    	</div><!-- #item-header -->
    
    	</div>

    but for some reason the cover image will not show up but the username and that does? anyhelp guys would be super! thank you.

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