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

buddypress-trac noreply at wordpress.org
Sun May 17 13:59:03 UTC 2015


#6440: BP Displayed User Avatar Bug
---------------------------+-----------------------------
 Reporter:  espellcaste    |      Owner:
     Type:  defect (bug)   |     Status:  new
 Priority:  normal         |  Milestone:  Awaiting Review
Component:  API - Avatars  |    Version:  2.2.3
 Severity:  normal         |   Keywords:  needs-patch
---------------------------+-----------------------------
 I discussed this on the Slack channel a few days ago and after more
 testing, I believe I found a bug.

 This must be related to #6290 and #6278.

 Steps to reproduce:

 1 - Add an avatar using the new Avatar UI (which as far as I understand,
 uses the new Attachments API);


 2 - Use the {{{bp_core_fetch_avatar()}}} to fetch an avatar anywhere
 outside of the main loop. Like in the header of a theme;


 3 - Go the User profile, {{{bp_displayed_user_avatar()}}} on the profile-
 header.php will show new added avatar and also
 {{{bp_core_fetch_avatar()}}} will show the new user avatar on the user
 profile pages;

 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.


 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 wasn't smart enough to know why, but after a few tests, that's what I
 came up with to show the image on non-BuddyPress pages as well as
 BuddyPress pages.

 {{{
 bp_displayed_user_avatar (
         array(
                 'item_id' => get_current_user_id()
         )
 );
 }}}

 Using the WordPress function to fetch the current user, instead of the
 BuddyPress one solved for me. It showed the newly added avatar, if not
 they fetched the gravatar version and if that wasn't available either, it
 fetched the mystery man finally.

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


More information about the buddypress-trac mailing list