Very often in your projects, you want to pull out the author data, given a post id. It is very easy do it in wordpress.

It can be accomplished by the_author_meta() function or get_the_author_meta() function.You will need call this function in your theme or plugin, through a hook

the_author_meta() –> Outputs the data, just like echo
get_the_author_meta() -> holds the value in value.

The below function, retreives user details like…

[php]
function author_details($post_ID)  {
$auth = get_post($post_ID); // gets author from post
$authid = $auth->post_author; // gets author id for the post
$user_email = get_the_author_meta(‘user_email’,$authid); // retrieve user email
$user_firstname = get_the_author_meta(‘user_firstname’,$authid); // retrieve firstname
$user_nickname = get_the_author_meta(‘nickname,$authid); // retrieve user nickname
}
[/php]

The following list of user fields you can retrieve using this function.

  • user_login
  • user_pass
  • user_nicename
  • user_email
  • user_url
  • user_registered
  • user_activation_key
  • user_status
  • display_name
  • nickname
  • first_name
  • last_name
  • description
  • jabber
  • aim
  • yim
  • user_level
  • user_firstname
  • user_lastname
  • user_description
  • rich_editing
  • comment_shortcuts
  • admin_color
  • plugins_per_page
  • plugins_last_view
  • ID

For full reference, please see: http://codex.wordpress.org/Function_Reference/the_author_meta