WordPress.org

Make WordPress Core

Changeset 14153


Ignore:
Timestamp:
04/18/2010 02:51:55 PM (12 years ago)
Author:
nacin
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/export.php

    r14139 r14153  
    8888<option value="all" selected="selected"><?php _e('All Authors'); ?></option>
    8989<?php
    90 $authors = $wpdb->get_col( "SELECT post_author FROM $wpdb->posts GROUP BY post_author" );
    91 foreach ( $authors as $id ) {
    92     $o = get_userdata( $id );
    93     echo "<option value='{$o->ID}'>{$o->display_name}</option>\n";
    94 }
     90$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" );
     91foreach ( (array) $authors as $author )
     92       echo "<option value='{$author->id}'>{$author->display_name}</option>\n";
    9593?>
    9694</select>
Note: See TracChangeset for help on using the changeset viewer.