From 06e670d043945fdd3bea0d16c5949890b2dc90a2 Mon Sep 17 00:00:00 2001 From: markjaquith Date: Fri, 1 Jun 2007 05:43:24 +0000 Subject: [PATCH] Allow wp_list_authors() to optionally return. fixes #4323. see #3567. git-svn-id: http://svn.automattic.com/wordpress/trunk@5624 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/author-template.php | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/wp-includes/author-template.php b/wp-includes/author-template.php index 2561eb5ef..fc0099c5e 100644 --- a/wp-includes/author-template.php +++ b/wp-includes/author-template.php @@ -178,15 +178,17 @@ function wp_list_authors($args = '') { $defaults = array( 'optioncount' => false, 'exclude_admin' => true, 'show_fullname' => false, 'hide_empty' => true, - 'feed' => '', 'feed_image' => '' + 'feed' => '', 'feed_image' => '', 'echo' => true ); - + $r = wp_parse_args( $args, $defaults ); extract($r); - + + $return = ''; + // TODO: Move select to get_authors(). $authors = $wpdb->get_results("SELECT ID, user_nicename from $wpdb->users " . ($exclude_admin ? "WHERE user_login <> 'admin' " : '') . "ORDER BY display_name"); - + $author_count = array(); foreach ((array) $wpdb->get_results("SELECT DISTINCT post_author, COUNT(ID) AS count FROM $wpdb->posts WHERE post_status = 'publish' GROUP BY post_author") as $row) { $author_count[$row->post_author] = $row->count; @@ -201,7 +203,7 @@ function wp_list_authors($args = '') { $name = "$author->first_name $author->last_name"; if ( !($posts == 0 && $hide_empty) ) - echo "
  • "; + $return .= '
  • '; if ( $posts == 0 ) { if ( !$hide_empty ) $link = $name; @@ -240,8 +242,11 @@ function wp_list_authors($args = '') { } if ( !($posts == 0 && $hide_empty) ) - echo "$link
  • "; + $return .= $link . ''; } + if ( !$echo ) + return $return; + echo $return; } ?> \ No newline at end of file