mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 01:27:36 +01:00
Don't let contributors to re-publish their trashed posts, props caesarsgrunt, see #4529
git-svn-id: http://svn.automattic.com/wordpress/trunk@11873 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
e03f120254
commit
8d4223adb3
@ -773,11 +773,16 @@ function map_meta_cap( $cap, $user_id ) {
|
||||
// If the user is the author...
|
||||
if ( $user_id == $post_author_data->ID ) {
|
||||
// If the post is published...
|
||||
if ( 'publish' == $post->post_status )
|
||||
if ( 'publish' == $post->post_status ) {
|
||||
$caps[] = 'delete_published_posts';
|
||||
else
|
||||
} elseif ( 'trash' == $post->post_status ) {
|
||||
$trash_meta = get_option('wp_trash_meta');
|
||||
if (is_array($trash_meta) && isset($trash_meta['posts'][$post->ID]['status']) && $trash_meta['posts'][$post->ID]['status'] == 'publish')
|
||||
$caps[] = 'delete_published_posts';
|
||||
} else {
|
||||
// If the post is draft...
|
||||
$caps[] = 'delete_posts';
|
||||
}
|
||||
} else {
|
||||
// The user is trying to edit someone else's post.
|
||||
$caps[] = 'delete_others_posts';
|
||||
@ -797,11 +802,16 @@ function map_meta_cap( $cap, $user_id ) {
|
||||
// If the user is the author...
|
||||
if ( $user_id == $page_author_data->ID ) {
|
||||
// If the page is published...
|
||||
if ( $page->post_status == 'publish' )
|
||||
if ( $page->post_status == 'publish' ) {
|
||||
$caps[] = 'delete_published_pages';
|
||||
else
|
||||
} elseif ( 'trash' == $page->post_status ) {
|
||||
$trash_meta = get_option('wp_trash_meta');
|
||||
if (is_array($trash_meta) && isset($trash_meta['posts'][$page->ID]['status']) && $trash_meta['posts'][$page->ID]['status'] == 'publish')
|
||||
$caps[] = 'delete_published_pages';
|
||||
} else {
|
||||
// If the page is draft...
|
||||
$caps[] = 'delete_pages';
|
||||
}
|
||||
} else {
|
||||
// The user is trying to edit someone else's page.
|
||||
$caps[] = 'delete_others_pages';
|
||||
|
Loading…
Reference in New Issue
Block a user