mirror of
https://github.com/WordPress/WordPress.git
synced 2025-03-25 01:18:42 +00:00
Check parent caps for revisions. props aaroncampbell. fixes #17668
git-svn-id: http://svn.automattic.com/wordpress/trunk@18200 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
152af39f98
commit
cfcde41182
@ -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…
x
Reference in New Issue
Block a user