Make WordPress Core

Ticket #10653: get_comment_author.patch

File get_comment_author.patch, 1.0 KB (added by apljdi, 15 years ago)
  • wp-includes/comment-template.php

     
    1919 *
    2020 * @return string The comment author
    2121 */
    22 function get_comment_author() {
     22function get_comment_author($before_alias = ' (Initially posted by ', $after_alias = ')') {
    2323        global $comment;
    24         if ( empty($comment->comment_author) ) {
    25                 if (!empty($comment->user_id)){
    26                         $user=get_userdata($comment->user_id);
    27                         $author=$user->user_login;
    28                 } else {
    2924                        $author = __('Anonymous');
     25        if (!empty($comment->user_id)) {
     26                $user = get_userdata($comment->user_id);
     27                $author = $user->display_name;
     28                if (!empty($comment->comment_author) && $author != $comment->comment_author) {
     29                        $author = $author.$before_alias.$comment->comment_author.$after_alias;
    3030                }
    31         } else {
     31        } elseif (!empty( $comment->comment_author)) {
    3232                $author = $comment->comment_author;
    3333        }
    3434        return apply_filters('get_comment_author', $author);