Make WordPress Core


Ignore:
Timestamp:
05/12/2010 08:45:18 PM (14 years ago)
Author:
nacin
Message:

Move post type object capabilities to a 'cap' object. Allow them to be initialized via the 'capabilities' key (an array) when registering support for the post type. Caps are now referred to by the name of the cap as if it was a post, i.e. ->cap->edit_post. see #13358.

File:
1 edited

Legend:

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

    r14404 r14585  
    824824        $post_type = get_post_type_object( $post->post_type );
    825825        if ( $post_type && 'post' != $post_type->capability_type ) {
    826             $args = array_merge( array( $post_type->delete_cap, $user_id ), $args );
     826            $args = array_merge( array( $post_type->cap->delete_post, $user_id ), $args );
    827827            return call_user_func_array( 'map_meta_cap', $args );
    828828        }
     
    901901        $post_type = get_post_type_object( $post->post_type );
    902902        if ( $post_type && 'post' != $post_type->capability_type ) {
    903             $args = array_merge( array( $post_type->edit_cap, $user_id ), $args );
     903            $args = array_merge( array( $post_type->cap->edit_post, $user_id ), $args );
    904904            return call_user_func_array( 'map_meta_cap', $args );
    905905        }
     
    960960        $post_type = get_post_type_object( $post->post_type );
    961961        if ( $post_type && 'post' != $post_type->capability_type ) {
    962             $args = array_merge( array( $post_type->read_cap, $user_id ), $args );
     962            $args = array_merge( array( $post_type->cap->read_post, $user_id ), $args );
    963963            return call_user_func_array( 'map_meta_cap', $args );
    964964        }
Note: See TracChangeset for help on using the changeset viewer.