From 3edb82141aea1885a0a5f0ffa32fab908435257b Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Mon, 5 Dec 2005 04:04:23 +0000 Subject: [PATCH] Add edit_pages checks. git-svn-id: https://develop.svn.wordpress.org/trunk@3269 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/admin-functions.php | 6 ++++++ wp-includes/capabilities.php | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/wp-admin/admin-functions.php b/wp-admin/admin-functions.php index 11dd66da7d..a3a95526d4 100644 --- a/wp-admin/admin-functions.php +++ b/wp-admin/admin-functions.php @@ -40,6 +40,9 @@ function write_post() { if ('publish' == $_POST['post_status'] && !current_user_can('publish_posts')) $_POST['post_status'] = 'draft'; + if ('static' == $_POST['post_status'] && !current_user_can('edit_pages')) + die(__('This user cannot edit pages.')); + if (!empty ($_POST['edit_date'])) { $aa = $_POST['aa']; $mm = $_POST['mm']; @@ -158,6 +161,9 @@ function edit_post() { if ('publish' == $_POST['post_status'] && !current_user_can('publish_posts')) $_POST['post_status'] = 'draft'; + if ('static' == $_POST['post_status'] && !current_user_can('edit_pages')) + die(__('This user cannot edit pages.')); + if (!isset ($_POST['comment_status'])) $_POST['comment_status'] = 'closed'; diff --git a/wp-includes/capabilities.php b/wp-includes/capabilities.php index b4dfc0bd08..2782df1416 100644 --- a/wp-includes/capabilities.php +++ b/wp-includes/capabilities.php @@ -249,10 +249,17 @@ function map_meta_cap($cap, $user_id) { // If the post is published... if ($post->post_status == 'publish') $caps[] = 'edit_published_posts'; + else if ($post->post_status == 'static') + $caps[] = 'edit_pages'; else // If the post is draft... $caps[] = 'edit_posts'; } else { + if ($post->post_status == 'static') { + $caps[] = 'edit_pages'; + break; + } + // The user is trying to edit someone else's post. $caps[] = 'edit_others_posts'; // The post is published, extra cap required.