mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 22:30:04 +00:00
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:
@@ -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']) )
|
||||
|
||||
Reference in New Issue
Block a user