WordPress.org

Make WordPress Core

Ticket #9393: 9393-registration.2.diff

File 9393-registration.2.diff, 1.2 KB (added by sivel, 6 years ago)
  • wp-includes/registration.php

     
    176176        if ( empty($user_registered) ) 
    177177                $user_registered = gmdate('Y-m-d H:i:s'); 
    178178 
    179         $user_nicename_check = $wpdb->get_var( $wpdb->prepare("SELECT ID FROM $wpdb->users WHERE user_nicename = %s AND ID != %d LIMIT 1" , $user_nicename, (int) $ID)); 
     179        $user_nicename_check = $wpdb->get_var( $wpdb->prepare("SELECT ID FROM $wpdb->users WHERE user_nicename = %s AND user_login != %s LIMIT 1" , $user_nicename, $user_login)); 
    180180 
    181181        if ($user_nicename_check) { 
    182182                $suffix = 2; 
    183183                while ($user_nicename_check) { 
    184184                        $alt_user_nicename = $user_nicename . "-$suffix"; 
    185                         $user_nicename_check = $wpdb->get_var( $wpdb->prepare("SELECT ID FROM $wpdb->users WHERE user_nicename = %s AND ID != %d LIMIT 1" , $alt_user_nicename, (int) $ID)); 
     185                        $user_nicename_check = $wpdb->get_var( $wpdb->prepare("SELECT ID FROM $wpdb->users WHERE user_nicename = %s AND user_login != %s LIMIT 1" , $alt_user_nicename, $user_login)); 
    186186                        $suffix++; 
    187187                } 
    188188                $user_nicename = $alt_user_nicename;