Check parent caps for revisions. props aaroncampbell. fixes #17668
git-svn-id: https://develop.svn.wordpress.org/trunk@18200 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
542a9372af
commit
9d6bb11571
@ -820,6 +820,11 @@ function map_meta_cap( $cap, $user_id ) {
|
||||
case 'delete_page':
|
||||
$author_data = get_userdata( $user_id );
|
||||
$post = get_post( $args[0] );
|
||||
|
||||
if ( 'revision' == $post->post_type ) {
|
||||
$post = get_post( $post->post_parent );
|
||||
}
|
||||
|
||||
$post_type = get_post_type_object( $post->post_type );
|
||||
|
||||
if ( ! $post_type->map_meta_cap ) {
|
||||
@ -865,6 +870,11 @@ function map_meta_cap( $cap, $user_id ) {
|
||||
case 'edit_page':
|
||||
$author_data = get_userdata( $user_id );
|
||||
$post = get_post( $args[0] );
|
||||
|
||||
if ( 'revision' == $post->post_type ) {
|
||||
$post = get_post( $post->post_parent );
|
||||
}
|
||||
|
||||
$post_type = get_post_type_object( $post->post_type );
|
||||
|
||||
if ( ! $post_type->map_meta_cap ) {
|
||||
@ -909,6 +919,11 @@ function map_meta_cap( $cap, $user_id ) {
|
||||
case 'read_page':
|
||||
$author_data = get_userdata( $user_id );
|
||||
$post = get_post( $args[0] );
|
||||
|
||||
if ( 'revision' == $post->post_type ) {
|
||||
$post = get_post( $post->post_parent );
|
||||
}
|
||||
|
||||
$post_type = get_post_type_object( $post->post_type );
|
||||
|
||||
if ( ! $post_type->map_meta_cap ) {
|
||||
|
Loading…
Reference in New Issue
Block a user