Skip to:

Opened 2 years ago

Closed 2 years ago

Last modified 21 months ago

#6989 closed defect (bug) (fixed)

Request: Allow Gravatar's "d" param to be filtered

Reported by: henry.wright Owned by: David Cavins
Milestone: 2.6 Priority: normal
Severity: normal Version:
Component: Core Keywords: has-patch


Inside bp_core_fetch_avatar(), the d param is set like this:

if ( 'gravatar_default' !== $default_grav ) {
    $url_args['d'] = $default_grav;

$default_grav will be either wavatar, mm etc. These are the "default" default images (generated by Grav). But Gravatar also allows d to be a URL:


Is it possible to add a filter which lets us change the value of the d param before it's passed to Gravatar?

I'm thinking $params would be useful to have in hooked functions because from that we could get the user or group ID etc.

Attachments (1)

6989.diff (772 bytes) - added by henry.wright 2 years ago.

Download all attachments as: .zip

Change History (7)

#1 @henry.wright
2 years ago

Looking at WordPress, the default arg can be set using a filter such as pre_get_avatar_data. The problem is, the value doesn't carry through into bp_core_fetch_avatar().

#2 @henry.wright
2 years ago

  • Keywords has-patch added

6989.diff introduces a bp_core_avatar_default filter hook which allows Gravatar's "d" param to be filtered.

2 years ago

#3 @Paul Gibbs
2 years ago

  • Milestone changed from Awaiting Review to 2.6

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

2 years ago

#5 @David Cavins
2 years ago

  • Owner set to David Cavins
  • Resolution set to fixed
  • Status changed from new to closed

In 10688:

bp_core_fetch_avatar(): Add "d" filter.

Add a filter for the Gravatar “d,” or
“default_gravatar” parameter.

Props henry.wright.

Fixes #6989.

#6 @Paul Gibbs
21 months ago

  • Component changed from API to Core
Note: See TracTickets for help on using tickets.