1

I have created a custom profile page in which I want to show profile picture. I use the below code to show the avatar:

<div class="activity-avatar">   
   <a href="<?php bp_activity_user_link(); ?>"><?php bp_activity_avatar(); ?></a>
</div>

<?php bp_displayed_user_avatar( 'type=full' ); ?>
<?php global $userdata; get_currentuserinfo();
echo get_avatar($userdata->ID, 46 ); ?>

But I don't get the avatar of user. If I use <?php bp_activity_avatar(); ?> outside of the main <div> then it shows the avatar of the last updated profile picture, not of the current user. But I don't get Avatar at the needed position. How can I get avatar at any position in template? I use bootstrap classes, could the problem occur from there?

Epodax
  • 1,828
  • 4
  • 27
  • 32
Yogendra
  • 1,208
  • 5
  • 18
  • 38

1 Answers1

1

Try:

$userid = bp_loggedin_user_id();
echo bp_core_fetch_avatar( array( 'item_id' => $userid) );

You don't explain the context of your custom profile page, so $userid might need to be changed to $userid = bp_displayed_user_id() or however you determine the user id for a page view.

shanebp
  • 1,904
  • 3
  • 17
  • 28
  • what is 'item_id' here ? – Yogendra Oct 21 '15 at 06:06
  • It's work but height and width are so small, can I give it as arguments? – Yogendra Oct 21 '15 at 06:16
  • 1
    Yes, there are several parameters available. See http://hookr.io/functions/bp_core_fetch_avatar/ – shanebp Oct 21 '15 at 12:44
  • It works fine , Now I want to provide change avatar option. I used rt-media plugin in my project so I used the short code to provide media uploading option . but at front-end I click on upload button but It is not showing browse option. So I can't upload any media. Is there any code option by which I can provide user to change avatar and upload media option – Yogendra Oct 22 '15 at 11:54