In `get_avatar_data()`, there's no need to return `false` if we couldn't find an avatar, as Gravatar can handle being given an empty email hash. This allows the default avatar to show when no email address is given.
See #21195 git-svn-id: https://develop.svn.wordpress.org/trunk@31153 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
d0fab598e7
commit
69f8b26d89
|
@ -3390,7 +3390,7 @@ function get_avatar_url( $id_or_email, $args = null ) {
|
|||
*
|
||||
* @type bool $found_avatar True if we were able to find an avatar for this user,
|
||||
* false or not set if we couldn't.
|
||||
* @type false|string $url The URL of the avatar we found, or false if we couldn't find an avatar.
|
||||
* @type string $url The URL of the avatar we found.
|
||||
* }
|
||||
*/
|
||||
function get_avatar_data( $id_or_email, $args = null ) {
|
||||
|
@ -3547,12 +3547,5 @@ function get_avatar_data( $id_or_email, $args = null ) {
|
|||
* @param array $args Arguments passed to get_avatar_data(), after processing.
|
||||
* @param int|object|string $id_or_email A user ID, email address, or comment object.
|
||||
*/
|
||||
$args = apply_filters( 'get_avatar_data', $args, $id_or_email );
|
||||
|
||||
// Don't return a broken URL if we couldn't find the email hash, and none of the filters returned a different URL.
|
||||
if ( ! $email_hash && $url === $args['url'] ) {
|
||||
$args['url'] = false;
|
||||
}
|
||||
|
||||
return $args;
|
||||
return apply_filters( 'get_avatar_data', $args, $id_or_email );
|
||||
}
|
||||
|
|
|
@ -98,14 +98,6 @@ class Tests_Avatar extends WP_UnitTestCase {
|
|||
$this->assertEquals( $url, $url2 );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 21195
|
||||
*/
|
||||
public function test_get_avatar_url_bad_id() {
|
||||
$this->assertFalse( get_avatar_url( false ) );
|
||||
$this->assertFalse( get_avatar_url( 100000 ) );
|
||||
}
|
||||
|
||||
protected $fakeURL;
|
||||
/**
|
||||
* @ticket 21195
|
||||
|
|
Loading…
Reference in New Issue