diff options
| author | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2007-05-21 18:37:58 +0000 |
|---|---|---|
| committer | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2007-05-21 18:37:58 +0000 |
| commit | 89fe0ff804e7c6497ebacc8b341ac89974f6f255 (patch) | |
| tree | 3fce310b29c685008fdbb75c5ab531bc3a6ae12a /wp-includes/author-template.php | |
| parent | a139071806ba941346a109fbefb2d5f22bae1cc4 (diff) | |
| download | wordpress-mu-89fe0ff804e7c6497ebacc8b341ac89974f6f255.tar.gz wordpress-mu-89fe0ff804e7c6497ebacc8b341ac89974f6f255.tar.xz wordpress-mu-89fe0ff804e7c6497ebacc8b341ac89974f6f255.zip | |
WP Merge to rev 5499, this is a big one! Test it before you put it live!
Test only, not for production use yet
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@972 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-includes/author-template.php')
| -rw-r--r-- | wp-includes/author-template.php | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/wp-includes/author-template.php b/wp-includes/author-template.php index aa4013d..6006cf3 100644 --- a/wp-includes/author-template.php +++ b/wp-includes/author-template.php @@ -173,24 +173,28 @@ function get_author_name( $auth_id ) { } function wp_list_authors($args = '') { - if ( is_array($args) ) - $r = &$args; - else - parse_str($args, $r); - - $defaults = array('optioncount' => false, 'exclude_admin' => true, 'show_fullname' => false, 'hide_empty' => true, - 'feed' => '', 'feed_image' => ''); - $r = array_merge($defaults, $r); - extract($r); - global $wpdb; + + $defaults = array( + 'optioncount' => false, 'exclude_admin' => true, + 'show_fullname' => false, 'hide_empty' => true, + 'feed' => '', 'feed_image' => '' + ); + + $r = wp_parse_args( $args, $defaults ); + extract($r); + // TODO: Move select to get_authors(). - $query = "SELECT ID, user_nicename from $wpdb->users " . ($exclude_admin ? "WHERE user_login <> 'admin' " : '') . "ORDER BY display_name"; - $authors = $wpdb->get_results($query); + $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; + } foreach ( (array) $authors as $author ) { $author = get_userdata( $author->ID ); - $posts = get_usernumposts($author->ID); + $posts = (isset($author_count[$author->ID])) ? $author_count[$author->ID] : 0; $name = $author->nickname; if ( $show_fullname && ($author->first_name != '' && $author->last_name != '') ) |
