diff --git a/wp-admin/edit-form-advanced.php b/wp-admin/edit-form-advanced.php
index 69a1aaee59..aa0dcfc8a0 100644
--- a/wp-admin/edit-form-advanced.php
+++ b/wp-admin/edit-form-advanced.php
@@ -149,11 +149,7 @@ if ( !( 'pending' == $post->post_status && !current_user_can( $post_type_object-
add_meta_box('slugdiv', __('Slug'), 'post_slug_meta_box', $post_type, 'normal', 'core');
if ( post_type_supports($post_type, 'author') ) {
- $_editable_user_ids = get_editable_user_ids( $current_user->id, true, $post_type ); // TODO: ROLE SYSTEM
- if ( $post->post_author && !in_array($post->post_author, $_editable_user_ids) )
- $_editable_user_ids[] = $post->post_author;
-
- if ( !empty($_editable_user_ids) || is_super_admin() )
+ if ( is_super_admin() || current_user_can( $post_type_object->cap->edit_others_posts ) )
add_meta_box('authordiv', __('Author'), 'post_author_meta_box', $post_type, 'normal', 'core');
}
diff --git a/wp-admin/includes/default-list-tables.php b/wp-admin/includes/default-list-tables.php
index ec0735d128..6fa228eded 100644
--- a/wp-admin/includes/default-list-tables.php
+++ b/wp-admin/includes/default-list-tables.php
@@ -668,17 +668,21 @@ class WP_Posts_Table extends WP_List_Table {
post_type, 'author' ) ) :
- $authors = get_editable_user_ids( get_current_user_id(), true, $screen->post_type ); // TODO: ROLE SYSTEM
$authors_dropdown = '';
- if ( $authors && count( $authors ) > 1 ) :
- $users_opt = array( 'include' => $authors, 'name' => 'post_author', 'class'=> 'authors', 'multi' => 1, 'echo' => 0 );
+
+ if ( is_super_admin() || current_user_can( $post_type_object->cap->edit_others_posts ) ) :
+ $users_opt = array(
+ 'name' => 'post_author',
+ 'class'=> 'authors',
+ 'multi' => 1,
+ 'echo' => 0
+ );
if ( $bulk )
$users_opt['show_option_none'] = __( '— No Change —' );
$authors_dropdown = '';
-
endif; // authors
?>
diff --git a/wp-admin/includes/deprecated.php b/wp-admin/includes/deprecated.php
index b22b423b96..9597c30f83 100644
--- a/wp-admin/includes/deprecated.php
+++ b/wp-admin/includes/deprecated.php
@@ -238,6 +238,117 @@ function get_editable_authors( $user_id ) {
return apply_filters('get_editable_authors', $authors);
}
+/**
+ * @deprecated 3.1.0
+ *
+ * @param int $user_id User ID.
+ * @param bool $exclude_zeros Optional, default is true. Whether to exclude zeros.
+ * @return unknown
+ */
+function get_editable_user_ids( $user_id, $exclude_zeros = true, $post_type = 'post' ) {
+ _deprecated_function( __FUNCTION__, '3.1' );
+
+ global $wpdb;
+
+ $user = new WP_User( $user_id );
+ $post_type_obj = get_post_type_object($post_type);
+
+ if ( ! $user->has_cap($post_type_obj->cap->edit_others_posts) ) {
+ if ( $user->has_cap($post_type_obj->cap->edit_posts) || ! $exclude_zeros )
+ return array($user->id);
+ else
+ return array();
+ }
+
+ if ( !is_multisite() )
+ $level_key = $wpdb->get_blog_prefix() . 'user_level';
+ else
+ $level_key = $wpdb->get_blog_prefix() . 'capabilities'; // wpmu site admins don't have user_levels
+
+ $query = $wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = %s", $level_key);
+ if ( $exclude_zeros )
+ $query .= " AND meta_value != '0'";
+
+ return $wpdb->get_col( $query );
+}
+
+/**
+ * @deprecated 3.1.0
+ */
+function get_nonauthor_user_ids() {
+ _deprecated_function( __FUNCTION__, '3.1' );
+
+ global $wpdb;
+
+ if ( !is_multisite() )
+ $level_key = $wpdb->get_blog_prefix() . 'user_level';
+ else
+ $level_key = $wpdb->get_blog_prefix() . 'capabilities'; // wpmu site admins don't have user_levels
+
+ return $wpdb->get_col( $wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = %s AND meta_value = '0'", $level_key) );
+}
+
+/**
+ * Retrieve editable posts from other users.
+ *
+ * @deprecated 3.1.0
+ *
+ * @param int $user_id User ID to not retrieve posts from.
+ * @param string $type Optional, defaults to 'any'. Post type to retrieve, can be 'draft' or 'pending'.
+ * @return array List of posts from others.
+ */
+function get_others_unpublished_posts($user_id, $type='any') {
+ _deprecated_function( __FUNCTION__, '3.1' );
+
+ global $wpdb;
+
+ $editable = get_editable_user_ids( $user_id );
+
+ if ( in_array($type, array('draft', 'pending')) )
+ $type_sql = " post_status = '$type' ";
+ else
+ $type_sql = " ( post_status = 'draft' OR post_status = 'pending' ) ";
+
+ $dir = ( 'pending' == $type ) ? 'ASC' : 'DESC';
+
+ if ( !$editable ) {
+ $other_unpubs = '';
+ } else {
+ $editable = join(',', $editable);
+ $other_unpubs = $wpdb->get_results( $wpdb->prepare("SELECT ID, post_title, post_author FROM $wpdb->posts WHERE post_type = 'post' AND $type_sql AND post_author IN ($editable) AND post_author != %d ORDER BY post_modified $dir", $user_id) );
+ }
+
+ return apply_filters('get_others_drafts', $other_unpubs);
+}
+
+/**
+ * Retrieve drafts from other users.
+ *
+ * @deprecated 3.1.0
+ *
+ * @param int $user_id User ID.
+ * @return array List of drafts from other users.
+ */
+function get_others_drafts($user_id) {
+ _deprecated_function( __FUNCTION__, '3.1' );
+
+ return get_others_unpublished_posts($user_id, 'draft');
+}
+
+/**
+ * Retrieve pending review posts from other users.
+ *
+ * @deprecated 3.1.0
+ *
+ * @param int $user_id User ID.
+ * @return array List of posts with pending review post type from other users.
+ */
+function get_others_pending($user_id) {
+ _deprecated_function( __FUNCTION__, '3.1' );
+
+ return get_others_unpublished_posts($user_id, 'pending');
+}
+
/**
* Register column headers for a particular screen.
*
diff --git a/wp-admin/includes/meta-boxes.php b/wp-admin/includes/meta-boxes.php
index abde84e198..43211d04c8 100644
--- a/wp-admin/includes/meta-boxes.php
+++ b/wp-admin/includes/meta-boxes.php
@@ -505,11 +505,15 @@ function post_slug_meta_box($post) {
* @param object $post
*/
function post_author_meta_box($post) {
- global $user_ID, $_editable_user_ids;
+ global $user_ID;
?>
- $_editable_user_ids, 'name' => 'post_author_override', 'selected' => empty($post->ID) ? $user_ID : $post->post_author) ); ?>
+
'post_author_override',
+ 'selected' => empty($post->ID) ? $user_ID : $post->post_author
+ ) );
}
diff --git a/wp-admin/includes/user.php b/wp-admin/includes/user.php
index 2b44069544..1530ead537 100644
--- a/wp-admin/includes/user.php
+++ b/wp-admin/includes/user.php
@@ -188,36 +188,6 @@ function edit_user( $user_id = 0 ) {
return $user_id;
}
-/**
- * {@internal Missing Short Description}}
- *
- * {@internal Missing Long Description}}
- *
- * @since unknown
- *
- * @param int $user_id User ID.
- * @param bool $deprecated Not used.
- * @return array
- */
-function get_editable_user_ids( $user_id, $deprecated = true, $post_type = 'post' ) {
- global $wpdb;
-
- if ( !$deprecated )
- _deprecated_argument( __FUNCTION__, '3.1.0' );
-
- $user = new WP_User( $user_id );
- $post_type_obj = get_post_type_object($post_type);
-
- if ( ! $user->has_cap($post_type_obj->cap->edit_others_posts) ) {
- if ( $user->has_cap($post_type_obj->cap->edit_posts) || ! $exclude_zeros )
- return array($user->id);
- else
- return array();
- }
-
- return get_users( array('fields' => 'ids') );
-}
-
/**
* Fetch a filtered list of user roles that the current user is
* allowed to edit.
@@ -243,81 +213,6 @@ function get_editable_roles() {
return $editable_roles;
}
-/**
- * {@internal Missing Short Description}}
- *
- * {@internal Missing Long Description}}
- *
- * @since unknown
- *
- * @return unknown
- */
-function get_nonauthor_user_ids() {
- global $wpdb;
-
- if ( !is_multisite() )
- $level_key = $wpdb->get_blog_prefix() . 'user_level';
- else
- $level_key = $wpdb->get_blog_prefix() . 'capabilities'; // wpmu site admins don't have user_levels
-
- return $wpdb->get_col( $wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = %s AND meta_value = '0'", $level_key) );
-}
-
-/**
- * Retrieve editable posts from other users.
- *
- * @since unknown
- *
- * @param int $user_id User ID to not retrieve posts from.
- * @param string $type Optional, defaults to 'any'. Post type to retrieve, can be 'draft' or 'pending'.
- * @return array List of posts from others.
- */
-function get_others_unpublished_posts($user_id, $type='any') {
- global $wpdb;
-
- $editable = get_editable_user_ids( $user_id );
-
- if ( in_array($type, array('draft', 'pending')) )
- $type_sql = " post_status = '$type' ";
- else
- $type_sql = " ( post_status = 'draft' OR post_status = 'pending' ) ";
-
- $dir = ( 'pending' == $type ) ? 'ASC' : 'DESC';
-
- if ( !$editable ) {
- $other_unpubs = '';
- } else {
- $editable = join(',', $editable);
- $other_unpubs = $wpdb->get_results( $wpdb->prepare("SELECT ID, post_title, post_author FROM $wpdb->posts WHERE post_type = 'post' AND $type_sql AND post_author IN ($editable) AND post_author != %d ORDER BY post_modified $dir", $user_id) );
- }
-
- return apply_filters('get_others_drafts', $other_unpubs);
-}
-
-/**
- * Retrieve drafts from other users.
- *
- * @since unknown
- *
- * @param int $user_id User ID.
- * @return array List of drafts from other users.
- */
-function get_others_drafts($user_id) {
- return get_others_unpublished_posts($user_id, 'draft');
-}
-
-/**
- * Retrieve pending review posts from other users.
- *
- * @since unknown
- *
- * @param int $user_id User ID.
- * @return array List of posts with pending review post type from other users.
- */
-function get_others_pending($user_id) {
- return get_others_unpublished_posts($user_id, 'pending');
-}
-
/**
* Retrieve user data and filter it.
*