Make WordPress Core

Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#31917 closed defect (bug) (invalid)

Cannot edit custom post even if capabilities are assigned to user role

Reported by: lpawlik's profile lpawlik Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Posts, Post Types Keywords: has-patch
Focuses: Cc:

Description

It seems that users with proper capabilities can't edit custom post types due to two issues:

  1. There is no edit link on posts list
  2. There is incorrect check in post.php

Example of problem:
File post.php

if ( ! current_user_can( 'edit_post', $post_id ) )
    wp_die( __( 'You are not allowed to edit this item.' ) );

could be

if ( ! current_user_can( $post_type_object->cap->edit_posts, $post_id ) )
    wp_die( __( 'You are not allowed to edit this item.' ) );

Attachments (2)

ticket-31917.diff (3.2 KB) - added by lpawlik 10 years ago.
Proposed patch.
ticket-31917.2.diff (10.6 KB) - added by lpawlik 10 years ago.
Updated patch.

Download all attachments as: .zip

Change History (6)

@lpawlik
10 years ago

Proposed patch.

@lpawlik
10 years ago

Updated patch.

#1 follow-up: @DrewAPicture
10 years ago

  • Keywords reporter-feedback added

Hi @lpawlik,

Is this issue new to trunk or has this been around in 4.1.1 or before?

#2 @DrewAPicture
10 years ago

  • Keywords has-patch added

#3 in reply to: ↑ 1 @lpawlik
10 years ago

  • Resolution set to invalid
  • Status changed from new to closed

Replying to DrewAPicture:

Hi @lpawlik,

Is this issue new to trunk or has this been around in 4.1.1 or before?

Hi,
I've checked the history and it seems that my patch is reverting changes made in https://github.com/WordPress/WordPress/commit/c2db94d10cb01fbb5babcd717896c89fa82f90e0.

Now I think it's not a bug - I should add edit_published_posts capability.

#4 @DrewAPicture
10 years ago

  • Keywords reporter-feedback removed
  • Milestone Awaiting Review deleted
  • Version trunk deleted
Note: See TracTickets for help on using tickets.