Skip to:
Content

Opened 22 months ago

Closed 22 months ago

Last modified 19 months ago

#6989 closed defect (bug) (fixed)

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

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

Description

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:

Ref: https://en.gravatar.com/site/implement/images/#default-image

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 22 months ago.

Download all attachments as: .zip

Change History (7)

#1 @henry.wright
22 months 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
22 months ago

  • Keywords has-patch added

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

@henry.wright
22 months ago

#3 @DJPaul
22 months ago

  • Milestone changed from Awaiting Review to 2.6

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


22 months ago

#5 @dcavins
22 months ago

  • Owner set to dcavins
  • 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 @DJPaul
19 months ago

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