summaryrefslogtreecommitdiffstats
path: root/wp-includes/author-template.php
diff options
context:
space:
mode:
authordonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2008-04-04 16:47:41 +0000
committerdonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2008-04-04 16:47:41 +0000
commit5549ea980144ba198286402a5e584946b9489b55 (patch)
tree57bde38d46be7ef374f2b612fd4c77da692cfdc9 /wp-includes/author-template.php
parent7740e89de3e1bc0cc636120e3ca8ab9e97e4d3cc (diff)
downloadwordpress-mu-5549ea980144ba198286402a5e584946b9489b55.tar.gz
wordpress-mu-5549ea980144ba198286402a5e584946b9489b55.tar.xz
wordpress-mu-5549ea980144ba198286402a5e584946b9489b55.zip
Don't query all the users
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@1219 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-includes/author-template.php')
-rw-r--r--wp-includes/author-template.php13
1 files changed, 11 insertions, 2 deletions
diff --git a/wp-includes/author-template.php b/wp-includes/author-template.php
index 795258d..adee80c 100644
--- a/wp-includes/author-template.php
+++ b/wp-includes/author-template.php
@@ -445,9 +445,18 @@ function wp_list_authors($args = '') {
$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");
+ $users = get_users_of_blog();
+ $author_ids = array();
+ foreach ( (array) $users as $user ) {
+ $author_ids[] = $user->user_id;
+ }
+ if ( count($author_ids) > 0 ) {
+ $author_ids=implode(',', $author_ids );
+ $authors = $wpdb->get_results( "SELECT ID, user_nicename from $wpdb->users WHERE ID IN($author_ids) " . ($exclude_admin ? "AND user_login <> 'admin' " : '') . "ORDER BY display_name" );
+ } else {
+ $authors = 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) {
$author_count[$row->post_author] = $row->count;
}