mp-wp_genesis 1 <?php
mp-wp_genesis 2 /**
mp-wp_genesis 3 * Author Template functions for use in themes.
mp-wp_genesis 4 *
mp-wp_genesis 5 * These functions must be used within the WordPress Loop.
mp-wp_genesis 6 *
mp-wp_genesis 7 * @link http://codex.wordpress.org/Author_Templates
mp-wp_genesis 8 *
mp-wp_genesis 9 * @package WordPress
mp-wp_genesis 10 * @subpackage Template
mp-wp_genesis 11 */
mp-wp_genesis 12
mp-wp_genesis 13 /**
mp-wp_genesis 14 * Retrieve the author of the current post.
mp-wp_genesis 15 *
mp-wp_genesis 16 * @since 1.5
mp-wp_genesis 17 * @uses $authordata The current author's DB object.
mp-wp_genesis 18 * @uses apply_filters() Calls 'the_author' hook on the author display name.
mp-wp_genesis 19 *
mp-wp_genesis 20 * @param string $deprecated Deprecated.
mp-wp_genesis 21 * @return string The author's display name.
mp-wp_genesis 22 */
mp-wp_genesis 23 function get_the_author($deprecated = '') {
mp-wp_genesis 24 global $authordata;
mp-wp_genesis 25 return apply_filters('the_author', $authordata->display_name);
mp-wp_genesis 26 }
mp-wp_genesis 27
mp-wp_genesis 28 /**
mp-wp_genesis 29 * Display the name of the author of the current post.
mp-wp_genesis 30 *
mp-wp_genesis 31 * The behavior of this function is based off of old functionality predating
mp-wp_genesis 32 * get_the_author(). This function is not deprecated, but is designed to echo
mp-wp_genesis 33 * the value from get_the_author() and as an result of any old theme that might
mp-wp_genesis 34 * still use the old behavior will also pass the value from get_the_author().
mp-wp_genesis 35 *
mp-wp_genesis 36 * The normal, expected behavior of this function is to echo the author and not
mp-wp_genesis 37 * return it. However, backwards compatiability has to be maintained.
mp-wp_genesis 38 *
mp-wp_genesis 39 * @since 0.71
mp-wp_genesis 40 * @see get_the_author()
mp-wp_genesis 41 * @link http://codex.wordpress.org/Template_Tags/the_author
mp-wp_genesis 42 *
mp-wp_genesis 43 * @param string $deprecated Deprecated.
mp-wp_genesis 44 * @param string $deprecated_echo Echo the string or return it.
mp-wp_genesis 45 * @return string The author's display name, from get_the_author().
mp-wp_genesis 46 */
mp-wp_genesis 47 function the_author($deprecated = '', $deprecated_echo = true) {
mp-wp_genesis 48 if ( $deprecated_echo )
mp-wp_genesis 49 echo get_the_author();
mp-wp_genesis 50 return get_the_author();
mp-wp_genesis 51 }
mp-wp_genesis 52
mp-wp_genesis 53 /**
mp-wp_genesis 54 * Retrieve the description of the author of the current post.
mp-wp_genesis 55 *
mp-wp_genesis 56 * @since 1.5
mp-wp_genesis 57 * @uses $authordata The current author's DB object.
mp-wp_genesis 58 * @return string The author's description.
mp-wp_genesis 59 */
mp-wp_genesis 60 function get_the_author_description() {
mp-wp_genesis 61 global $authordata;
mp-wp_genesis 62 return $authordata->description;
mp-wp_genesis 63 }
mp-wp_genesis 64
mp-wp_genesis 65 /**
mp-wp_genesis 66 * Display the description of the author of the current post.
mp-wp_genesis 67 *
mp-wp_genesis 68 * @link http://codex.wordpress.org/Template_Tags/the_author_description
mp-wp_genesis 69 * @since 1.0.0
mp-wp_genesis 70 * @see get_the_author_description()
mp-wp_genesis 71 */
mp-wp_genesis 72 function the_author_description() {
mp-wp_genesis 73 echo get_the_author_description();
mp-wp_genesis 74 }
mp-wp_genesis 75
mp-wp_genesis 76 /**
mp-wp_genesis 77 * Retrieve the login name of the author of the current post.
mp-wp_genesis 78 *
mp-wp_genesis 79 * @since 1.5
mp-wp_genesis 80 * @uses $authordata The current author's DB object.
mp-wp_genesis 81 * @return string The author's login name (username).
mp-wp_genesis 82 */
mp-wp_genesis 83 function get_the_author_login() {
mp-wp_genesis 84 global $authordata;
mp-wp_genesis 85 return $authordata->user_login;
mp-wp_genesis 86 }
mp-wp_genesis 87
mp-wp_genesis 88 /**
mp-wp_genesis 89 * Display the login name of the author of the current post.
mp-wp_genesis 90 *
mp-wp_genesis 91 * @link http://codex.wordpress.org/Template_Tags/the_author_login
mp-wp_genesis 92 * @since 0.71
mp-wp_genesis 93 * @see get_the_author_login()
mp-wp_genesis 94 */
mp-wp_genesis 95 function the_author_login() {
mp-wp_genesis 96 echo get_the_author_login();
mp-wp_genesis 97 }
mp-wp_genesis 98
mp-wp_genesis 99 /**
mp-wp_genesis 100 * Retrieve the first name of the author of the current post.
mp-wp_genesis 101 *
mp-wp_genesis 102 * @since 1.5
mp-wp_genesis 103 * @uses $authordata The current author's DB object.
mp-wp_genesis 104 * @return string The author's first name.
mp-wp_genesis 105 */
mp-wp_genesis 106 function get_the_author_firstname() {
mp-wp_genesis 107 global $authordata;
mp-wp_genesis 108 return $authordata->first_name;
mp-wp_genesis 109 }
mp-wp_genesis 110
mp-wp_genesis 111 /**
mp-wp_genesis 112 * Display the first name of the author of the current post.
mp-wp_genesis 113 *
mp-wp_genesis 114 * @link http://codex.wordpress.org/Template_Tags/the_author_firstname
mp-wp_genesis 115 * @since 0.71
mp-wp_genesis 116 * @uses get_the_author_firstname()
mp-wp_genesis 117 */
mp-wp_genesis 118 function the_author_firstname() {
mp-wp_genesis 119 echo get_the_author_firstname();
mp-wp_genesis 120 }
mp-wp_genesis 121
mp-wp_genesis 122 /**
mp-wp_genesis 123 * Retrieve the last name of the author of the current post.
mp-wp_genesis 124 *
mp-wp_genesis 125 * @since 1.5
mp-wp_genesis 126 * @uses $authordata The current author's DB object.
mp-wp_genesis 127 * @return string The author's last name.
mp-wp_genesis 128 */
mp-wp_genesis 129 function get_the_author_lastname() {
mp-wp_genesis 130 global $authordata;
mp-wp_genesis 131 return $authordata->last_name;
mp-wp_genesis 132 }
mp-wp_genesis 133
mp-wp_genesis 134 /**
mp-wp_genesis 135 * Display the last name of the author of the current post.
mp-wp_genesis 136 *
mp-wp_genesis 137 * @link http://codex.wordpress.org/Template_Tags/the_author_lastname
mp-wp_genesis 138 * @since 0.71
mp-wp_genesis 139 * @uses get_the_author_lastname()
mp-wp_genesis 140 */
mp-wp_genesis 141 function the_author_lastname() {
mp-wp_genesis 142 echo get_the_author_lastname();
mp-wp_genesis 143 }
mp-wp_genesis 144
mp-wp_genesis 145 /**
mp-wp_genesis 146 * Retrieve the nickname of the author of the current post.
mp-wp_genesis 147 *
mp-wp_genesis 148 * @since 1.5
mp-wp_genesis 149 * @uses $authordata The current author's DB object.
mp-wp_genesis 150 * @return string The author's nickname.
mp-wp_genesis 151 */
mp-wp_genesis 152 function get_the_author_nickname() {
mp-wp_genesis 153 global $authordata;
mp-wp_genesis 154 return $authordata->nickname;
mp-wp_genesis 155 }
mp-wp_genesis 156
mp-wp_genesis 157 /**
mp-wp_genesis 158 * Display the nickname of the author of the current post.
mp-wp_genesis 159 *
mp-wp_genesis 160 * @link http://codex.wordpress.org/Template_Tags/the_author_nickname
mp-wp_genesis 161 * @since 0.71
mp-wp_genesis 162 * @uses get_the_author_nickname()
mp-wp_genesis 163 */
mp-wp_genesis 164 function the_author_nickname() {
mp-wp_genesis 165 echo get_the_author_nickname();
mp-wp_genesis 166 }
mp-wp_genesis 167
mp-wp_genesis 168 /**
mp-wp_genesis 169 * Retrieve the ID of the author of the current post.
mp-wp_genesis 170 *
mp-wp_genesis 171 * @since 1.5
mp-wp_genesis 172 * @uses $authordata The current author's DB object.
mp-wp_genesis 173 * @return int The author's ID.
mp-wp_genesis 174 */
mp-wp_genesis 175 function get_the_author_ID() {
mp-wp_genesis 176 global $authordata;
mp-wp_genesis 177 return (int) $authordata->ID;
mp-wp_genesis 178 }
mp-wp_genesis 179
mp-wp_genesis 180 /**
mp-wp_genesis 181 * Display the ID of the author of the current post.
mp-wp_genesis 182 *
mp-wp_genesis 183 * @link http://codex.wordpress.org/Template_Tags/the_author_ID
mp-wp_genesis 184 * @since 0.71
mp-wp_genesis 185 * @uses get_the_author_ID()
mp-wp_genesis 186 */
mp-wp_genesis 187 function the_author_ID() {
mp-wp_genesis 188 echo get_the_author_id();
mp-wp_genesis 189 }
mp-wp_genesis 190
mp-wp_genesis 191 /**
mp-wp_genesis 192 * Retrieve the email of the author of the current post.
mp-wp_genesis 193 *
mp-wp_genesis 194 * @since 1.5
mp-wp_genesis 195 * @uses $authordata The current author's DB object.
mp-wp_genesis 196 * @return string The author's username.
mp-wp_genesis 197 */
mp-wp_genesis 198 function get_the_author_email() {
mp-wp_genesis 199 global $authordata;
mp-wp_genesis 200 return $authordata->user_email;
mp-wp_genesis 201 }
mp-wp_genesis 202
mp-wp_genesis 203 /**
mp-wp_genesis 204 * Display the email of the author of the current post.
mp-wp_genesis 205 *
mp-wp_genesis 206 * @link http://codex.wordpress.org/Template_Tags/the_author_email
mp-wp_genesis 207 * @since 0.71
mp-wp_genesis 208 * @uses get_the_author_email()
mp-wp_genesis 209 */
mp-wp_genesis 210 function the_author_email() {
mp-wp_genesis 211 echo apply_filters('the_author_email', get_the_author_email() );
mp-wp_genesis 212 }
mp-wp_genesis 213
mp-wp_genesis 214 /**
mp-wp_genesis 215 * Retrieve the URL to the home page of the author of the current post.
mp-wp_genesis 216 *
mp-wp_genesis 217 * @since 1.5
mp-wp_genesis 218 * @uses $authordata The current author's DB object.
mp-wp_genesis 219 * @return string The URL to the author's page.
mp-wp_genesis 220 */
mp-wp_genesis 221 function get_the_author_url() {
mp-wp_genesis 222 global $authordata;
mp-wp_genesis 223
mp-wp_genesis 224 if ( 'http://' == $authordata->user_url )
mp-wp_genesis 225 return '';
mp-wp_genesis 226
mp-wp_genesis 227 return $authordata->user_url;
mp-wp_genesis 228 }
mp-wp_genesis 229
mp-wp_genesis 230 /**
mp-wp_genesis 231 * Display the URL to the home page of the author of the current post.
mp-wp_genesis 232 *
mp-wp_genesis 233 * @link http://codex.wordpress.org/Template_Tags/the_author_url
mp-wp_genesis 234 * @since 0.71
mp-wp_genesis 235 * @uses get_the_author_url()
mp-wp_genesis 236 */
mp-wp_genesis 237 function the_author_url() {
mp-wp_genesis 238 echo get_the_author_url();
mp-wp_genesis 239 }
mp-wp_genesis 240
mp-wp_genesis 241 /**
mp-wp_genesis 242 * Display either author's link or author's name.
mp-wp_genesis 243 *
mp-wp_genesis 244 * If the author has a home page set, echo an HTML link, otherwise just echo the
mp-wp_genesis 245 * author's name.
mp-wp_genesis 246 *
mp-wp_genesis 247 * @link http://codex.wordpress.org/Template_Tags/the_author_link
mp-wp_genesis 248 * @since 2.1
mp-wp_genesis 249 * @uses get_the_author_url()
mp-wp_genesis 250 * @uses the_author()
mp-wp_genesis 251 */
mp-wp_genesis 252 function the_author_link() {
mp-wp_genesis 253 if (get_the_author_url()) {
mp-wp_genesis 254 echo '<a href="' . get_the_author_url() . '" title="' . sprintf(__("Visit %s's website"), get_the_author()) . '" rel="external">' . get_the_author() . '</a>';
mp-wp_genesis 255 } else {
mp-wp_genesis 256 the_author();
mp-wp_genesis 257 }
mp-wp_genesis 258 }
mp-wp_genesis 259
mp-wp_genesis 260 /**
mp-wp_genesis 261 * Retrieve the ICQ number of the author of the current post.
mp-wp_genesis 262 *
mp-wp_genesis 263 * @since 1.5
mp-wp_genesis 264 * @uses $authordata The current author's DB object.
mp-wp_genesis 265 * @return string The author's ICQ number.
mp-wp_genesis 266 */
mp-wp_genesis 267 function get_the_author_icq() {
mp-wp_genesis 268 global $authordata;
mp-wp_genesis 269 return $authordata->icq;
mp-wp_genesis 270 }
mp-wp_genesis 271
mp-wp_genesis 272 /**
mp-wp_genesis 273 * Display the ICQ number of the author of the current post.
mp-wp_genesis 274 *
mp-wp_genesis 275 * @link http://codex.wordpress.org/Template_Tags/the_author_icq
mp-wp_genesis 276 * @since 0.71
mp-wp_genesis 277 * @see get_the_author_icq()
mp-wp_genesis 278 */
mp-wp_genesis 279 function the_author_icq() {
mp-wp_genesis 280 echo get_the_author_icq();
mp-wp_genesis 281 }
mp-wp_genesis 282
mp-wp_genesis 283 /**
mp-wp_genesis 284 * Retrieve the AIM name of the author of the current post.
mp-wp_genesis 285 *
mp-wp_genesis 286 * @since 1.5
mp-wp_genesis 287 * @uses $authordata The current author's DB object.
mp-wp_genesis 288 * @return string The author's AIM name.
mp-wp_genesis 289 */
mp-wp_genesis 290 function get_the_author_aim() {
mp-wp_genesis 291 global $authordata;
mp-wp_genesis 292 return str_replace(' ', '+', $authordata->aim);
mp-wp_genesis 293 }
mp-wp_genesis 294
mp-wp_genesis 295 /**
mp-wp_genesis 296 * Display the AIM name of the author of the current post.
mp-wp_genesis 297 *
mp-wp_genesis 298 * @link http://codex.wordpress.org/Template_Tags/the_author_aim
mp-wp_genesis 299 * @since 0.71
mp-wp_genesis 300 * @see get_the_author_aim()
mp-wp_genesis 301 */
mp-wp_genesis 302 function the_author_aim() {
mp-wp_genesis 303 echo get_the_author_aim();
mp-wp_genesis 304 }
mp-wp_genesis 305
mp-wp_genesis 306 /**
mp-wp_genesis 307 * Retrieve the Yahoo! IM name of the author of the current post.
mp-wp_genesis 308 *
mp-wp_genesis 309 * @since 1.5
mp-wp_genesis 310 * @uses $authordata The current author's DB object.
mp-wp_genesis 311 * @return string The author's Yahoo! IM name.
mp-wp_genesis 312 */
mp-wp_genesis 313 function get_the_author_yim() {
mp-wp_genesis 314 global $authordata;
mp-wp_genesis 315 return $authordata->yim;
mp-wp_genesis 316 }
mp-wp_genesis 317
mp-wp_genesis 318 /**
mp-wp_genesis 319 * Display the Yahoo! IM name of the author of the current post.
mp-wp_genesis 320 *
mp-wp_genesis 321 * @link http://codex.wordpress.org/Template_Tags/the_author_yim
mp-wp_genesis 322 * @since 0.71
mp-wp_genesis 323 * @see get_the_author_yim()
mp-wp_genesis 324 */
mp-wp_genesis 325 function the_author_yim() {
mp-wp_genesis 326 echo get_the_author_yim();
mp-wp_genesis 327 }
mp-wp_genesis 328
mp-wp_genesis 329 /**
mp-wp_genesis 330 * Retrieve the MSN address of the author of the current post.
mp-wp_genesis 331 *
mp-wp_genesis 332 * @since 1.5
mp-wp_genesis 333 * @uses $authordata The current author's DB object.
mp-wp_genesis 334 * @return string The author's MSN address.
mp-wp_genesis 335 */
mp-wp_genesis 336 function get_the_author_msn() {
mp-wp_genesis 337 global $authordata;
mp-wp_genesis 338 return $authordata->msn;
mp-wp_genesis 339 }
mp-wp_genesis 340
mp-wp_genesis 341 /**
mp-wp_genesis 342 * Display the MSN address of the author of the current post.
mp-wp_genesis 343 *
mp-wp_genesis 344 * @link http://codex.wordpress.org/Template_Tags/the_author_msn
mp-wp_genesis 345 * @since 0.71
mp-wp_genesis 346 * @see get_the_author_msn()
mp-wp_genesis 347 */
mp-wp_genesis 348 function the_author_msn() {
mp-wp_genesis 349 echo get_the_author_msn();
mp-wp_genesis 350 }
mp-wp_genesis 351
mp-wp_genesis 352 /**
mp-wp_genesis 353 * Retrieve the number of posts by the author of the current post.
mp-wp_genesis 354 *
mp-wp_genesis 355 * @since 1.5
mp-wp_genesis 356 * @uses $post The current post in the Loop's DB object.
mp-wp_genesis 357 * @uses get_usernumposts()
mp-wp_genesis 358 * @return int The number of posts by the author.
mp-wp_genesis 359 */
mp-wp_genesis 360 function get_the_author_posts() {
mp-wp_genesis 361 global $post;
mp-wp_genesis 362 return get_usernumposts($post->post_author);
mp-wp_genesis 363 }
mp-wp_genesis 364
mp-wp_genesis 365 /**
mp-wp_genesis 366 * Display the number of posts by the author of the current post.
mp-wp_genesis 367 *
mp-wp_genesis 368 * @link http://codex.wordpress.org/Template_Tags/the_author_posts
mp-wp_genesis 369 * @since 0.71
mp-wp_genesis 370 * @uses get_the_author_posts() Echos returned value from function.
mp-wp_genesis 371 */
mp-wp_genesis 372 function the_author_posts() {
mp-wp_genesis 373 echo get_the_author_posts();
mp-wp_genesis 374 }
mp-wp_genesis 375
mp-wp_genesis 376 /**
mp-wp_genesis 377 * Display an HTML link to the author page of the author of the current post.
mp-wp_genesis 378 *
mp-wp_genesis 379 * Does just echo get_author_posts_url() function, like the others do. The
mp-wp_genesis 380 * reason for this, is that another function is used to help in printing the
mp-wp_genesis 381 * link to the author's posts.
mp-wp_genesis 382 *
mp-wp_genesis 383 * @link http://codex.wordpress.org/Template_Tags/the_author_posts_link
mp-wp_genesis 384 * @since 1.2.0
mp-wp_genesis 385 * @uses $authordata The current author's DB object.
mp-wp_genesis 386 * @uses get_author_posts_url()
mp-wp_genesis 387 * @uses get_the_author()
mp-wp_genesis 388 * @param string $deprecated Deprecated.
mp-wp_genesis 389 */
mp-wp_genesis 390 function the_author_posts_link($deprecated = '') {
mp-wp_genesis 391 global $authordata;
mp-wp_genesis 392 printf(
mp-wp_genesis 393 '<a href="%1$s" title="%2$s">%3$s</a>',
mp-wp_genesis 394 get_author_posts_url( $authordata->ID, $authordata->user_nicename ),
mp-wp_genesis 395 sprintf( __( 'Posts by %s' ), attribute_escape( get_the_author() ) ),
mp-wp_genesis 396 get_the_author()
mp-wp_genesis 397 );
mp-wp_genesis 398 }
mp-wp_genesis 399
mp-wp_genesis 400 /**
mp-wp_genesis 401 * Retrieve the URL to the author page of the author of the current post.
mp-wp_genesis 402 *
mp-wp_genesis 403 * @since 2.1.0
mp-wp_genesis 404 * @uses $wp_rewrite WP_Rewrite
mp-wp_genesis 405 * @return string The URL to the author's page.
mp-wp_genesis 406 */
mp-wp_genesis 407 function get_author_posts_url($author_id, $author_nicename = '') {
mp-wp_genesis 408 global $wp_rewrite;
mp-wp_genesis 409 $auth_ID = (int) $author_id;
mp-wp_genesis 410 $link = $wp_rewrite->get_author_permastruct();
mp-wp_genesis 411
mp-wp_genesis 412 if ( empty($link) ) {
mp-wp_genesis 413 $file = get_option('home') . '/';
mp-wp_genesis 414 $link = $file . '?author=' . $auth_ID;
mp-wp_genesis 415 } else {
mp-wp_genesis 416 if ( '' == $author_nicename ) {
mp-wp_genesis 417 $user = get_userdata($author_id);
mp-wp_genesis 418 if ( !empty($user->user_nicename) )
mp-wp_genesis 419 $author_nicename = $user->user_nicename;
mp-wp_genesis 420 }
mp-wp_genesis 421 $link = str_replace('%author%', $author_nicename, $link);
mp-wp_genesis 422 $link = get_option('home') . trailingslashit($link);
mp-wp_genesis 423 }
mp-wp_genesis 424
mp-wp_genesis 425 $link = apply_filters('author_link', $link, $author_id, $author_nicename);
mp-wp_genesis 426
mp-wp_genesis 427 return $link;
mp-wp_genesis 428 }
mp-wp_genesis 429
mp-wp_genesis 430 /**
mp-wp_genesis 431 * Retrieve the specified author's preferred display name.
mp-wp_genesis 432 *
mp-wp_genesis 433 * @since 1.0.0
mp-wp_genesis 434 * @param int $auth_id The ID of the author.
mp-wp_genesis 435 * @return string The author's display name.
mp-wp_genesis 436 */
mp-wp_genesis 437 function get_author_name( $auth_id ) {
mp-wp_genesis 438 $authordata = get_userdata( $auth_id );
mp-wp_genesis 439 return $authordata->display_name;
mp-wp_genesis 440 }
mp-wp_genesis 441
mp-wp_genesis 442 /**
mp-wp_genesis 443 * List all the authors of the blog, with several options available.
mp-wp_genesis 444 *
mp-wp_genesis 445 * optioncount (boolean) (false): Show the count in parenthesis next to the
mp-wp_genesis 446 * author's name.
mp-wp_genesis 447 * exclude_admin (boolean) (true): Exclude the 'admin' user that is installed by
mp-wp_genesis 448 * default.
mp-wp_genesis 449 * show_fullname (boolean) (false): Show their full names.
mp-wp_genesis 450 * hide_empty (boolean) (true): Don't show authors without any posts.
mp-wp_genesis 451 * feed (string) (''): If isn't empty, show links to author's feeds.
mp-wp_genesis 452 * feed_image (string) (''): If isn't empty, use this image to link to feeds.
mp-wp_genesis 453 * echo (boolean) (true): Set to false to return the output, instead of echoing.
mp-wp_genesis 454 *
mp-wp_genesis 455 * @link http://codex.wordpress.org/Template_Tags/wp_list_authors
mp-wp_genesis 456 * @since 1.2.0
mp-wp_genesis 457 * @param array $args The argument array.
mp-wp_genesis 458 * @return null|string The output, if echo is set to false.
mp-wp_genesis 459 */
mp-wp_genesis 460 function wp_list_authors($args = '') {
mp-wp_genesis 461 global $wpdb;
mp-wp_genesis 462
mp-wp_genesis 463 $defaults = array(
mp-wp_genesis 464 'optioncount' => false, 'exclude_admin' => true,
mp-wp_genesis 465 'show_fullname' => false, 'hide_empty' => true,
mp-wp_genesis 466 'feed' => '', 'feed_image' => '', 'feed_type' => '', 'echo' => true
mp-wp_genesis 467 );
mp-wp_genesis 468
mp-wp_genesis 469 $r = wp_parse_args( $args, $defaults );
mp-wp_genesis 470 extract($r, EXTR_SKIP);
mp-wp_genesis 471
mp-wp_genesis 472 $return = '';
mp-wp_genesis 473
mp-wp_genesis 474 /** @todo Move select to get_authors(). */
mp-wp_genesis 475 $authors = $wpdb->get_results("SELECT ID, user_nicename from $wpdb->users " . ($exclude_admin ? "WHERE user_login <> 'admin' " : '') . "ORDER BY display_name");
mp-wp_genesis 476
mp-wp_genesis 477 $author_count = array();
mp-wp_genesis 478 foreach ((array) $wpdb->get_results("SELECT DISTINCT post_author, COUNT(ID) AS count FROM $wpdb->posts WHERE post_type = 'post' AND " . get_private_posts_cap_sql( 'post' ) . " GROUP BY post_author") as $row) {
mp-wp_genesis 479 $author_count[$row->post_author] = $row->count;
mp-wp_genesis 480 }
mp-wp_genesis 481
mp-wp_genesis 482 foreach ( (array) $authors as $author ) {
mp-wp_genesis 483 $author = get_userdata( $author->ID );
mp-wp_genesis 484 $posts = (isset($author_count[$author->ID])) ? $author_count[$author->ID] : 0;
mp-wp_genesis 485 $name = $author->display_name;
mp-wp_genesis 486
mp-wp_genesis 487 if ( $show_fullname && ($author->first_name != '' && $author->last_name != '') )
mp-wp_genesis 488 $name = "$author->first_name $author->last_name";
mp-wp_genesis 489
mp-wp_genesis 490 if ( !($posts == 0 && $hide_empty) )
mp-wp_genesis 491 $return .= '<li>';
mp-wp_genesis 492 if ( $posts == 0 ) {
mp-wp_genesis 493 if ( !$hide_empty )
mp-wp_genesis 494 $link = $name;
mp-wp_genesis 495 } else {
mp-wp_genesis 496 $link = '<a href="' . get_author_posts_url($author->ID, $author->user_nicename) . '" title="' . sprintf(__("Posts by %s"), attribute_escape($author->display_name)) . '">' . $name . '</a>';
mp-wp_genesis 497
mp-wp_genesis 498 if ( (! empty($feed_image)) || (! empty($feed)) ) {
mp-wp_genesis 499 $link .= ' ';
mp-wp_genesis 500 if (empty($feed_image))
mp-wp_genesis 501 $link .= '(';
mp-wp_genesis 502 $link .= '<a href="' . get_author_feed_link($author->ID) . '"';
mp-wp_genesis 503
mp-wp_genesis 504 if ( !empty($feed) ) {
mp-wp_genesis 505 $title = ' title="' . $feed . '"';
mp-wp_genesis 506 $alt = ' alt="' . $feed . '"';
mp-wp_genesis 507 $name = $feed;
mp-wp_genesis 508 $link .= $title;
mp-wp_genesis 509 }
mp-wp_genesis 510
mp-wp_genesis 511 $link .= '>';
mp-wp_genesis 512
mp-wp_genesis 513 if ( !empty($feed_image) )
mp-wp_genesis 514 $link .= "<img src=\"$feed_image\" style=\"border: none;\"$alt$title" . ' />';
mp-wp_genesis 515 else
mp-wp_genesis 516 $link .= $name;
mp-wp_genesis 517
mp-wp_genesis 518 $link .= '</a>';
mp-wp_genesis 519
mp-wp_genesis 520 if ( empty($feed_image) )
mp-wp_genesis 521 $link .= ')';
mp-wp_genesis 522 }
mp-wp_genesis 523
mp-wp_genesis 524 if ( $optioncount )
mp-wp_genesis 525 $link .= ' ('. $posts . ')';
mp-wp_genesis 526
mp-wp_genesis 527 }
mp-wp_genesis 528
mp-wp_genesis 529 if ( !($posts == 0 && $hide_empty) )
mp-wp_genesis 530 $return .= $link . '</li>';
mp-wp_genesis 531 }
mp-wp_genesis 532 if ( !$echo )
mp-wp_genesis 533 return $return;
mp-wp_genesis 534 echo $return;
mp-wp_genesis 535 }
mp-wp_genesis 536
mp-wp_genesis 537 ?>