Ticket #1659: 1659.2.diff
File 1659.2.diff, 1.4 KB (added by , 17 years ago) |
---|
-
wp-includes/author-template.php
173 173 } 174 174 175 175 function wp_list_authors($args = '') { 176 global $wpdb; 177 176 178 if ( is_array($args) ) 177 179 $r = &$args; 178 180 else … … 182 184 'feed' => '', 'feed_image' => ''); 183 185 $r = array_merge($defaults, $r); 184 186 extract($r); 185 186 global $wpdb; 187 187 188 // TODO: Move select to get_authors(). 188 $query = "SELECT ID, user_nicename from $wpdb->users " . ($exclude_admin ? "WHERE user_login <> 'admin' " : '') . "ORDER BY display_name"; 189 $authors = $wpdb->get_results($query); 189 $authors = $wpdb->get_results("SELECT ID, user_nicename from $wpdb->users " . ($exclude_admin ? "WHERE user_login <> 'admin' " : '') . "ORDER BY display_name"); 190 191 $author_count = array(); 192 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) { 193 $author_count[$row->post_author] = $row->count; 194 } 190 195 191 196 foreach ( (array) $authors as $author ) { 192 197 $author = get_userdata( $author->ID ); 193 $posts = get_usernumposts($author->ID);198 $posts = (isset($author_count[$author->ID])) ? $author_count[$author->ID] : 0; 194 199 $name = $author->nickname; 195 200 196 201 if ( $show_fullname && ($author->first_name != '' && $author->last_name != '') )