• 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.

Viewing 3 replies - 1 through 3 (of 3 total)
  • 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

    Thread Starter pezastic

    (@pezastic)

    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;

    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?????

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Comment name field changes to admin’ is closed to new replies.