WordPress.org

Ready to get started?Download WordPress

Forums

Comment name field changes to admin (4 posts)

  1. pezastic
    Member
    Posted 9 years ago #

    Something I noticed with the latest nightly, the comment name field changes to "admin" no matter what I put in there. Sure, I can change it via edit, but it would be nice if I didn't have to.

  2. Michael Adams (mdawaffe)
    Member
    Posted 9 years ago #

    If you're logged in to your site, your name and such will automatically be inserted. Check out the new default comments.php for how this is being implemented by default in the template.

    Also note this bug report.

    EDIT: And http://wordpress.org/support/topic.php?id=22433

  3. pezastic
    Member
    Posted 9 years ago #

    Thanks for that info. The bug report makes a lot of sense, as admin is not what I have in the "How to display name" field.

    As per the bug report, I changed wp-comments-post.php from:

    // If the user is logged in
    get_currentuserinfo();
    if ( $user_ID ) :
    $comment_author = $user_login;

    to:

    // If the user is logged in
    get_currentuserinfo();
    if ( $user_ID ) :
    $comment_author = $user_identity;

  4. blueorder
    Member
    Posted 9 years ago #

    The problem that I have with this code is that is assumes that you want to use that info for your comments...

    I've changed lines 22-30 from:

    get_currentuserinfo();
    if ( $user_ID ) :
    $comment_author = $user_login;
    $comment_author_email = $user_email;
    $comment_author_url = str_replace("http://", "", $user_url);
    else :
    if ( get_option("comment_registration") )
    die( __("Sorry, you must be logged in to post a comment.") );
    endif;

    To:

    get_currentuserinfo();
    if ( get_option('comment_registration') && $user_ID ) :
    $comment_author = $user_identity;
    $comment_author_email = $user_email;
    $comment_author_url = str_replace('http://', '', $user_url);
    elseif ( get_option('comment_registration') && !$user_ID) :
    die( __('Sorry, you must be logged in to post a comment.') );
    endif;

    So it first check to see if comment registration is on and then, if it is on, to try and get the user information. If comment registration is off, then just use the cookie/input info...

    Good idea/Bad idea?????

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.