Ticket #1659: bug1659.diff
| File bug1659.diff, 1.2 KB (added by graeme, 7 years ago) |
|---|
-
wp-includes/template-functions-author.php
179 179 $query = "SELECT ID, user_nicename from $wpdb->users " . ($exclude_admin ? "WHERE user_login <> 'admin' " : '') . "ORDER BY display_name"; 180 180 $authors = $wpdb->get_results($query); 181 181 182 $query = "SELECT DISTINCT post_author AS author, 183 COUNT(ID) AS count 184 FROM $wpdb->posts 185 WHERE post_status = 'publish' 186 AND post_date_gmt <'".current_time('mysql','1')."' 187 GROUP BY post_author"; 188 $author_count = array(); 189 foreach ( $wpdb->get_results($query, ARRAY_A) as $row ) { 190 $author_count["{$row['author']}"] = $row['count']; 191 } 192 182 193 foreach ( $authors as $author ) { 183 194 $author = get_userdata( $author->ID ); 184 $posts = get_usernumposts($author->ID);195 $posts = isset($author_count["{$author->ID}"]) ? $author_count["{$author->ID}"] : "0"; 185 196 $name = $author->nickname; 186 197 187 198 if ( $show_fullname && ($author->first_name != '' && $author->last_name != '') ) … … 231 242 } 232 243 } 233 244 234 ?> 235 No newline at end of file 245 ?>
