Ticket #8776: 8776-try-1.patch
| File 8776-try-1.patch, 3.6 KB (added by , 17 years ago) |
|---|
-
author-template.php
53 53 /** 54 54 * Retrieve the description of the author of the current post. 55 55 * 56 * @since 2.8.0 57 * @uses $authordata The current author's DB object. 58 * @return string The author's field from the current author's DB object. 59 */ 60 function the_author_meta($field = '') { 61 global $authordata; 62 return isset($authordata->$field) ? $authordata->$field : ''; 63 } 64 65 66 67 /** 68 * Retrieve the description of the author of the current post. 69 * 56 70 * @since 1.5 57 71 * @uses $authordata The current author's DB object. 58 72 * @return string The author's description. 59 73 */ 60 74 function get_the_author_description() { 61 global $authordata; 62 return $authordata->description; 75 echo the_author_meta('description'); 63 76 } 64 77 65 78 /** … … 70 83 * @see get_the_author_description() 71 84 */ 72 85 function the_author_description() { 73 echo get_the_author_description();86 echo the_author_meta('description'); 74 87 } 75 88 76 89 /** … … 81 94 * @return string The author's login name (username). 82 95 */ 83 96 function get_the_author_login() { 84 global $authordata; 85 return $authordata->user_login; 97 echo the_author_meta('user_login'); 86 98 } 87 99 88 100 /** … … 93 105 * @see get_the_author_login() 94 106 */ 95 107 function the_author_login() { 96 echo get_the_author_login();108 echo the_author_meta('user_login'); 97 109 } 98 110 99 111 /** … … 104 116 * @return string The author's first name. 105 117 */ 106 118 function get_the_author_firstname() { 107 global $authordata; 108 return $authordata->first_name; 119 echo the_author_meta('first_name'); 109 120 } 110 121 111 122 /** … … 116 127 * @uses get_the_author_firstname() 117 128 */ 118 129 function the_author_firstname() { 119 echo get_the_author_firstname();130 echo the_author_meta('first_name'); 120 131 } 121 132 122 133 /** … … 127 138 * @return string The author's last name. 128 139 */ 129 140 function get_the_author_lastname() { 130 global $authordata; 131 return $authordata->last_name; 141 echo the_author_meta('last_name'); 132 142 } 133 143 134 144 /** … … 139 149 * @uses get_the_author_lastname() 140 150 */ 141 151 function the_author_lastname() { 142 echo get_the_author_lastname();152 echo the_author_meta('last_name'); 143 153 } 144 154 145 155 /** … … 150 160 * @return string The author's nickname. 151 161 */ 152 162 function get_the_author_nickname() { 153 global $authordata; 154 return $authordata->nickname; 163 echo the_author_meta('nickname'); 155 164 } 156 165 157 166 /** … … 162 171 * @uses get_the_author_nickname() 163 172 */ 164 173 function the_author_nickname() { 165 echo get_the_author_nickname();174 echo the_author_meta('nickname'); 166 175 } 167 176 168 177 /** … … 173 182 * @return int The author's ID. 174 183 */ 175 184 function get_the_author_ID() { 176 global $authordata; 177 return (int) $authordata->ID; 185 echo the_author_meta('ID'); 178 186 } 179 187 180 188 /** … … 185 193 * @uses get_the_author_ID() 186 194 */ 187 195 function the_author_ID() { 188 echo get_the_author_id();196 echo the_author_meta('ID'); 189 197 } 190 198 191 199 /** … … 196 204 * @return string The author's username. 197 205 */ 198 206 function get_the_author_email() { 199 global $authordata; 200 return $authordata->user_email; 207 echo the_author_meta('user_email'); 201 208 } 202 209 203 210 /** … … 208 215 * @uses get_the_author_email() 209 216 */ 210 217 function the_author_email() { 211 echo apply_filters('the_author_email', get_the_author_email());218 echo the_author_meta('user_email'); 212 219 } 213 220 214 221 /** … … 435 442 * @return string The author's display name. 436 443 */ 437 444 function get_author_name( $auth_id ) { 438 $authordata = get_userdata( $auth_id ); 439 return $authordata->display_name; 440 } 445 echo the_author_meta('display_name'); 441 446 442 447 /** 443 448 * List all the authors of the blog, with several options available.