diff --git src/wp-admin/user-new.php src/wp-admin/user-new.php
index ef52612418..8daff39340 100644
|
|
if ( isset( $_REQUEST['action'] ) && 'adduser' == $_REQUEST['action'] ) { |
34 | 34 | |
35 | 35 | $user_details = null; |
36 | 36 | $user_email = wp_unslash( $_REQUEST['email'] ); |
37 | | if ( false !== strpos( $user_email, '@' ) ) { |
| 37 | if ( is_email( $user_email ) ) { |
38 | 38 | $user_details = get_user_by( 'email', $user_email ); |
39 | 39 | } else { |
40 | 40 | if ( current_user_can( 'manage_network_users' ) ) { |
diff --git src/wp-includes/class-wp-user-query.php src/wp-includes/class-wp-user-query.php
index 33408e51d0..9cb4cd8c68 100644
|
|
class WP_User_Query { |
524 | 524 | } |
525 | 525 | if ( ! $search_columns ) { |
526 | 526 | if ( false !== strpos( $search, '@' ) ) { |
527 | | $search_columns = array( 'user_email' ); |
| 527 | $search_columns = array( 'user_email', 'user_login' ); |
528 | 528 | } elseif ( is_numeric( $search ) ) { |
529 | 529 | $search_columns = array( 'user_login', 'ID' ); |
530 | 530 | } elseif ( preg_match( '|^https?://|', $search ) && ! ( is_multisite() && wp_is_large_network( 'users' ) ) ) { |
diff --git src/wp-login.php src/wp-login.php
index f7f0fa16ea..94620c764b 100644
|
|
function retrieve_password() { |
355 | 355 | |
356 | 356 | if ( empty( $_POST['user_login'] ) || ! is_string( $_POST['user_login'] ) ) { |
357 | 357 | $errors->add( 'empty_username', __( '<strong>ERROR</strong>: Enter a username or email address.' ) ); |
358 | | } elseif ( strpos( $_POST['user_login'], '@' ) ) { |
359 | | $user_data = get_user_by( 'email', trim( wp_unslash( $_POST['user_login'] ) ) ); |
| 358 | } elseif ( is_email( $_POST['user_login'] ) ) { |
| 359 | $user_login = trim( wp_unslash( $_POST['user_login'] ) ); |
| 360 | |
| 361 | $user_data = get_user_by( 'email', $user_login ); |
| 362 | |
| 363 | if ( empty( $user_data ) ) { |
| 364 | $user_data = get_user_by( 'email', $user_login ); |
| 365 | } |
| 366 | |
360 | 367 | if ( empty( $user_data ) ) { |
361 | 368 | $errors->add( 'invalid_email', __( '<strong>ERROR</strong>: There is no account with that username or email address.' ) ); |
362 | 369 | } |