Skip to:
Content

BuddyPress.org

Opened 5 years ago

Closed 4 years ago

#6298 closed defect (bug) (fixed)

Admin toolbar avatar wrong when visiting WP admin's options-discussion.php page

Reported by: henry.wright Owned by: r-a-y
Milestone: 2.7 Priority: normal
Severity: normal Version: 2.4.0
Component: Media Keywords: has-patch
Cc:

Description

Inside bp_core_fetch_avatar_filter() there is:

// Do not filter if inside WordPress options page
if ( 'options-discussion.php' == $pagenow )
    return $avatar;

This causes an issue when viewing the options-discussion.php in the WP admin area.

Steps to reproduce:

  1. Upload a profile photo via /change-avatar/
  2. Visit the WP admin area, navigate around, and keep a close eye on your profile photo in the admin toolbar (top right-hand corner of the screen). You'll notice the profile photo displays nicely until you get to the options-discussion.php page (at which point you'll see something like the mystery person).

Attachments (1)

6298.diff (713 bytes) - added by henry.wright 5 years ago.

Download all attachments as: .zip

Change History (17)

#1 @Mamaduka
5 years ago

@herny.wright

If we don't bail on discussion page, filter will break select "Default Avatar" setting and display BP avatar for every option. I think better solution will be to add BP avatar as an option to Default Avatar and respect users choice.

#2 @henry.wright
5 years ago

@Mamaduka

I'm not sure I agree an option for BP avatars under Default Avatar is a good idea. As a user, if I upload a profile photo then I expect it to display regardless of my 'default avatar' choice. The purpose of the 'default avatar' choice is set a fallback (for when there's no profile photo).

This ticket was mentioned in Slack in #buddypress by djpaul. View the logs.


5 years ago

#4 @DJPaul
5 years ago

  • Milestone changed from Awaiting Review to Future Release

This might be tricky to fix. I think we'd likely need to use a particular hook to unregister our filter after we've drawn the toolbar but before the avatar list on the page.

#5 @henry.wright
5 years ago

  • Keywords has-patch added
  • Version set to 2.4.0

This might be tricky to fix. I think we'd likely need to use a particular hook to unregister our filter after we've drawn the toolbar but before the avatar list on the page

Those were my thoughts too. But now get_avatar() accepts $args, this can be done fairly easily (see attached patch).

The catch is it'll also require a WordPress patch (which I'll submit separately and add a link here) so please don't commit this unless the WP patch is accepted.

@henry.wright
5 years ago

#6 @henry.wright
5 years ago

See #34744 for the necessary WP changes I mentioned in my last comment.

#8 @DJPaul
4 years ago

  • Component changed from API - Avatars to Media

#9 @DJPaul
4 years ago

@henry.wright Do you want to re-check this issue on WP 4.6 RC and see if it's been fixed for us? :)

#10 @henry.wright
4 years ago

@DJPaul sure. I'll write back once tested.

#11 @henry.wright
4 years ago

Hi @DJPaul

Tested 6298.diff against WP 4.6 RC 1. Works great. Thanks @swissspidy

Last edited 4 years ago by henry.wright (previous) (diff)

#12 @DJPaul
4 years ago

  • Milestone changed from Future Release to 2.7
  • Resolution set to fixed
  • Status changed from new to closed

Neat!

#13 @swissspidy
4 years ago

@DJPaul No commit in BuddyPress needed to fix this?

#14 @mercime
4 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

#15 @mercime
4 years ago

@DJPaul patch for your commit :)

#16 @r-a-y
4 years ago

  • Owner set to r-a-y
  • Resolution set to fixed
  • Status changed from reopened to closed

In 11194:

Avatars: Fix issue with wrong avatar showing in the WP Toolbar when on the "Settings > Discussion" page.

Props henry.wright, swissspidy.

Hat-tip mercime for finding out that this ticket was closed without being
committed :)

Fixes #6298.

Note: See TracTickets for help on using tickets.