Skip to:
Content

BuddyPress.org

Opened 9 years ago

Closed 9 years ago

Last modified 8 years ago

#6989 closed defect (bug) (fixed)

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

Reported by: henrywright's profile henry.wright Owned by: dcavins's profile 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 9 years ago.

Download all attachments as: .zip

Change History (7)

#1 @henry.wright
9 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
9 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.

@henry.wright
9 years ago

#3 @DJPaul
9 years ago

  • Milestone changed from Awaiting Review to 2.6

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


9 years ago

#5 @dcavins
9 years 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
8 years ago

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