I tried to find replacement function for get_user_by_email($email) but no luck. This function I am using to allow user to log in by email address or user id. Is there any replacement function or alternate way to do that?
1 Answer
get_user_by
is the replacement for get_user_by_email
:
$user = get_user_by( 'email', '[email protected]' );
-
one question how can I assign 2nd value ([email protected]) with dynamic variable so it will consider email for whoever login Commented Oct 17, 2012 at 6:43
-
here is my function. will it work properly?
function login_with_email_address($username) { $user = get_user_by( 'email', $user->user_email ); //$user = get_user_by_email($username); if(!empty($user->user_login)) $username = $user->user_login; return $username; }
Commented Oct 17, 2012 at 6:44