Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

get_user_by is the replacement for get_user_by_email:

$user = get_user_by( 'email', 'user@email.com' );
share|improve this answer
    
wonderful its done. Thanks a lot. –  pixelngrain Oct 17 '12 at 6:41
    
one question how can I assign 2nd value (user@email.com) with dynamic variable so it will consider email for whoever login –  pixelngrain Oct 17 '12 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; } –  pixelngrain Oct 17 '12 at 6:44

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.