Check proper caps when publising a page. Props DD32. fixes #8208

git-svn-id: https://develop.svn.wordpress.org/trunk@9701 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren
2008-11-14 23:34:18 +00:00
parent 2307b67870
commit 2acf13eb85
2 changed files with 10 additions and 3 deletions

View File

@@ -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']) )