[wp-trac] [WordPress Trac] #16808: Insufficient permissions for custom post type management and custom role/caps

WordPress Trac wp-trac at lists.automattic.com
Wed Mar 9 19:54:04 UTC 2011


#16808: Insufficient permissions for custom post type management and custom
role/caps
-----------------------------+-----------------------------
 Reporter:  Genesis2001      |      Owner:
     Type:  defect (bug)     |     Status:  new
 Priority:  normal           |  Milestone:  Awaiting Review
Component:  Role/Capability  |    Version:  3.1
 Severity:  normal           |   Keywords:
-----------------------------+-----------------------------
 I asked a question over at
 [http://wordpress.stackexchange.com/questions/11508/permission-error-on-
 custom-post-type-add-new-action 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.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/16808>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list