From b7838c5f344d56b817f3bc51aa2413bc2f5493e5 Mon Sep 17 00:00:00 2001 From: ryan Date: Tue, 21 Dec 2010 16:27:34 +0000 Subject: [PATCH] Retrieve only IDs and then do a user fetch loop so that all required user data is present. Props scribu. fixes #15888 git-svn-id: http://svn.automattic.com/wordpress/trunk@17100 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/author-template.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/wp-includes/author-template.php b/wp-includes/author-template.php index 5ceb5d31f..641b69d46 100644 --- a/wp-includes/author-template.php +++ b/wp-includes/author-template.php @@ -284,13 +284,16 @@ function wp_list_authors($args = '') { $return = ''; - $authors = get_users( wp_array_slice_assoc( $args, array( 'orderby', 'order', 'number' ) ) ); + $query_args = wp_array_slice_assoc( $args, array( 'orderby', 'order', 'number' ) ); + $query_args['fields'] = 'ids'; + $authors = get_users( $query_args ); $author_count = array(); 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 ) $author_count[$row->post_author] = $row->count; - foreach ( $authors as $author ) { + foreach ( $authors as $author_id ) { + $author = get_userdata( $author_id ); if ( $exclude_admin && 'admin' == $author->display_name ) continue;