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?
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.