Support » Alpha/Beta/RC » Custom capability/role issues in 3.0 w/ custom post type.

  • Need help in resolving / replicating this issue.

    I’ve registered a custom post type in 3.0 and instead of using the default “post” to check capabilities against, i’m using a “articles”.

    (This way I can then let say my “subscribers” view, edit, etc my “articles”, but not be able to do anything with “posts”)

    The problem is that it partially works, but it lets me edit “others” peoples articles as well.

    register_post_type('articles', array(
    		'labels' => array(
    			'name' => __( 'Articles' ),
    			'singular_name' => __( 'Article' ),
    		'description' => 'Hunting Articles',
    		'public' => true,
    		'show_ui' => true,
    		'_builtin' => false,
    		'capability_type' => 'article',
    		'hierarchical' => false,
    		'rewrite' => array("slug" => "articles"), // Permalinks
    		'query_var' => "articles",
    		'supports' => array('title','author', 'excerpt', 'editor','thumbnail','comments')
    	));

    Here is my code to add the new capabilities to the subscriber role.

    $edit_subscriber = get_role('subscriber');	
    
    $edit_subscriber->add_cap('edit_article');
    $edit_subscriber->add_cap('edit_articles');
    $edit_subscriber->add_cap('read_article');

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Custom capability/role issues in 3.0 w/ custom post type.’ is closed to new replies.