Make WordPress Core

Changeset 9781


Ignore:
Timestamp:
11/19/2008 06:58:44 AM (18 years ago)
Author:
markjaquith
Message:

Handle blank display_name for commenters. props mrmist. fixes #7494

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-comments-post.php

    r9515 r9781  
    4141$user = wp_get_current_user();
    4242if ( $user->ID ) {
     43        if ( empty( $user->display_name ) )
     44                $user->display_name=$user->user_login;
    4345        $comment_author       = $wpdb->escape($user->display_name);
    4446        $comment_author_email = $wpdb->escape($user->user_email);
  • trunk/wp-includes/comment-template.php

    r9773 r9781  
    2222function get_comment_author() {
    2323        global $comment;
    24         if ( empty($comment->comment_author) )
    25                 $author = __('Anonymous');
    26         else
     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 {
     29                        $author = __('Anonymous');
     30                }
     31        } else {
    2732                $author = $comment->comment_author;
     33        }
    2834        return apply_filters('get_comment_author', $author);
    2935}
Note: See TracChangeset for help on using the changeset viewer.