Make WordPress Core


Ignore:
Timestamp:
02/02/2010 05:37:03 PM (15 years ago)
Author:
ryan
Message:

Allow customizing capabilities for custom post types. Always check caps against those in the post type object instead of contructing them manually. see #9674

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/post.php

    r12820 r12927  
    2626$post = null;
    2727$post_type_object = null;
    28 $post_type_cap = null;
    2928$post_type = null;
    3029if ( $post_id ) {
     
    3635            $current_screen->post_type = $post->post_type;
    3736            $current_screen->id = $current_screen->post_type;
    38             $post_type_cap = $post_type_object->capability_type;
    3937        }
    4038    }
     
    4543        $current_screen->post_type = $post_type;
    4644        $current_screen->id = $current_screen->post_type;
    47         $post_type_cap = $post_type_object->capability_type;
    4845    }
    4946}
     
    234231    $post = & get_post($post_id);
    235232
    236     if ( !current_user_can('delete_' . $post_type_cap, $post_id) )
     233    if ( !current_user_can($post_type_object->delete_cap, $post_id) )
    237234        wp_die( __('You are not allowed to move this item to the trash.') );
    238235
     
    247244    check_admin_referer('untrash-' . $post_type . '_' . $post_id);
    248245
    249     if ( !current_user_can('delete_' . $post_type_cap, $post_id) )
     246    if ( !current_user_can($post_type_object->delete_cap, $post_id) )
    250247        wp_die( __('You are not allowed to move this item out of the trash.') );
    251248
     
    260257    check_admin_referer('delete-' . $post_type . '_' . $post_id);
    261258
    262     if ( !current_user_can('delete_' . $post_type_cap, $post_id) )
     259    if ( !current_user_can($post_type_object->delete_cap, $post_id) )
    263260        wp_die( __('You are not allowed to delete this item.') );
    264261
Note: See TracChangeset for help on using the changeset viewer.