Skip to:
Content

BuddyPress.org

Opened 10 months ago

Closed 3 months ago

#8026 closed defect (bug) (fixed)

Default avatar choices show same generated icon in general discussion settings

Reported by: netweblogic Owned by: imath
Milestone: 5.0.0 Priority: normal
Severity: normal Version:
Component: Core Keywords: has-patch
Cc:

Description

If you go to the Settings > Discussion settings page of WP, you'll notice all the avatar icons are the same generated icon according to the setting chosen.

For example, if your site default is Wavatar, all the choices show a Wavatar as an example.

The culprit is around line 653 of bp-core/bp-core-avatars.php

                $default_grav = apply_filters( 'bp_core_avatar_default', $default_grav, $params );

                // Only set default image if 'Gravatar Logo' is not requested.
                if ( 'gravatar_default' !== $default_grav ) {
                        $url_args['d'] = $default_grav;
                }

This does not respect the

$args['default']

argument provided by WordPress get_avatar() and

$url_args['d']

gets given an incorrect default gravatar for a regular user in the settings context.

Attachments (1)

8026.diff (1.3 KB) - added by boonebgorges 8 months ago.

Download all attachments as: .zip

Change History (5)

@boonebgorges
8 months ago

#1 @boonebgorges
8 months ago

  • Keywords has-patch added
  • Milestone changed from Awaiting Review to 5.0.0

Thanks for the ticket. I'm fairly sure that this is a very old issue in BP - I've noticed it before but never bothered to try figuring it out :)

I had to do the following to fix it. See 8026.diff:

  1. If force_default, don't attempt to scan for uploaded images.
  2. If force_default, ensure that the d param is set to default as passed from get_avatar()
  3. Don't do the default_avatar override if force_default

@r-a-y Since you have touched this in the past, maybe you could give a brief review?

#2 @imath
4 months ago

Just looked at it. I confirm it's fixing the issue. Thanks a lot for your patch Boone 👌

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


3 months ago

#4 @imath
3 months ago

  • Owner set to imath
  • Resolution set to fixed
  • Status changed from new to closed

In 12417:

Avatars: make sure to respect the "force_default" argument

If "force_default" is true:

  1. do not attempt to scan for uploaded images,
  2. ensure that the d parameter is set to default as passed from get_avatar(),
  3. Do not do the default_avatar override.

Props boonebgorges, netweblogic

Fixes #8026

Note: See TracTickets for help on using tickets.