Repository navigation
Omit the Gravatar d parameter for gravatar_default - #274
Merged
Merged
Conversation
When a site's avatar_default option is gravatar_default, o2 built Gravatar URLs with d=gravatar_default, which is not a Gravatar default ID. WordPress core treats this value as the Gravatar logo and leaves d out. Do the same in getUserFor() and onBlurCommentorEmail(), and add QUnit coverage for both. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
bor0
approved these changes
Nov 4, 2026
bor0
left a comment
Member
There was a problem hiding this comment.
Looks good, matches core's get_avatar_data(). One small thing: logged-out-create-comment.php appends &s= to the URL, so with gravatar_default you get avatar/&s=32 and the 80px logo. With a real hash, <hash>&s=32 returns the Gravatar logo instead of the person's avatar, so it might be worth having the template choose ? or & now.
4 of 8 tasks
lancewillett
added a commit
that referenced
this pull request
Nov 4, 2026
The logged-out comment form template appends `&s=` to the avatar URL. Since #274, a gravatar_default site's avatar URL has no `?`, so the size lands in the path and Gravatar serves the default 80px image. Always keep the `?`, and test the URL the template builds. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug fix
JavaScript change in two avatar URL builders, plus QUnit tests.
When a site's
avatar_defaultoption isgravatar_default, o2 builds Gravatar URLs withd=gravatar_default. That is not a Gravatar default ID. WordPress core treats the value as the Gravatar logo and leavesdout (get_avatar_data()inwp-includes/link-template.php). o2 now does the same:getUserFor()injs/collections/users.jsonBlurCommentorEmail()injs/views/comment.jsOther default values, such as
identiconandmystery, still sendd.Rationale
o2 should send the same avatar URL WordPress core sends, rather than relying on Gravatar to accept a value it does not define. WordPress.com's two copies of o2 get the same change.
Testing this change
npx grunt qunitpasses. The two new tests intests/qunit/avatars.jsfail onmasterat thegravatar_defaultassertions.npx grunt lintpasses.avatar_defaultset togravatar_default, the o2-rendered avatars have nod. Onmasterthey end in?d=gravatar_default.avatar_defaultset toidenticon, the avatars still end in?d=identicon.The logged-out comment form template adds
&s=to the avatar URL. Withgravatar_defaultit now rendershttps://gravatar.com/avatar/&s=32. Gravatar returns the same logo for it, at the default 80px instead of 32px, which the<img>width and height scale down.Definition of done
dforgravatar_defaultd🤖 Generated with Claude Code