Add edit_pages checks.
git-svn-id: https://develop.svn.wordpress.org/trunk@3269 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
89fb46bcce
commit
3edb82141a
|
@ -40,6 +40,9 @@ function write_post() {
|
||||||
if ('publish' == $_POST['post_status'] && !current_user_can('publish_posts'))
|
if ('publish' == $_POST['post_status'] && !current_user_can('publish_posts'))
|
||||||
$_POST['post_status'] = 'draft';
|
$_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'])) {
|
if (!empty ($_POST['edit_date'])) {
|
||||||
$aa = $_POST['aa'];
|
$aa = $_POST['aa'];
|
||||||
$mm = $_POST['mm'];
|
$mm = $_POST['mm'];
|
||||||
|
@ -158,6 +161,9 @@ function edit_post() {
|
||||||
if ('publish' == $_POST['post_status'] && !current_user_can('publish_posts'))
|
if ('publish' == $_POST['post_status'] && !current_user_can('publish_posts'))
|
||||||
$_POST['post_status'] = 'draft';
|
$_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']))
|
if (!isset ($_POST['comment_status']))
|
||||||
$_POST['comment_status'] = 'closed';
|
$_POST['comment_status'] = 'closed';
|
||||||
|
|
||||||
|
|
|
@ -249,10 +249,17 @@ function map_meta_cap($cap, $user_id) {
|
||||||
// If the post is published...
|
// If the post is published...
|
||||||
if ($post->post_status == 'publish')
|
if ($post->post_status == 'publish')
|
||||||
$caps[] = 'edit_published_posts';
|
$caps[] = 'edit_published_posts';
|
||||||
|
else if ($post->post_status == 'static')
|
||||||
|
$caps[] = 'edit_pages';
|
||||||
else
|
else
|
||||||
// If the post is draft...
|
// If the post is draft...
|
||||||
$caps[] = 'edit_posts';
|
$caps[] = 'edit_posts';
|
||||||
} else {
|
} else {
|
||||||
|
if ($post->post_status == 'static') {
|
||||||
|
$caps[] = 'edit_pages';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
// The user is trying to edit someone else's post.
|
// The user is trying to edit someone else's post.
|
||||||
$caps[] = 'edit_others_posts';
|
$caps[] = 'edit_others_posts';
|
||||||
// The post is published, extra cap required.
|
// The post is published, extra cap required.
|
||||||
|
|
Loading…
Reference in New Issue