More custom post type support. Props scribu. see #9674

git-svn-id: https://develop.svn.wordpress.org/trunk@12597 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren
2010-01-04 16:58:43 +00:00
parent 170b14f97d
commit 9ef2cb198f
20 changed files with 292 additions and 102 deletions
+9 -6
View File
@@ -779,8 +779,9 @@ function map_meta_cap( $cap, $user_id ) {
$author_data = get_userdata( $user_id );
//echo "post ID: {$args[0]}<br />";
$post = get_post( $args[0] );
if ( 'page' == $post->post_type ) {
$args = array_merge( array( 'delete_page', $user_id ), $args );
$post_type = get_post_type_object( $post->post_type );
if ( $post_type && 'post' != $post_type->capability_type ) {
$args = array_merge( array( 'delete_' . $post_type->capability_type, $user_id ), $args );
return call_user_func_array( 'map_meta_cap', $args );
}
@@ -855,8 +856,9 @@ function map_meta_cap( $cap, $user_id ) {
$author_data = get_userdata( $user_id );
//echo "post ID: {$args[0]}<br />";
$post = get_post( $args[0] );
if ( 'page' == $post->post_type ) {
$args = array_merge( array( 'edit_page', $user_id ), $args );
$post_type = get_post_type_object( $post->post_type );
if ( $post_type && 'post' != $post_type->capability_type ) {
$args = array_merge( array( 'edit_' . $post_type->capability_type, $user_id ), $args );
return call_user_func_array( 'map_meta_cap', $args );
}
$post_author_data = get_userdata( $post->post_author );
@@ -913,8 +915,9 @@ function map_meta_cap( $cap, $user_id ) {
break;
case 'read_post':
$post = get_post( $args[0] );
if ( 'page' == $post->post_type ) {
$args = array_merge( array( 'read_page', $user_id ), $args );
$post_type = get_post_type_object( $post->post_type );
if ( $post_type && 'post' != $post_type->capability_type ) {
$args = array_merge( array( 'read_' . $post_type->capability_type, $user_id ), $args );
return call_user_func_array( 'map_meta_cap', $args );
}