Make WordPress Core

Changeset 18513


Ignore:
Timestamp:
08/05/2011 04:57:31 PM (13 years ago)
Author:
ryan
Message:

Deprecate get_userdatabylogin() and get_user_by_email(). Props scribu. fixes #18333

Location:
trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk

    • Property svn:mergeinfo changed
      /trunk (added)merged: 18512
  • trunk/wp-admin/includes/schema.php

    r17928 r18513  
    646646        $errors->add( 'siteid_exists', __( 'The network already exists.' ) );
    647647
    648     $site_user = get_user_by_email( $email );
     648    $site_user = get_user_by( 'email', $email );
    649649    if ( ! is_email( $email ) )
    650650        $errors->add( 'invalid_email', __( 'You must provide a valid e-mail address.' ) );
  • trunk/wp-includes/capabilities.php

    r18512 r18513  
    448448            $this->data = get_userdata( $id );
    449449        else
    450             $this->data = get_userdatabylogin( $name );
     450            $this->data = get_user_by('login', $name );
    451451
    452452        if ( empty( $this->data->ID ) )
  • trunk/wp-includes/pluggable-deprecated.php

    r14090 r18513  
    3737endif;
    3838
     39if ( !function_exists('get_userdatabylogin') ) :
     40/**
     41 * Retrieve user info by login name.
     42 *
     43 * @since 0.71
     44 * @deprecated 2.5
     45 * @deprecated Use get_user_by('login')
     46 *
     47 * @param string $user_login User's username
     48 * @return bool|object False on failure, User DB row object
     49 */
     50function get_userdatabylogin($user_login) {
     51    _deprecated_function( __FUNCTION__, '3.3', "get_user_by('login')" );
     52    return get_user_by('login', $user_login);
     53}
     54endif;
     55
     56if ( !function_exists('get_user_by_email') ) :
     57/**
     58 * Retrieve user info by email.
     59 *
     60 * @since 2.5
     61 * @deprecated 2.5
     62 * @deprecated Use get_user_by('email')
     63 *
     64 * @param string $email User's email address
     65 * @return bool|object False on failure, User DB row object
     66 */
     67function get_user_by_email($email) {
     68    _deprecated_function( __FUNCTION__, '3.3', "get_user_by('email')" );
     69    return get_user_by('email', $email);
     70}
     71endif;
     72
    3973if ( !function_exists('wp_setcookie') ) :
    4074/**
     
    5589function wp_setcookie($username, $password = '', $already_md5 = false, $home = '', $siteurl = '', $remember = false) {
    5690    _deprecated_function( __FUNCTION__, '2.5', 'wp_set_auth_cookie()' );
    57     $user = get_userdatabylogin($username);
     91    $user = get_user_by('login', $username);
    5892    wp_set_auth_cookie($user->ID, $remember);
    5993}
  • trunk/wp-includes/pluggable.php

    r18504 r18513  
    200200
    201201    return $user;
    202 }
    203 endif;
    204 
    205 if ( !function_exists('get_userdatabylogin') ) :
    206 /**
    207  * Retrieve user info by login name.
    208  *
    209  * @since 0.71
    210  *
    211  * @param string $user_login User's username
    212  * @return bool|object False on failure, User DB row object
    213  */
    214 function get_userdatabylogin($user_login) {
    215     return get_user_by('login', $user_login);
    216 }
    217 endif;
    218 
    219 if ( !function_exists('get_user_by_email') ) :
    220 /**
    221  * Retrieve user info by email.
    222  *
    223  * @since 2.5
    224  *
    225  * @param string $email User's email address
    226  * @return bool|object False on failure, User DB row object
    227  */
    228 function get_user_by_email($email) {
    229     return get_user_by('email', $email);
    230202}
    231203endif;
     
    595567    }
    596568
    597     $user = get_userdatabylogin($username);
     569    $user = get_user_by('login', $username);
    598570    if ( ! $user ) {
    599571        do_action('auth_cookie_bad_username', $cookie_elements);
  • trunk/wp-includes/post.php

    r18500 r18513  
    33963396                //Do we have an author id or an author login?
    33973397                if ( 0 == intval($post_author) ) {
    3398                     $post_author = get_userdatabylogin($post_author);
     3398                    $post_author = get_user_by('login', $post_author);
    33993399                    if ( empty($post_author) )
    34003400                        continue;
  • trunk/wp-includes/user.php

    r18504 r18513  
    12971297 */
    12981298function username_exists( $username ) {
    1299     if ( $user = get_userdatabylogin( $username ) ) {
     1299    if ( $user = get_user_by('login', $username ) ) {
    13001300        return $user->ID;
    13011301    } else {
     
    13141314 */
    13151315function email_exists( $email ) {
    1316     if ( $user = get_user_by_email($email) )
     1316    if ( $user = get_user_by('email', $email) )
    13171317        return $user->ID;
    13181318
  • trunk/wp-login.php

    r18504 r18513  
    172172
    173173    if ( strpos($_POST['user_login'], '@') ) {
    174         $user_data = get_user_by_email(trim($_POST['user_login']));
     174        $user_data = get_user_by('email', trim($_POST['user_login']));
    175175        if ( empty($user_data) )
    176176            $errors->add('invalid_email', __('<strong>ERROR</strong>: There is no user registered with that email address.'));
    177177    } else {
    178178        $login = trim($_POST['user_login']);
    179         $user_data = get_userdatabylogin($login);
     179        $user_data = get_user_by('login', $login);
    180180    }
    181181
     
    545545    if ( !empty($_POST['log']) && !force_ssl_admin() ) {
    546546        $user_name = sanitize_user($_POST['log']);
    547         if ( $user = get_userdatabylogin($user_name) ) {
     547        if ( $user = get_user_by('login', $user_name) ) {
    548548            if ( get_user_option('use_ssl', $user->ID) ) {
    549549                $secure_cookie = true;
  • trunk/wp-mail.php

    r14924 r18513  
    114114                if ( is_email($author) ) {
    115115                    echo '<p>' . sprintf(__('Author is %s'), $author) . '</p>';
    116                     $userdata = get_user_by_email($author);
     116                    $userdata = get_user_by('email', $author);
    117117                    if ( empty($userdata) ) {
    118118                        $author_found = false;
Note: See TracChangeset for help on using the changeset viewer.