295 | | $errors->add('empty_username', __('<strong>ERROR</strong>: Enter a username or email address.')); |
296 | | } elseif ( strpos( $_POST['user_login'], '@' ) ) { |
297 | | $user_data = get_user_by( 'email', trim( $_POST['user_login'] ) ); |
298 | | if ( empty( $user_data ) ) |
299 | | $errors->add('invalid_email', __('<strong>ERROR</strong>: There is no user registered with that email address.')); |
| 296 | $errors->add( 'empty_username', __( '<strong>ERROR</strong>: Enter a username or email address.' ) ); |
| 297 | } elseif ( is_email( $login ) ) { |
| 298 | $user_data = get_user_by( 'email', $login ); |
| 299 | if ( empty( $user_data ) ) { |
| 300 | |
| 301 | //Maybe the username has the format of an email address |
| 302 | //So we check here, if we find a username for $login |
| 303 | $user_data = get_user_by( 'login' , $login ); |
| 304 | if ( empty( $user_data ) ) { |
| 305 | $errors->add('invalid_email', __('<strong>ERROR</strong>: There is no user registered with that email address.')); |
| 306 | } |
| 307 | } |