Ticket #14058: 3.0.1-export.diff
| File 3.0.1-export.diff, 2.6 KB (added by , 16 years ago) |
|---|
-
wp-admin/export.php
99 99 <select name="author" id="author"> 100 100 <option value="all" selected="selected"><?php _e('All Authors'); ?></option> 101 101 <?php 102 $authors = $wpdb->get_results( "SELECT DISTINCT u.id, u.display_name FROM $wpdb->users u INNER JOIN $wpdb->posts p WHERE u.id = p.post_author ORDER BY u.display_name" ); 103 foreach ( (array) $authors as $author ) { 104 echo "<option value='{$author->id}'>{$author->display_name}</option>\n"; 102 $authors = $wpdb->get_col( "SELECT post_author FROM $wpdb->posts GROUP BY post_author" ); 103 foreach ( $authors as $id ) { 104 $o = get_userdata( $id ); 105 echo "<option value='" . esc_attr($o->ID) . "'>$o->display_name</option>"; 105 106 } 106 107 ?> 107 108 </select> … … 146 147 147 148 148 149 include ('admin-footer.php'); 149 ?> 150 ?> 151 No newline at end of file -
wp-admin/includes/export.php
62 62 $where .= $wpdb->prepare( "AND post_date < %s ", $end_date ); 63 63 64 64 if ( $taxonomy && is_array( $taxonomy ) ) { 65 foreach ( $taxonomy as $term_id ) { 66 if ( $term_id != 'all' ) 67 $where .= $wpdb->prepare( "AND ID IN (SELECT object_id FROM $wpdb->term_relationships WHERE term_taxonomy_id = %d) ", $term_id ); 65 $post_ids_from_taxonomies = array(); 66 foreach ( $taxonomy as $tax => $term_id ) { 67 if ( $term_id != 'all' ) 68 $post_ids_from_taxonomies = array_merge( $post_ids_from_taxonomies, get_objects_in_term( $term_id, $tax ) ); 68 69 } 69 70 } 70 71 71 if ( $post_status && $post_status != 'all' ) 72 72 $where .= $wpdb->prepare( "AND post_status = %s", $status ); 73 73 74 74 // grab a snapshot of post IDs, just in case it changes during the export 75 75 $post_ids = $wpdb->get_col( "SELECT ID FROM $wpdb->posts $where ORDER BY post_date_gmt ASC" ); 76 76 if ( !empty( $post_ids_from_taxonomies ) ) 77 $post_ids = array_intersect( $post_ids_from_taxonomies, $post_ids ); 78 77 79 $categories = (array) get_categories( array( 'get' => 'all' ) ); 78 80 $tags = (array) get_tags( array( 'get' => 'all' ) ); 79 81 … … 330 332 while ( $next_posts = array_splice( $post_ids, 0, 20 ) ) { 331 333 $where = "WHERE ID IN (" . join( ',', $next_posts ) . ")"; 332 334 $posts = $wpdb->get_results( "SELECT * FROM $wpdb->posts $where ORDER BY post_date_gmt ASC" ); 333 335 334 336 // Begin Loop 335 337 foreach ($posts as $post) { 336 338 setup_postdata( $post ); … … 406 408 <?php 407 409 } 408 410 409 ?> 411 ?> 412 No newline at end of file