Cripple capability_type. Produced inconsistent, janky meta cap mapping; now only acts as a capability base. see #14122.

git-svn-id: http://svn.automattic.com/wordpress/trunk@16273 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
nacin 2010-11-10 14:50:14 +00:00
parent f269b75d7b
commit 795ab6d0f3
2 changed files with 10 additions and 13 deletions

View File

@ -826,9 +826,9 @@ function map_meta_cap( $cap, $user_id ) {
$post = get_post( $args[0] );
$post_type = get_post_type_object( $post->post_type );
if ( 'delete_post' == $cap && $post_type && 'post' != $post_type->capability_type && ! $post_type->map_meta_cap ) {
$args = array_merge( array( $post_type->cap->delete_post, $user_id ), $args );
return call_user_func_array( 'map_meta_cap', $args );
if ( ! $post_type->map_meta_cap ) {
$caps[] = $post_type->cap->$cap;
break;
}
if ( '' != $post->post_author && post_type_supports( $post_type->name, 'author' ) ) {
@ -869,9 +869,9 @@ function map_meta_cap( $cap, $user_id ) {
$post = get_post( $args[0] );
$post_type = get_post_type_object( $post->post_type );
if ( 'edit_post' == $cap && $post_type && 'post' != $post_type->capability_type && ! $post_type->map_meta_cap ) {
$args = array_merge( array( $post_type->cap->edit_post, $user_id ), $args );
return call_user_func_array( 'map_meta_cap', $args );
if ( ! $post_type->map_meta_cap ) {
$caps[] = $post_type->cap->$cap;
break;
}
if ( '' != $post->post_author && post_type_supports( $post_type->name, 'author' ) ) {
@ -911,9 +911,9 @@ function map_meta_cap( $cap, $user_id ) {
$post = get_post( $args[0] );
$post_type = get_post_type_object( $post->post_type );
if ( 'read_post' == $cap && $post_type && 'post' != $post_type->capability_type && ! $post_type->map_meta_cap ) {
$args = array_merge( array( $post_type->cap->read_post, $user_id ), $args );
return call_user_func_array( 'map_meta_cap', $args );
if ( ! $post_type->map_meta_cap ) {
$caps[] = $post_type->cap->$cap;
break;
}
if ( 'private' != $post->post_status ) {

View File

@ -842,7 +842,7 @@ function get_post_types( $args = array(), $output = 'names', $operator = 'and' )
* show_ui must be true.
* - menu_position - The position in the menu order the post type should appear. Defaults to the bottom.
* - menu_icon - The url to the icon to be used for this menu. Defaults to use the posts icon.
* - capability_type - The post type to use for checking read, edit, and delete capabilities. Defaults to 'post'.
* - capability_type - The string to use to build the read, edit, and delete capabilities. Defaults to 'post'.
* May be passed as an array to allow for alternative plurals when using this argument as a base to construct the
* capabilities, e.g. array('story', 'stories').
* - capabilities - Array of capabilities for this post type. By default the capability_type is used
@ -917,9 +917,6 @@ function register_post_type($post_type, $args = array()) {
if ( null === $args->exclude_from_search )
$args->exclude_from_search = !$args->public;
if ( empty($args->capability_type) )
$args->capability_type = 'post';
$args->cap = get_post_type_capabilities( $args );
unset($args->capabilities);