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:
markjaquith 2011-06-08 18:06:43 +00:00
parent 152af39f98
commit cfcde41182
1 changed files with 15 additions and 0 deletions

View File

@ -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 ) {