Make WordPress Core

Ticket #31917: ticket-31917.diff

File ticket-31917.diff, 3.2 KB (added by lpawlik, 9 years ago)

Proposed patch.

  • wp-admin/includes/class-wp-posts-list-table.php

    diff --git wp-admin/includes/class-wp-posts-list-table.php wp-admin/includes/class-wp-posts-list-table.php
    index e626039..95148cc 100644
    class WP_Posts_List_Table extends WP_List_Table { 
    645645                $edit_link = get_edit_post_link( $post->ID );
    646646                $title = _draft_or_post_title();
    647647                $post_type_object = get_post_type_object( $post->post_type );
    648                 $can_edit_post = current_user_can( 'edit_post', $post->ID );
     648                $can_edit_post = current_user_can( $post_type_object->cap->edit_posts, $post->ID );
    649649
    650650                $classes = 'iedit author-' . ( get_current_user_id() == $post->post_author ? 'self' : 'other' );
    651651
  • wp-admin/post.php

    diff --git wp-admin/post.php wp-admin/post.php
    index 0c38b56..3bbb936 100644
    case 'edit': 
    152152        if ( ! $post_type_object )
    153153                wp_die( __( 'Unknown post type.' ) );
    154154
    155         if ( ! current_user_can( 'edit_post', $post_id ) )
     155        if ( ! current_user_can( $post_type_object->cap->edit_posts, $post_id ) )
    156156                wp_die( __( 'You are not allowed to edit this item.' ) );
    157157
    158158        if ( 'trash' == $post->post_status )
  • wp-includes/link-template.php

    diff --git wp-includes/link-template.php wp-includes/link-template.php
    index 1f90199..bfe384b 100644
    function get_edit_post_link( $id = 0, $context = 'display' ) { 
    11811181        if ( !$post_type_object )
    11821182                return;
    11831183
    1184         if ( !current_user_can( 'edit_post', $post->ID ) )
     1184        if ( !current_user_can( $post_type_object->cap->edit_posts, $post->ID ) )
    11851185                return;
    11861186
    11871187        /**