get_the_author_meta

Retrieve the requested data of the author of the current post.

Description

get_the_author_meta( (string) $field = '', (constant) $user_id = false ); 

Parameters (2)

0. $field — Optional. (string) => ''
The field.
1. $user_id — Optional. (constant) => false
The user id.

Usage

  1. if ( !function_exists( 'get_the_author_meta' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'bp-groupblog/themes/p2/inc/compat.php'; 
  3.  
  4. // The field. 
  5. $field = ''; 
  6.  
  7. // The user id. 
  8. $user_id = false; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = get_the_author_meta($field, $user_id); 
  12.  

Defined (1)

The function is defined in the following location(s).

/themes/p2/inc/compat.php  
  1. function get_the_author_meta($field = '', $user_id = false) { 
  2. if ( ! $user_id ) 
  3. global $authordata; 
  4. else 
  5. $authordata = get_userdata( $user_id ); 
  6.  
  7. $field = strtolower($field); 
  8. $user_field = "user_$field"; 
  9.  
  10. if ( 'id' == $field ) 
  11. $value = isset($authordata->ID) ? (int)$authordata->ID : 0; 
  12. elseif ( isset($authordata->$user_field) ) 
  13. $value = $authordata->$user_field; 
  14. else 
  15. $value = isset($authordata->$field) ? $authordata->$field : ''; 
  16.  
  17. return apply_filters( 'get_the_author_' . $field, $value);