Make WordPress Core

Changeset 16273


Ignore:
Timestamp:
11/10/2010 02:50:14 PM (16 years ago)
Author:
nacin
Message:

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

Location:
trunk/wp-includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/capabilities.php

    r16264 r16273  
    827827                $post_type = get_post_type_object( $post->post_type );
    828828
    829                 if ( 'delete_post' == $cap && $post_type && 'post' != $post_type->capability_type && ! $post_type->map_meta_cap ) {
    830                         $args = array_merge( array( $post_type->cap->delete_post, $user_id ), $args );
    831                         return call_user_func_array( 'map_meta_cap', $args );
     829                if ( ! $post_type->map_meta_cap ) {
     830                        $caps[] = $post_type->cap->$cap;
     831                        break;
    832832                }
    833833
     
    870870                $post_type = get_post_type_object( $post->post_type );
    871871
    872                 if ( 'edit_post' == $cap && $post_type && 'post' != $post_type->capability_type && ! $post_type->map_meta_cap ) {
    873                         $args = array_merge( array( $post_type->cap->edit_post, $user_id ), $args );
    874                         return call_user_func_array( 'map_meta_cap', $args );
     872                if ( ! $post_type->map_meta_cap ) {
     873                        $caps[] = $post_type->cap->$cap;
     874                        break;
    875875                }
    876876
     
    912912                $post_type = get_post_type_object( $post->post_type );
    913913
    914                 if ( 'read_post' == $cap && $post_type && 'post' != $post_type->capability_type && ! $post_type->map_meta_cap ) {
    915                         $args = array_merge( array( $post_type->cap->read_post, $user_id ), $args );
    916                         return call_user_func_array( 'map_meta_cap', $args );
     914                if ( ! $post_type->map_meta_cap ) {
     915                        $caps[] = $post_type->cap->$cap;
     916                        break;
    917917                }
    918918
  • trunk/wp-includes/post.php

    r16268 r16273  
    843843 * - menu_position - The position in the menu order the post type should appear. Defaults to the bottom.
    844844 * - menu_icon - The url to the icon to be used for this menu. Defaults to use the posts icon.
    845  * - capability_type - The post type to use for checking read, edit, and delete capabilities. Defaults to 'post'.
     845 * - capability_type - The string to use to build the read, edit, and delete capabilities. Defaults to 'post'.
    846846 *   May be passed as an array to allow for alternative plurals when using this argument as a base to construct the
    847847 *   capabilities, e.g. array('story', 'stories').
     
    917917        if ( null === $args->exclude_from_search )
    918918                $args->exclude_from_search = !$args->public;
    919 
    920         if ( empty($args->capability_type) )
    921                 $args->capability_type = 'post';
    922919
    923920        $args->cap = get_post_type_capabilities( $args );
Note: See TracChangeset for help on using the changeset viewer.