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:
Andrew Nacin 2013-08-27 13:17:09 +00:00
parent 159e67efe2
commit e01352fe2f
1 changed files with 7 additions and 7 deletions

View File

@ -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 );
}
/**