[buddypress-trac] [BuddyPress Trac] #6440: BP Displayed User Avatar Bug

buddypress-trac noreply at wordpress.org
Sun May 17 15:27:18 UTC 2015

#6440: BP Displayed User Avatar Bug
 Reporter:  espellcaste        |       Owner:
     Type:  defect (bug)       |      Status:  new
 Priority:  normal             |   Milestone:  2.3
Component:  API - Avatars      |     Version:  2.2.3
 Severity:  critical           |  Resolution:
 Keywords:  reporter-feedback  |
Changes (by imath):

 * keywords:  needs-patch => reporter-feedback


 Hi @espellcaste

 Maybe i'm missing something, but I believe there's no issue at all,
 because out of the single member's pages, `bp_displayed_user_id()` is `0`
 so `bp_core_fetch_avatar()` if no `item_id` parameter was provided should
 display nothing (see

 But as you were talking of the BP Attachments API and the new avatar UI,
 i've double checked. This is what i've did, i've switched to 2.2 branch,
 follow the different steps you detailed in you ticket description. And the
 only way to have an avatar displayed in the header of the theme, is to
 actually set the displayed user id by going on one of the single member's

 I've switch back to trunk, follow the different steps again, by uploading
 a new avatar or using the camera feature, and the result is the same than
 in 2.2, no avatar displayed if not on a single member's page, '''which is
 the right behavior'''.

 So no regression.

 > My thinking after looking at the code, they appear normal because they
 both use bp_displayed_user_id() to fetch the current logged-in user.

 No to fetch the logged in user id, you need to use
 `bp_loggedin_user_id()`. Displayed user means, the one you're actually
 looking at : so a single member's page. `bp_core_fetch_avatar()` tries to
 get the displayed user id if no item_id was provided, if the item_id is
 still empty, then it returns nothing.

 > 4 - Now go to another page that's not related to BuddyPress (custom post
 type, post type pages, aka blog post in my case) and
 bp_core_fetch_avatar() will not fetch the new uploaded image, it'll fetch
 a gravatar image if available or a mystery man if not.
 > In another words, outside of the BuddyPress domain,
 bp_core_fetch_avatar() is not fetching the new uploaded avatar.

 I really wonder how you managed to have an avatar displayed in this case,
 nothing should be output!
 Do you have any plugin activated or do you use a specific theme, if so
 could, you deactivate all plugins except BuddyPress and test with a twenty
 of your choice, e.g. twentyfifteen.

 If not on a single member's page, you need to pass an item_id parameter to
 `bp_core_fetch_avatar()`. For instance :
 <?php echo bp_core_fetch_avatar( array( 'item_id' => 43 ) ); ?>

 or if you're trying to fetch the current logged in user's avatar, you can
 <?php bp_loggedin_user_avatar(); ?>

 So for me, there's no bug. If i've missed something, do not hesitate to
 share the exact code you're using and the exact config.

Ticket URL: <https://buddypress.trac.wordpress.org/ticket/6440#comment:2>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac

More information about the buddypress-trac mailing list