mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-12-06 12:51:58 +00:00
Deprecate get_userdatabylogin() and get_user_by_email(). Props scribu. fixes #18333
git-svn-id: https://develop.svn.wordpress.org/trunk@18513 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -447,7 +447,7 @@ class WP_User {
|
||||
if ( ! empty( $id ) )
|
||||
$this->data = get_userdata( $id );
|
||||
else
|
||||
$this->data = get_userdatabylogin( $name );
|
||||
$this->data = get_user_by('login', $name );
|
||||
|
||||
if ( empty( $this->data->ID ) )
|
||||
return;
|
||||
|
||||
@@ -36,6 +36,40 @@ function set_current_user($id, $name = '') {
|
||||
}
|
||||
endif;
|
||||
|
||||
if ( !function_exists('get_userdatabylogin') ) :
|
||||
/**
|
||||
* Retrieve user info by login name.
|
||||
*
|
||||
* @since 0.71
|
||||
* @deprecated 2.5
|
||||
* @deprecated Use get_user_by('login')
|
||||
*
|
||||
* @param string $user_login User's username
|
||||
* @return bool|object False on failure, User DB row object
|
||||
*/
|
||||
function get_userdatabylogin($user_login) {
|
||||
_deprecated_function( __FUNCTION__, '3.3', "get_user_by('login')" );
|
||||
return get_user_by('login', $user_login);
|
||||
}
|
||||
endif;
|
||||
|
||||
if ( !function_exists('get_user_by_email') ) :
|
||||
/**
|
||||
* Retrieve user info by email.
|
||||
*
|
||||
* @since 2.5
|
||||
* @deprecated 2.5
|
||||
* @deprecated Use get_user_by('email')
|
||||
*
|
||||
* @param string $email User's email address
|
||||
* @return bool|object False on failure, User DB row object
|
||||
*/
|
||||
function get_user_by_email($email) {
|
||||
_deprecated_function( __FUNCTION__, '3.3', "get_user_by('email')" );
|
||||
return get_user_by('email', $email);
|
||||
}
|
||||
endif;
|
||||
|
||||
if ( !function_exists('wp_setcookie') ) :
|
||||
/**
|
||||
* Sets a cookie for a user who just logged in. This function is deprecated.
|
||||
@@ -54,7 +88,7 @@ if ( !function_exists('wp_setcookie') ) :
|
||||
*/
|
||||
function wp_setcookie($username, $password = '', $already_md5 = false, $home = '', $siteurl = '', $remember = false) {
|
||||
_deprecated_function( __FUNCTION__, '2.5', 'wp_set_auth_cookie()' );
|
||||
$user = get_userdatabylogin($username);
|
||||
$user = get_user_by('login', $username);
|
||||
wp_set_auth_cookie($user->ID, $remember);
|
||||
}
|
||||
else :
|
||||
@@ -133,4 +167,4 @@ function wp_login($username, $password, $deprecated = '') {
|
||||
}
|
||||
else :
|
||||
_deprecated_function( 'wp_login', '2.5', 'wp_signon()' );
|
||||
endif;
|
||||
endif;
|
||||
|
||||
@@ -202,34 +202,6 @@ function get_user_by($field, $value) {
|
||||
}
|
||||
endif;
|
||||
|
||||
if ( !function_exists('get_userdatabylogin') ) :
|
||||
/**
|
||||
* Retrieve user info by login name.
|
||||
*
|
||||
* @since 0.71
|
||||
*
|
||||
* @param string $user_login User's username
|
||||
* @return bool|object False on failure, User DB row object
|
||||
*/
|
||||
function get_userdatabylogin($user_login) {
|
||||
return get_user_by('login', $user_login);
|
||||
}
|
||||
endif;
|
||||
|
||||
if ( !function_exists('get_user_by_email') ) :
|
||||
/**
|
||||
* Retrieve user info by email.
|
||||
*
|
||||
* @since 2.5
|
||||
*
|
||||
* @param string $email User's email address
|
||||
* @return bool|object False on failure, User DB row object
|
||||
*/
|
||||
function get_user_by_email($email) {
|
||||
return get_user_by('email', $email);
|
||||
}
|
||||
endif;
|
||||
|
||||
if ( !function_exists( 'wp_mail' ) ) :
|
||||
/**
|
||||
* Send mail, similar to PHP's mail
|
||||
@@ -594,7 +566,7 @@ function wp_validate_auth_cookie($cookie = '', $scheme = '') {
|
||||
return false;
|
||||
}
|
||||
|
||||
$user = get_userdatabylogin($username);
|
||||
$user = get_user_by('login', $username);
|
||||
if ( ! $user ) {
|
||||
do_action('auth_cookie_bad_username', $cookie_elements);
|
||||
return false;
|
||||
|
||||
@@ -3395,7 +3395,7 @@ function &get_pages($args = '') {
|
||||
foreach ( $post_authors as $post_author ) {
|
||||
//Do we have an author id or an author login?
|
||||
if ( 0 == intval($post_author) ) {
|
||||
$post_author = get_userdatabylogin($post_author);
|
||||
$post_author = get_user_by('login', $post_author);
|
||||
if ( empty($post_author) )
|
||||
continue;
|
||||
if ( empty($post_author->ID) )
|
||||
|
||||
@@ -1296,7 +1296,7 @@ function clean_user_cache($id) {
|
||||
* @return null|int The user's ID on success, and null on failure.
|
||||
*/
|
||||
function username_exists( $username ) {
|
||||
if ( $user = get_userdatabylogin( $username ) ) {
|
||||
if ( $user = get_user_by('login', $username ) ) {
|
||||
return $user->ID;
|
||||
} else {
|
||||
return null;
|
||||
@@ -1313,7 +1313,7 @@ function username_exists( $username ) {
|
||||
* @return bool|int The user's ID on success, and false on failure.
|
||||
*/
|
||||
function email_exists( $email ) {
|
||||
if ( $user = get_user_by_email($email) )
|
||||
if ( $user = get_user_by('email', $email) )
|
||||
return $user->ID;
|
||||
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user