X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/96bc8e88cf39086a9e0a883b8e2c311fe82a5e97..e0bf0ae6a149125bedfeaf344114a97d5864e74d:/wp-includes/ms-deprecated.php diff --git a/wp-includes/ms-deprecated.php b/wp-includes/ms-deprecated.php index 9b910b72..9c6cad45 100644 --- a/wp-includes/ms-deprecated.php +++ b/wp-includes/ms-deprecated.php @@ -49,7 +49,7 @@ function is_site_admin( $user_login = '' ) { return false; } else { $user = get_user_by( 'login', $user_login ); - if ( empty( $user->ID ) ) + if ( ! $user->exists() ) return false; $user_id = $user->ID; } @@ -271,4 +271,31 @@ function wpmu_admin_redirect_add_updated_param( $url = '' ) { return $url; } -?> \ No newline at end of file +/** + * Get a numeric user ID from either an email address or a login. + * + * A numeric string is considered to be an existing user ID + * and is simply returned as such. + * + * @since MU + * @deprecated 3.6.0 + * @deprecated Use get_user_by() + * @uses get_user_by() + * + * @param string $string Either an email address or a login. + * @return int + */ +function get_user_id_from_string( $string ) { + _deprecated_function( __FUNCTION__, '3.6', 'get_user_by()' ); + + if ( is_email( $string ) ) + $user = get_user_by( 'email', $string ); + elseif ( is_numeric( $string ) ) + return $string; + else + $user = get_user_by( 'login', $string ); + + if ( $user ) + return $user->ID; + return 0; +}