diff --git a/wp-admin/includes/class-wp-posts-list-table.php b/wp-admin/includes/class-wp-posts-list-table.php
index 3782ba61b1..ca59392b6a 100644
--- a/wp-admin/includes/class-wp-posts-list-table.php
+++ b/wp-admin/includes/class-wp-posts-list-table.php
@@ -757,7 +757,6 @@ class WP_Posts_List_Table extends WP_List_Table {
-
post_type, 'author' ) ) :
@@ -765,6 +764,8 @@ class WP_Posts_List_Table extends WP_List_Table {
if ( is_super_admin() || current_user_can( $post_type_object->cap->edit_others_posts ) ) :
$users_opt = array(
+ 'hide_if_only_one_author' => true,
+ 'who' => 'authors',
'name' => 'post_author',
'class'=> 'authors',
'multi' => 1,
@@ -772,10 +773,13 @@ class WP_Posts_List_Table extends WP_List_Table {
);
if ( $bulk )
$users_opt['show_option_none'] = __( '— No Change —' );
- $authors_dropdown = '';
+
+ if ( $authors = wp_dropdown_users( $users_opt ) ) :
+ $authors_dropdown = '';
+ endif;
endif; // authors
?>
diff --git a/wp-admin/includes/meta-boxes.php b/wp-admin/includes/meta-boxes.php
index 96466b5743..f7fcc9604b 100644
--- a/wp-admin/includes/meta-boxes.php
+++ b/wp-admin/includes/meta-boxes.php
@@ -530,11 +530,11 @@ function post_slug_meta_box($post) {
*/
function post_author_meta_box($post) {
global $user_ID;
-
?>
'authors',
'name' => 'post_author_override',
'selected' => empty($post->ID) ? $user_ID : $post->post_author
) );
diff --git a/wp-includes/meta.php b/wp-includes/meta.php
index ca243da11a..cfbaf20d71 100644
--- a/wp-includes/meta.php
+++ b/wp-includes/meta.php
@@ -433,6 +433,11 @@ function get_meta_sql( $meta_query, $meta_type, $primary_table, $primary_id_colu
} else {
$meta_compare_string = '%s';
}
+
+ // @todo Temporary hack to support empty values. Do not use outside of core.
+ if ( '_wp_zero_value' == $meta_value )
+ $meta_value = 0;
+
$where .= $wpdb->prepare( " AND CAST($alias.meta_value AS {$meta_type}) {$meta_compare} {$meta_compare_string}", $meta_value );
}
diff --git a/wp-includes/user.php b/wp-includes/user.php
index aab7a51a81..4d7ea4a2cb 100644
--- a/wp-includes/user.php
+++ b/wp-includes/user.php
@@ -481,10 +481,18 @@ class WP_User_Query {
$this->query_where .= $this->get_search_sql( $search, $search_columns, $wild );
}
+ $blog_id = absint( $qv['blog_id'] );
+
+ if ( 'authors' == $qv['who'] && $blog_id ) {
+ $qv['meta_key'] = $wpdb->get_blog_prefix( $blog_id ) . 'user_level';
+ $qv['meta_value'] = '_wp_zero_value'; // Hack to pass '0'
+ $qv['meta_compare'] = '!=';
+ $qv['blog_id'] = $blog_id = 0; // Prevent extra meta query
+ }
+
_parse_meta_query( $qv );
$role = trim( $qv['role'] );
- $blog_id = absint( $qv['blog_id'] );
if ( $blog_id && ( $role || is_multisite() ) ) {
$cap_meta_query = array();
@@ -929,6 +937,7 @@ function setup_userdata($for_user_id = '') {
*