sunchaserinfo / wp-libravatar-replace

Libravatar Replace plugin for WordPress
https://wordpress.org/plugins/libravatar-replace/
ISC License
7 stars 0 forks source link

Override get_avatar_url() #5

Open aslakr opened 4 years ago

aslakr commented 4 years ago

Since som plugins use get_avatar_url() to get the url of the avtar, would it be possible to override that?

Example of plugins using get_avatar_url():

https://github.com/willnorris/wordpress-opengraph/blob/eaefc0fabddb9f729a6179c1c8e5f7b99788b43c/opengraph.php#L205-L208

https://github.com/pfefferle/wordpress-webfinger/blob/07bf15c5eac5602478e1c4fb1f2f47ff851b1b7d/includes/class-webfinger.php#L117-L118

https://github.com/manton/jsonfeed-wp/blob/68d8e8ccbd3f8fed31a5eb954924031077cceec6/feed-json-functions.php#L142-L156

https://github.com/Automattic/Co-Authors-Plus/blob/703d0404ff27db25066f322ae9e79e440cdc2b34/co-authors-plus.php#L137-L138

aslakr commented 4 years ago

I suppose bp_gravatar_url is similar only for BuddyPress, but get_avatar_url() (and get_avatar_data()) was introduced later in WordPress 4.2 (in 2015)?

https://github.com/sunchaserinfo/wp-libravatar-replace/blob/a1f011823881664e2dc27060b694b6b5c64df5fe/libravatar-replace.php#L41

https://github.com/sunchaserinfo/wp-libravatar-replace/blob/532622c164889a7094ea66b42396692e342ae2df/classes/LibravatarReplace.class.php#L189-L206

sunchaserinfo commented 4 years ago

There are new (pre_)get_avatar_data filters which look perfect for new injection

aslakr commented 1 year ago

The same applies when using @pfefferle pfefferle/wordpress-activitypub, i.e. Mastadon will use gravatar instead of federated libravatar.

Do you have any suggestion on how the code should be changed to use the (pre_)get_avatar_data filters?

pfefferle commented 1 year ago

pre_get_avatar_data is what we are using for Webmentions:

sunchaserinfo commented 1 year ago

Anyone care to take over the plugin?