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
This commit is contained in:
parent
9fdf778067
commit
b7838c5f34
|
@ -284,13 +284,16 @@ function wp_list_authors($args = '') {
|
||||||
|
|
||||||
$return = '';
|
$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();
|
$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 )
|
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;
|
$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 )
|
if ( $exclude_admin && 'admin' == $author->display_name )
|
||||||
continue;
|
continue;
|
||||||
|
|
Loading…
Reference in New Issue