WordPress.org

Ready to get started?Download WordPress

Forums

Custom Post Type Capability Problems (3 posts)

  1. nbseminary
    Member
    Posted 2 years ago #

    I am designing a website for teachers and students to post and review assignments for academic courses. There will be both student and teacher roles created and I need to be able to have students only be able to view, create and publish to one custom post type (Submissions) and not be able to edit or create any thing else. In register_post_type i put this in for capabilities.
    'capability_type' => 'submissions',
    'capabilities' => array(
    'publish_posts' => 'publish_submissions',
    'edit_posts' => 'edit_submissions',
    'edit_published_posts' => 'edit_published_submissions',
    'delete_published_posts' => 'delete_published_submissions',
    'edit_others_posts' => 'edit_others_submissions',
    'delete_posts' => 'delete_submissions',
    'delete_others_posts' => 'delete_others_submissions',
    'read_private_posts' => 'read_private_submissions',
    'edit_post' => 'edit_submission',
    'delete_post' => 'delete_submission',
    'read_post' => 'read_submission',
    ),
    However when I log in with a student profile I can view the Student Submissions section but when I try to Publish a post I get an error telling me "You are not allowed to edit this post". If I back up in my browser the post has been created but I only have "View" capability.
    What am I missing? I have searched all over the web and cannot find any discussion of this problem. I have read Justin Tadlock's article on capabilities but am not able to find an answer to this issue.

  2. nbseminary
    Member
    Posted 2 years ago #

    The Custom Post Type is created but with errors when publishing. Here is a link to a sample "Student Submission" created by a test "Student" user.

  3. nbseminary
    Member
    Posted 2 years ago #

    I figured it out. Besides 'edit_posts' => 'edit_submissions' I needed to have 'edit_posts' => 'edit_submission' - singular.

Topic Closed

This topic has been closed to new replies.

About this Topic