Ticket #20529: 20529.patch
File 20529.patch, 1.3 KB (added by , 13 years ago) |
---|
-
wp-includes/author-template.php
89 89 90 90 /** 91 91 * Retrieve the requested data of the author of the current post. 92 * 92 93 * @link http://codex.wordpress.org/Template_Tags/the_author_meta 93 94 * @since 2.8.0 94 * @ uses$authordata The current author's DB object (if $user_id not specified).95 * @global $authordata The current author's DB object (if $user_id not specified). 95 96 * @param string $field selects the field of the users record. 96 97 * @param int $user_id Optional. User ID. 97 98 * @return string The author's field from the current author's DB object. 98 99 */ 99 100 function get_the_author_meta( $field = '', $user_id = false ) { 100 if ( ! $user_id ) { 101 global $authordata; 102 $user_id = $authordata->ID; 101 if ( ! is_int( $user_id ) ) { 102 global $authordata, $post; 103 104 // Author data might not be available yet 105 if ( empty( $authordata ) ) { 106 107 // Post might have been manipulated 108 if ( empty( $post->post_author ) ) { 109 wp_reset_postdata(); 110 } 111 112 // Set author data according to the post author 113 $authordata = get_userdata( $post->post_author ); 114 } 115 116 // Set the user ID if we have one 117 if ( ! empty( $authordata->ID ) ) { 118 $user_id = $authordata->ID; 119 } 103 120 } else { 104 121 $authordata = get_userdata( $user_id ); 105 122 }