mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-22 17:18:32 +01:00
Ensure a user exists in get_comment_author().
props azaozz. see #24084. Built from https://develop.svn.wordpress.org/trunk@25136 git-svn-id: http://core.svn.wordpress.org/trunk@25116 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
159e67efe2
commit
e01352fe2f
@ -22,17 +22,17 @@
|
||||
*/
|
||||
function get_comment_author( $comment_ID = 0 ) {
|
||||
$comment = get_comment( $comment_ID );
|
||||
if ( empty($comment->comment_author) ) {
|
||||
if (!empty($comment->user_id)){
|
||||
$user=get_userdata($comment->user_id);
|
||||
$author=$user->user_login;
|
||||
} else {
|
||||
|
||||
if ( empty( $comment->comment_author ) ) {
|
||||
if ( $comment->user_id && $user = get_userdata( $comment->user_id ) )
|
||||
$author = $user->display_name;
|
||||
else
|
||||
$author = __('Anonymous');
|
||||
}
|
||||
} else {
|
||||
$author = $comment->comment_author;
|
||||
}
|
||||
return apply_filters('get_comment_author', $author);
|
||||
|
||||
return apply_filters( 'get_comment_author', $author );
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user