This is second in the series of un documented but useful wordpress api functions.
get_user_by_email($email)
Description
It is one of the important but not documented method on codex(as of now),It provides same information as the get_userdata(),get_userdatabylogin(), except the fact that it takes the email address of registered user(e.g. admin@geekytalks.com as an argument rather than the ID/username of user).It returns an object with the information pertaining to the user whose login name is passed to it. Properties map directly to wp_users table in the database.
Usage
The call to get_user_by_email() returns the user’s data, where it can be retrieved using member variables.
<?php $user_info=get_user_by_email(get_option('admin_email)); echo ('Username:'.$user_info->user_login . '\n'); echo('User level: ' . $user_info->user_level . '\n'); echo('User ID: ' . $user_info->ID . '\n'); ?>
Username: admin
User level: 10
User ID: 1
Accessing Usermeta Data
<?php $user_info=get_user_by_email(get_option('admin_email)); echo ($user_info->last_name . ", " . $user_info->first_name . "\n"); ?>
Singh,Brajesh
Parameters
- (String) (required) The email address(of registered user) of the user whose data should be retrieved.
- Default: None
Values in users & user_meta table
Here are the values in the users table you can access via this function:
users
- ID
- user_login
- user_pass
- user_nicename
- user_email
- user_url
- user_registered
- user_activation_key
- user_status
- display_name
useful in user_meta
- first_name
- last_name
- nickname
- user_level
- admin_color (Theme of your admin page. Default is fresh.)
- closedpostboxes_page
- nickname
- primary_blog
- rich_editing
- source_domain
- It works in the same manner as get_userdata() ,except that the argument passed in get_userdata() is an integer(The ID of User),while In the case of get_userdatabylogin() ,the argument passed is string(The Login name e.g. “admin”)
See as a reference :http://codex.wordpress.org/Function_Reference/get_userdata
If you enjoyed this post, make sure you subscribe to my RSS feed!We will keep coming with more informative tips,tricks,tutorials to keep you updated with wordpress/buddypress/wordpress mu regularly.If you want to help us,You can ,by spreading the words.We provide free and premium plugins/support for wordpress Mu,buddypress at a very low cost (starting with $30 for 3 months membership).If you or anyone you know,needs some real good plugins/themes for their wordpress Mu/buddypress powered site, Please refer them to http://BuddyDev.com.We will highly appreciate your support and keep coming with more useful and free stuffs.

![[blinklist]](http://www.thinkinginwordpress.com/wp-content/plugins/bookmarkify/blinklist.png)
![[Bloglines]](http://www.thinkinginwordpress.com/wp-content/plugins/bookmarkify/bloglines.png)
![[del.icio.us]](http://www.thinkinginwordpress.com/wp-content/plugins/bookmarkify/delicious.png)
![[Digg]](http://www.thinkinginwordpress.com/wp-content/plugins/bookmarkify/digg.png)
![[dzone]](http://www.thinkinginwordpress.com/wp-content/plugins/bookmarkify/dzone.png)
![[Facebook]](http://www.thinkinginwordpress.com/wp-content/plugins/bookmarkify/facebook.png)
![[Ma.gnolia]](http://www.thinkinginwordpress.com/wp-content/plugins/bookmarkify/magnolia.png)
![[Mister Wong]](http://www.thinkinginwordpress.com/wp-content/plugins/bookmarkify/misterwong.png)
![[Reddit]](http://www.thinkinginwordpress.com/wp-content/plugins/bookmarkify/reddit.png)
![[Sphere]](http://www.thinkinginwordpress.com/wp-content/plugins/bookmarkify/sphere.png)
![[Sphinn]](http://www.thinkinginwordpress.com/wp-content/plugins/bookmarkify/sphinn.png)
![[StumbleUpon]](http://www.thinkinginwordpress.com/wp-content/plugins/bookmarkify/stumbleupon.png)
![[Technorati]](http://www.thinkinginwordpress.com/wp-content/plugins/bookmarkify/technorati.png)
![[Email]](http://www.thinkinginwordpress.com/wp-content/plugins/bookmarkify/email.png)


