[wp-trac] [WordPress Trac] #21195: get_avatar_url
WordPress Trac
noreply at wordpress.org
Sat Jan 10 19:20:14 UTC 2015
#21195: get_avatar_url
-----------------------------+-----------------------
Reporter: pathawks | Owner:
Type: feature request | Status: reopened
Priority: normal | Milestone: 4.2
Component: General | Version: 2.5
Severity: normal | Resolution:
Keywords: has-patch | Focuses:
-----------------------------+-----------------------
Comment (by nacin):
Replying to [comment:59 valendesigns]:
> When viewing `options-discussion.php` all generated avatars are replaced
with your personal avatar. Patch [attachment:21195.16.diff] fixes this by
using the new `$args` array and setting `force_default` to `true`.
Why did the existing code break? `preg_replace("/src='(.+?)'/",
"src='\$1&forcedefault=1'", $avatar);`
> I also removed some filters that were added to force avatars to display
on `options-discussion.php` and replaced them by setting the
`force_display` option to `true`.
One problem with the approach we have here is there's no real way of
knowing if these arguments work for get_avatar().
I'm thinking about an alternate approach that looks something like this:
{{{
#!php
<?php
function wp_get_avatar( ... ) {
if ( defined( 'PLUGGED_GET_AVATAR' ) && empty(
$args['force_core_function'] ) ) {
return get_avatar( ... );
}
// else, the rest of the function
}
# pluggable-deprecated.php
if ( function_exists( 'get_avatar' ) ) {
define( 'PLUGGED_GET_AVATAR', true );
_deprecated_function( 'get_avatar', ... ); // optional. need to pass a
message of some sort.
} else {
function get_avatar( ... ) {
return wp_get_avatar();
}
}
}}}
That way we can finally banish get_avatar(), use wp_get_avatar()
everywhere in core, force it to use core functionality when we need it,
but not break anything overriding get_avatar() deliberately. We could
possibly use this as a template for deprecating, eventually, all pluggable
functions. Any thoughts here?
> Unfortunately, another side effect of the newly implemented `get_avatar`
means that the Mr. WordPress avatar is no longer showing in comments on
the front end because it does not have an email address attached to the
comment. That was not the behavior previously and we should fix this
regression.
Indeed, this is broken.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/21195#comment:61>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list