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: https://develop.svn.wordpress.org/trunk@17100 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2010-12-21 16:27:34 +00:00
parent d3729a2484
commit 661e41e55b

View File

@ -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;