Ticket #22367: 22367.patch

File 22367.patch, 1.4 KB (added by johnjamesjacoby, 7 months ago)
  • wp-admin/user-new.php

     
    4141        check_admin_referer( 'add-user', '_wpnonce_add-user' ); 
    4242 
    4343        $user_details = null; 
    44         if ( false !== strpos($_REQUEST[ 'email' ], '@') ) { 
     44        if ( is_email( $_REQUEST[ 'email' ] ) ) { 
    4545                $user_details = get_user_by('email', $_REQUEST[ 'email' ]); 
    4646        } else { 
    4747                if ( is_super_admin() ) { 
  • wp-includes/user.php

     
    469469                        if ( $qv['search_columns'] ) 
    470470                                $search_columns = array_intersect( $qv['search_columns'], array( 'ID', 'user_login', 'user_email', 'user_url', 'user_nicename' ) ); 
    471471                        if ( ! $search_columns ) { 
    472                                 if ( false !== strpos( $search, '@') ) 
     472                                if ( is_email( $search ) ) 
    473473                                        $search_columns = array('user_email'); 
    474474                                elseif ( is_numeric($search) ) 
    475475                                        $search_columns = array('user_login', 'ID'); 
  • wp-login.php

     
    187187 
    188188        if ( empty( $_POST['user_login'] ) ) { 
    189189                $errors->add('empty_username', __('<strong>ERROR</strong>: Enter a username or e-mail address.')); 
    190         } else if ( strpos( $_POST['user_login'], '@' ) ) { 
     190        } else if ( is_email( $_POST['user_login'] ) ) { 
    191191                $user_data = get_user_by( 'email', trim( $_POST['user_login'] ) ); 
    192192                if ( empty( $user_data ) ) 
    193193                        $errors->add('invalid_email', __('<strong>ERROR</strong>: There is no user registered with that email address.'));