Make WordPress Core


Ignore:
Timestamp:
07/08/2013 08:05:42 PM (13 years ago)
Author:
nacin
Message:

Use meta caps edit_post, read_post, and delete_post directly, rather than consulting the post type object. map_meta_cap() handles that for us. props markjaquith, kovshenin. fixes #23226.

File:
1 edited

Legend:

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

    r24527 r24593  
    2929    $ptype = get_post_type_object( $post_data['post_type'] );
    3030
    31     if ( $update && ! current_user_can( $ptype->cap->edit_post, $post_data['ID'] ) ) {
     31    if ( $update && ! current_user_can( 'edit_post', $post_data['ID'] ) ) {
    3232        if ( 'page' == $post_data['post_type'] )
    3333            return new WP_Error( 'edit_others_pages', __( 'You are not allowed to edit pages as this user.' ) );
     
    173173
    174174    $ptype = get_post_type_object($post_data['post_type']);
    175     if ( !current_user_can( $ptype->cap->edit_post, $post_ID ) ) {
     175    if ( !current_user_can( 'edit_post', $post_ID ) ) {
    176176        if ( 'page' == $post_data['post_type'] )
    177177            wp_die( __('You are not allowed to edit this page.' ));
     
    375375        $post_type_object = get_post_type_object( get_post_type( $post_ID ) );
    376376
    377         if ( !isset( $post_type_object ) || ( isset($children) && in_array($post_ID, $children) ) || !current_user_can( $post_type_object->cap->edit_post, $post_ID ) ) {
     377        if ( !isset( $post_type_object ) || ( isset($children) && in_array($post_ID, $children) ) || !current_user_can( 'edit_post', $post_ID ) ) {
    378378            $skipped[] = $post_ID;
    379379            continue;
Note: See TracChangeset for help on using the changeset viewer.