Optimize the Authors drop-down in export.php. Makes it one query, also orders authors by display name. see #10317.

git-svn-id: http://svn.automattic.com/wordpress/trunk@14153 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
nacin 2010-04-18 14:51:55 +00:00
parent 66a9d58336
commit 3ca17b00ac
1 changed files with 3 additions and 5 deletions

View File

@ -87,11 +87,9 @@ for ( $i = 1; $i < 13; $i++ ) {
<select name="author" id="author">
<option value="all" selected="selected"><?php _e('All Authors'); ?></option>
<?php
$authors = $wpdb->get_col( "SELECT post_author FROM $wpdb->posts GROUP BY post_author" );
foreach ( $authors as $id ) {
$o = get_userdata( $id );
echo "<option value='{$o->ID}'>{$o->display_name}</option>\n";
}
$authors = $wpdb->get_results( "SELECT DISTINCT u.id, u.display_name FROM $wpdb->users u INNER JOIN $wpdb->posts p ON u.id = p.post_author ORDER BY u.display_name" );
foreach ( (array) $authors as $author )
echo "<option value='{$author->id}'>{$author->display_name}</option>\n";
?>
</select>
</td>