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:
parent
66a9d58336
commit
3ca17b00ac
|
@ -87,11 +87,9 @@ for ( $i = 1; $i < 13; $i++ ) {
|
||||||
<select name="author" id="author">
|
<select name="author" id="author">
|
||||||
<option value="all" selected="selected"><?php _e('All Authors'); ?></option>
|
<option value="all" selected="selected"><?php _e('All Authors'); ?></option>
|
||||||
<?php
|
<?php
|
||||||
$authors = $wpdb->get_col( "SELECT post_author FROM $wpdb->posts GROUP BY post_author" );
|
$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 ( $authors as $id ) {
|
foreach ( (array) $authors as $author )
|
||||||
$o = get_userdata( $id );
|
echo "<option value='{$author->id}'>{$author->display_name}</option>\n";
|
||||||
echo "<option value='{$o->ID}'>{$o->display_name}</option>\n";
|
|
||||||
}
|
|
||||||
?>
|
?>
|
||||||
</select>
|
</select>
|
||||||
</td>
|
</td>
|
||||||
|
|
Loading…
Reference in New Issue