Skip to content

Non-Gravatar profile images are replaced #142

@edent

Description

@edent

I use the WebMentions plugin to get replies to my blog posts. User's images are taken from the account which replied. FAIR Avatars overwrite those custom avatars as well as Gravatar.

For example - in the left screenshot, the first two images are Gravatars, the next two are from BlueSky, and the final one is a website's profile image. The right screenshot is what I see when FAIR avatars are enabled. I understand that the Gravatars will be replaced, but should the WebMention ones as well?

The code my theme uses to get comment avatars is:

$avatar_html = get_avatar( $comment, 64, "", "", array( "extra_attr" => "itemprop=image loading=lazy" ) );

For a WebMention avatar, it returns something like:

<img 
 alt=""
 class="avatar avatar-64 photo local-avatar"
 decoding="async"
 height="64"
 itemprop="image"
 loading="lazy"
 onerror="this.onerror=null;this.src='https://shkspr.mobi/blog/wp-content/plugins/webmention/assets/img/mm.jpg';this.srcset='https://shkspr.mobi/blog/wp-content/plugins/webmention/assets/img/mm.jpg';"
 src="https://cdn.bsky.app/img/avatar/plain/did:plc:fm7crvtisfj5xwzwuxerw32o/bafkreiepjfyygouxkrp4fybh7mqoo4b5kmk6c4wwsd52yn4hbs6ungewai@jpeg"
 srcset="https://cdn.bsky.app/img/avatar/plain/did:plc:fm7crvtisfj5xwzwuxerw32o/bafkreiepjfyygouxkrp4fybh7mqoo4b5kmk6c4wwsd52yn4hbs6ungewai@jpeg 2x"
 width="64">

For a Gravatar, it is the same, but the src is src="https://shkspr.mobi/blog/wp-content/litespeed/avatar/f5eb5c3cbe6e929f18cbe191d4b95251.jpg?ver=1750834262" because I'm using LiteSpeed to cache the images.

Would it be possible to check if an avatar is a Gravatar before replacing it?

It looks like the issue is in this code:

function get_avatar_url( $id_or_email, $args ) {

It is checking the author's ID, but perhaps it could also check if a comment has a set avatar as well?

Happy to provide more details if necessary.

Metadata

Metadata

Labels

No labels
No labels

Type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions