Fall back to comment author email in get_avatar() if the user who left the comment no longer exists.
props mauryaratan, lite3. fixes #25803. git-svn-id: https://develop.svn.wordpress.org/trunk@26000 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
fcc1bb0b65
commit
acc8ac64b8
@ -1645,14 +1645,15 @@ function get_avatar( $id_or_email, $size = '96', $default = '', $alt = false ) {
|
||||
if ( ! empty( $id_or_email->comment_type ) && ! in_array( $id_or_email->comment_type, (array) $allowed_comment_types ) )
|
||||
return false;
|
||||
|
||||
if ( !empty($id_or_email->user_id) ) {
|
||||
if ( ! empty( $id_or_email->user_id ) ) {
|
||||
$id = (int) $id_or_email->user_id;
|
||||
$user = get_userdata($id);
|
||||
if ( $user)
|
||||
if ( $user )
|
||||
$email = $user->user_email;
|
||||
} elseif ( !empty($id_or_email->comment_author_email) ) {
|
||||
$email = $id_or_email->comment_author_email;
|
||||
}
|
||||
|
||||
if ( ! $email && ! empty( $id_or_email->comment_author_email ) )
|
||||
$email = $id_or_email->comment_author_email;
|
||||
} else {
|
||||
$email = $id_or_email;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user