From 29ab18dcb71dc1593850fd366eefb3236e660f79 Mon Sep 17 00:00:00 2001 From: ryan Date: Fri, 14 Nov 2008 23:34:18 +0000 Subject: [PATCH] Check proper caps when publising a page. Props DD32. fixes #8208 git-svn-id: http://svn.automattic.com/wordpress/trunk@9701 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/edit-page-form.php | 2 +- wp-admin/includes/post.php | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/wp-admin/edit-page-form.php b/wp-admin/edit-page-form.php index 3ba05c4e94..e1b2707cec 100644 --- a/wp-admin/edit-page-form.php +++ b/wp-admin/edit-page-form.php @@ -228,7 +228,7 @@ if ( ( 'edit' == $action ) && current_user_can('delete_page', $post->ID) ) { ?>
post_status, array('publish', 'future', 'private') ) || 0 == $post->ID ) { ?> - + post_date_gmt) && time() < strtotime( $post->post_date_gmt . ' +0000' ) ) : ?> diff --git a/wp-admin/includes/post.php b/wp-admin/includes/post.php index 7c44c40d92..3ffcfa667d 100644 --- a/wp-admin/includes/post.php +++ b/wp-admin/includes/post.php @@ -75,8 +75,15 @@ function _wp_translate_postdata( $update = false, $post_data = null ) { // Posts 'submitted for approval' present are submitted to $_POST the same as if they were being published. // Change status from 'publish' to 'pending' if user lacks permissions to publish or to resave published posts. - if ( isset($post_data['post_status']) && ('publish' == $post_data['post_status'] && !current_user_can( 'publish_posts' )) ) - if ( $previous_status != 'publish' OR !current_user_can( 'edit_published_pages') ) + if ( 'page' == $post_data['post_type'] ) { + $publish_cap = 'publish_pages'; + $edit_cap = 'edit_published_pages'; + } else { + $publish_cap = 'publish_posts'; + $edit_cap = 'edit_published_posts'; + } + if ( isset($post_data['post_status']) && ('publish' == $post_data['post_status'] && !current_user_can( $publish_cap )) ) + if ( $previous_status != 'publish' || !current_user_can( $edit_cap ) ) $post_data['post_status'] = 'pending'; if ( ! isset($post_data['post_status']) )