X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/baca9ce86a38dc54c4574890ee2d352fd81f78b2..61343b82c4f0da4c68e4c6373daafff4a81efdd1:/wp-includes/ms-deprecated.php?ds=sidebyside diff --git a/wp-includes/ms-deprecated.php b/wp-includes/ms-deprecated.php index 9b9c43f9..9c6cad45 100644 --- a/wp-includes/ms-deprecated.php +++ b/wp-includes/ms-deprecated.php @@ -270,3 +270,32 @@ function wpmu_admin_redirect_add_updated_param( $url = '' ) { } return $url; } + +/** + * 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; +}