Ticket #4323: wp_list_authors.diff
File wp_list_authors.diff, 1.4 KB (added by , 16 years ago) |
---|
-
wp-includes/author-template.php
178 178 $defaults = array( 179 179 'optioncount' => false, 'exclude_admin' => true, 180 180 'show_fullname' => false, 'hide_empty' => true, 181 'feed' => '', 'feed_image' => '' 181 'feed' => '', 'feed_image' => '', 'echo' => true 182 182 ); 183 183 184 184 $r = wp_parse_args( $args, $defaults ); 185 185 extract($r); 186 186 187 $return = ''; 188 187 189 // TODO: Move select to get_authors(). 188 190 $authors = $wpdb->get_results("SELECT ID, user_nicename from $wpdb->users " . ($exclude_admin ? "WHERE user_login <> 'admin' " : '') . "ORDER BY display_name"); 189 191 190 192 $author_count = array(); 191 193 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) { 192 194 $author_count[$row->post_author] = $row->count; … … 201 203 $name = "$author->first_name $author->last_name"; 202 204 203 205 if ( !($posts == 0 && $hide_empty) ) 204 echo "<li>";206 $return .= '<li>'; 205 207 if ( $posts == 0 ) { 206 208 if ( !$hide_empty ) 207 209 $link = $name; … … 240 242 } 241 243 242 244 if ( !($posts == 0 && $hide_empty) ) 243 echo "$link</li>";245 $return .= $link . '</li>'; 244 246 } 247 if ( !$echo ) 248 return $return; 249 echo $return; 245 250 } 246 251 247 252 ?> 253 No newline at end of file