diff --git a/wp-admin/edit-page-form.php b/wp-admin/edit-page-form.php index 81145f5f32..3ba05c4e94 100644 --- a/wp-admin/edit-page-form.php +++ b/wp-admin/edit-page-form.php @@ -356,7 +356,7 @@ function page_slug_meta_box($post){ } add_meta_box('pageslugdiv', __('Page Slug'), 'page_slug_meta_box', 'page', 'normal', 'core'); -$authors = get_editable_user_ids( $current_user->id ); // TODO: ROLE SYSTEM +$authors = get_editable_user_ids( $current_user->id, true, 'page' ); // TODO: ROLE SYSTEM if ( $post->post_author && !in_array($post->post_author, $authors) ) $authors[] = $post->post_author; if ( $authors && count( $authors ) > 1 ) { @@ -369,7 +369,7 @@ if ( $authors && count( $authors ) > 1 ) { */ function page_author_meta_box($post){ global $current_user, $user_ID; - $authors = get_editable_user_ids( $current_user->id ); // TODO: ROLE SYSTEM + $authors = get_editable_user_ids( $current_user->id, true, 'page' ); // TODO: ROLE SYSTEM if ( $post->post_author && !in_array($post->post_author, $authors) ) $authors[] = $post->post_author; ?> diff --git a/wp-admin/includes/user.php b/wp-admin/includes/user.php index c7b6f6b173..6a89cb9806 100644 --- a/wp-admin/includes/user.php +++ b/wp-admin/includes/user.php @@ -220,13 +220,13 @@ function get_editable_authors( $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 ) { +function get_editable_user_ids( $user_id, $exclude_zeros = true, $post_type = 'post' ) { global $wpdb; $user = new WP_User( $user_id ); - if ( ! $user->has_cap('edit_others_posts') ) { - if ( $user->has_cap('edit_posts') || $exclude_zeros == false ) + if ( ! $user->has_cap("edit_others_{$post_type}s") ) { + if ( $user->has_cap("edit_{$post_type}s") || $exclude_zeros == false ) return array($user->id); else return false;