Ticket #16045: 16045.diff

File 16045.diff, 1.6 KB (added by markjaquith, 2 years ago)
Line 
1Index: wp-includes/user.php
2===================================================================
3--- wp-includes/user.php        (revision 17188)
4+++ wp-includes/user.php        (working copy)
5@@ -422,7 +422,7 @@
6                }
7 
8                $this->query_from = "FROM $wpdb->users";
9-               $this->query_where = "WHERE 1=1";
10+               $this->query_where = "1=1"; // Prepend WHERE later
11 
12                // sorting
13                if ( in_array( $qv['orderby'], array('nicename', 'email', 'url', 'registered') ) ) {
14@@ -515,12 +515,14 @@
15 
16                if ( !empty( $qv['include'] ) ) {
17                        $ids = implode( ',', wp_parse_id_list( $qv['include'] ) );
18-                       $this->query_where .= " AND $wpdb->users.ID IN ($ids)";
19+                       $this->query_where = ' ( ' . $this->query_where . " ) OR $wpdb->users.ID IN ($ids)";
20                } elseif ( !empty($qv['exclude']) ) {
21                        $ids = implode( ',', wp_parse_id_list( $qv['exclude'] ) );
22                        $this->query_where .= " AND $wpdb->users.ID NOT IN ($ids)";
23                }
24 
25+               $this->query_where = 'WHERE ' . $this->query_where;
26+
27                do_action_ref_array( 'pre_user_query', array( &$this ) );
28        }
29 
30Index: wp-admin/includes/meta-boxes.php
31===================================================================
32--- wp-admin/includes/meta-boxes.php    (revision 17188)
33+++ wp-admin/includes/meta-boxes.php    (working copy)
34@@ -527,10 +527,12 @@
35 ?>
36 <label class="screen-reader-text" for="post_author_override"><?php _e('Author'); ?></label>
37 <?php
38+       $current_author = empty($post->ID) ? $user_ID : $post->post_author;
39        wp_dropdown_users( array(
40                'who' => 'authors',
41                'name' => 'post_author_override',
42-               'selected' => empty($post->ID) ? $user_ID : $post->post_author
43+               'selected' => $current_author,
44+               'include' => $current_author
45        ) );
46 }
47