Make WordPress Core


Ignore:
Timestamp:
05/12/2010 08:45:18 PM (15 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-admin/post.php

    r14571 r14585  
    153153        wp_die( __('You attempted to edit an item that doesn’t exist. Perhaps it was deleted?') );
    154154
    155     if ( !current_user_can($post_type_object->edit_cap, $post_id) )
     155    if ( !current_user_can($post_type_object->cap->edit_post, $post_id) )
    156156        wp_die( __('You are not allowed to edit this item.') );
    157157
     
    218218    $post = & get_post($post_id);
    219219
    220     if ( !current_user_can($post_type_object->delete_cap, $post_id) )
     220    if ( !current_user_can($post_type_object->cap->delete_post, $post_id) )
    221221        wp_die( __('You are not allowed to move this item to the Trash.') );
    222222
     
    231231    check_admin_referer('untrash-' . $post_type . '_' . $post_id);
    232232
    233     if ( !current_user_can($post_type_object->delete_cap, $post_id) )
     233    if ( !current_user_can($post_type_object->cap->delete_post, $post_id) )
    234234        wp_die( __('You are not allowed to move this item out of the Trash.') );
    235235
     
    244244    check_admin_referer('delete-' . $post_type . '_' . $post_id);
    245245
    246     if ( !current_user_can($post_type_object->delete_cap, $post_id) )
     246    if ( !current_user_can($post_type_object->cap->delete_post, $post_id) )
    247247        wp_die( __('You are not allowed to delete this item.') );
    248248
Note: See TracChangeset for help on using the changeset viewer.