web/wp-includes/author-template.php
branchwordpress
changeset 132 4d4862461b8d
parent 109 03b0d1493584
equal deleted inserted replaced
131:a4642baaf829 132:4d4862461b8d
    20  * @param string $deprecated Deprecated.
    20  * @param string $deprecated Deprecated.
    21  * @return string The author's display name.
    21  * @return string The author's display name.
    22  */
    22  */
    23 function get_the_author($deprecated = '') {
    23 function get_the_author($deprecated = '') {
    24 	global $authordata;
    24 	global $authordata;
    25 	return apply_filters('the_author', $authordata->display_name);
    25 	return apply_filters('the_author', is_object($authordata) ? $authordata->display_name : null);
    26 }
    26 }
    27 
    27 
    28 /**
    28 /**
    29  * Display the name of the author of the current post.
    29  * Display the name of the author of the current post.
    30  *
    30  *
   102 	elseif ( isset($authordata->$user_field) )
   102 	elseif ( isset($authordata->$user_field) )
   103 		$value = $authordata->$user_field;
   103 		$value = $authordata->$user_field;
   104 	else
   104 	else
   105 		$value = isset($authordata->$field) ? $authordata->$field : '';
   105 		$value = isset($authordata->$field) ? $authordata->$field : '';
   106 
   106 
   107 	return apply_filters('get_the_author_' . $field, $value);
   107 	return apply_filters('get_the_author_' . $field, $value, $user_id);
   108 }
   108 }
   109 
   109 
   110 /**
   110 /**
   111  * Retrieve the requested data of the author of the current post.
   111  * Retrieve the requested data of the author of the current post.
   112  * @link http://codex.wordpress.org/Template_Tags/the_author_meta
   112  * @link http://codex.wordpress.org/Template_Tags/the_author_meta
   114  * @param string $field selects the field of the users record.
   114  * @param string $field selects the field of the users record.
   115  * @param int $user_id Optional. User ID.
   115  * @param int $user_id Optional. User ID.
   116  * @echo string The author's field from the current author's DB object.
   116  * @echo string The author's field from the current author's DB object.
   117  */
   117  */
   118 function the_author_meta($field = '', $user_id = false) {
   118 function the_author_meta($field = '', $user_id = false) {
   119 	echo apply_filters('the_author_' . $field, get_the_author_meta($field, $user_id));
   119 	echo apply_filters('the_author_' . $field, get_the_author_meta($field, $user_id), $user_id);
   120 }
   120 }
   121 
   121 
   122 /**
   122 /**
   123  * Display either author's link or author's name.
   123  * Display either author's link or author's name.
   124  *
   124  *
   176  * @uses get_the_author()
   176  * @uses get_the_author()
   177  * @param string $deprecated Deprecated.
   177  * @param string $deprecated Deprecated.
   178  */
   178  */
   179 function the_author_posts_link($deprecated = '') {
   179 function the_author_posts_link($deprecated = '') {
   180 	global $authordata;
   180 	global $authordata;
   181 	printf(
   181 	$link = sprintf(
   182 		'<a href="%1$s" title="%2$s">%3$s</a>',
   182 		'<a href="%1$s" title="%2$s">%3$s</a>',
   183 		get_author_posts_url( $authordata->ID, $authordata->user_nicename ),
   183 		get_author_posts_url( $authordata->ID, $authordata->user_nicename ),
   184 		esc_attr( sprintf( __( 'Posts by %s' ), get_the_author() ) ),
   184 		esc_attr( sprintf( __( 'Posts by %s' ), get_the_author() ) ),
   185 		get_the_author()
   185 		get_the_author()
   186 	);
   186 	);
       
   187 	echo apply_filters( 'the_author_posts_link', $link );
   187 }
   188 }
   188 
   189 
   189 /**
   190 /**
   190  * Retrieve the URL to the author page of the author of the current post.
   191  * Retrieve the URL to the author page of the author of the current post.
   191  *
   192  *