WordPress.org

Make WordPress Core

Opened 7 years ago

Last modified 18 months ago

#16808 reopened defect (bug)

Insufficient permissions for custom post type management and custom role/caps — at Initial Version

Reported by: Genesis2001 Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 3.1
Component: Role/Capability Keywords: needs-patch
Focuses: Cc:

Description

I asked a question over at StackExchange about this. Went into their chat room to talk to a few people and came to the conclusion I need to post this ticket.

---

When accessing an admin page located at post-new.php with a custom post type on a user that's in a custom role that has the available permission to "Add New", you get "You do not have sufficient permissions to access this page."

$post_caps = array( 'delete_post' => 'argus_admin', ); $visitor_caps = $post_caps; $visitor_caps = array_merge( $visitor_caps, array(

'edit_post' => 'argus_visitors', 'read_post' => 'argus_visitors', 'edit_posts' => 'argus_visitors', 'edit_others_posts' => 'argus_visitors', 'publish_posts' => 'argus_visitors', 'read_private_posts' => 'argus_visitors',

));

$v_args = array(

'labels' => array (

'name' => 'Visitors', 'singular_name' => 'Visitor', 'add_new_item' => 'Register New Visitor',

),

'public' => true, 'publicly_queryable' => false, 'exclude_from_search' => true, 'show_ui' => true, 'show_in_menu' => 'argus', 'show_in_menu' => false, 'hiearchical' => false, 'supports' => array( ), 'capabilities' => $visitor_caps, 'register_meta_box_cb' => array ( &$this, '_wp_visitor_meta_box_cb' ),

);

register_post_type( 'visitor', $v_args );

I've tested it with 3.0.4 and it worked flawlessly. However, when in 3.1, it doesn't want to work.

Change History (0)

Note: See TracTickets for help on using tickets.