Support » Requests and Feedback » Bug: nicename not created/updated

  • I found I bug with users in 1.2.
    If you create a new user through the admin interface, the user_nicename is created correctly. However, if you create a new user with the wp-registration.php page, the nicename is left blank. In wp-registration.php, find this line (around line 85):
    $user_nickname = $wpdb->escape($user_nickname);
    Right after that, add this line:
    $user_nicename = sanitize_title($user_nickname);
    The query (a few lines below) must be changed from:
    $result = $wpdb->query("INSERT INTO $tableusers
    (user_login, user_pass, user_nickname, user_email, user_ip, user_browser, dateYMDhour, user_level, user_idmode)
    ('$user_login', MD5('$pass1'), '$user_nickname', '$user_email', '$user_ip', '$user_browser', '$now', '$new_users_can_blog', 'nickname')");

    $result = $wpdb->query("INSERT INTO $tableusers
    (user_login, user_pass, user_nickname, user_email, user_ip, user_browser, dateYMDhour, user_level, user_idmode, user_nicename)
    ('$user_login', MD5('$pass1'), '$user_nickname', '$user_email', '$user_ip', '$user_browser', '$now', '$new_users_can_blog', 'nickname', '$user_nicename')");

    There is a similar issue with profile.php in the admin area. If you change your nickname, your nicename should be changed accordingly (or is it a bad idea?). So, in wp-admin/profile.php, find this line (88 or so):
    Right after that, add this line:
    And the query a few lines below becomes:
    $query = "UPDATE $tableusers SET user_firstname='$newuser_firstname', $updatepassword user_lastname='$newuser_lastname', user_nickname='$newuser_nickname', user_icq='$newuser_icq', user_email='$newuser_email', user_url='$newuser_url', user_aim='$newuser_aim', user_msn='$newuser_msn', user_yim='$newuser_yim', user_idmode='$newuser_idmode', user_description = '$user_description', user_nicename = '$newuser_nicename' WHERE ID = $user_ID";
    The changes above fix the problem where the wp_list_authors() function with ‘robot-friendly’ permalinks enabled would output incorrect links ( instead of for users created through wp-registration.php because their nicename is empty.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator Ryan Boren


    WordPress Dev

    Thanks. Fix committed.


    hey guys, this seem to be the other way around for me. When I register via wp-registration.php, everything is fine.
    However, when I create a new user in the admin area, I get this:
    Database error: [Unknown column ‘user_nicename’ in ‘field list’]
    I checked my User table in the database, and sure enough there’s no column with nicename on it. Looking through the code, the reason that wp-registration works is because it doesn’t insert any sort of value for nicename during registration-no mention of nicename at all, whereas the admin site that creates users DOES. So what is this nicename thing? Any way around it? Do I even need it in the database? I just downloaded WP yesterday, so its whatever version that was up for download then.



    sorry forgot to login. 😛

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Bug: nicename not created/updated’ is closed to new replies.