Changeset 5135 for trunk/wp-includes/author-template.php
- Timestamp:
- 03/29/2007 01:39:05 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/author-template.php
r5087 r5135 174 174 175 175 function wp_list_authors($args = '') { 176 global $wpdb; 177 176 178 if ( is_array($args) ) 177 179 $r = &$args; … … 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
Note: See TracChangeset
for help on using the changeset viewer.