Ticket #1626: 1626.patch
| File 1626.patch, 2.0 KB (added by pishmishy, 5 years ago) |
|---|
-
wp-includes/pluggable.php
230 230 } 231 231 endif; 232 232 233 if ( !function_exists('get_user_by_nicename') ) : 234 /** 235 * get_user_by_nicename() - Retrieve user info by nicename 236 * 237 * @since 2.5 238 * 239 * @param string $email User's nicename 240 * @return bool|object False on failure, User DB row object 241 */ 242 function get_user_by_nicename($nicename) { 243 global $wpdb; 244 245 $user_id = wp_cache_get($nicename, 'usernicename'); 246 247 if ( '0' === $user_id ) 248 return false; 249 250 $user = false; 251 if ( false !== $user_id ) 252 $user = wp_cache_get($user_id, 'users'); 253 254 if ( false !== $user ) 255 return $user; 256 257 if ( !$user = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->users WHERE user_nicename = %s", $nicename)) ) { 258 wp_cache_add($nicename, 0, 'useremail'); 259 return false; 260 } 261 262 _fill_user($user); 263 264 return $user; 265 } 266 endif; 267 268 233 269 if ( !function_exists( 'wp_mail' ) ) : 234 270 /** 235 271 * wp_mail() - Function to send mail, similar to PHP's mail -
wp-includes/registration.php
6 6 */ 7 7 8 8 /** 9 * username_exists() - Checks whether the given username exists .9 * username_exists() - Checks whether the given username exists and that it's nicename is unique 10 10 * 11 11 * @since 2.0.0 12 12 * 13 13 * @param string $username Username. 14 14 * @return null|int The user's ID on success, and null on failure. 15 15 */ 16 16 17 function username_exists( $username ) { 17 if ( $user = get_userdatabylogin( $username ) ) { 18 $user_nicename = sanitize_title($username); 19 $user_nicename = apply_filters('pre_user_nicename', $user_nicename); 20 if ( $user = get_userdatabylogin( $username ) ) { 18 21 return $user->ID; 22 } elseif ($user = get_user_by_nicename($user_nicename)) { 23 return $user->ID; 19 24 } else { 20 25 return null; 21 26 }
