WordPress.org

Ready to get started?Download WordPress

Forums

Want to use nicknames for comment authors (1 post)

  1. rskaskiw
    Member
    Posted 4 years ago #

    I want to use nicknames instead of user names in my comments. This should be simple, right? Sadly, I don't know PHP, and I'm trying to hack my comment-template.php to accomplish this. After a few hours, I'm at a loss.

    Here's the critical function:

    --------------------------
    function get_comment_author() {
    global $comment;
    if (!empty($comment->user_id)){
    $user=get_userdata($comment->user_id);
    $author=$user->user_login;
    } else {
    $author = __('Anonymous');
    }
    return apply_filters('get_comment_author', $author);
    }
    ----------------------------------

    Basically, I've been trying to change user_login to user_nickname and a few other things, but nothing works. I know this part of the code is running, because I can replace that line with $author = __('Spiderpig'); and then comments are attributed to Spiderpig, but I don't know how to access the nickname.

    Any help is appreciated.

Topic Closed

This topic has been closed to new replies.

About this Topic