computamike / cpt_security

Custom Post Type Security (WordPress)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Custom Post Type Security

UPDATE : This issue is now potentially resolved

When attempting to write the studies WordPress was performing a check against current_user_can for edit_post, and this was returning a false. Even with edit_post capability set, it was failing to map this correctly. Setting 'map_meta_cap' => true, when registering the custom post type resolved this issue.

This project is a plugin which installs a custom post type - based on the tutorial here.

So what's going on?

After installing the plugin - a subscriber with what appears to be appropriate privilages is able to create a study post record, but unable to submit it for review.

Steps to recreate the issue.

  • Install the plugin into a wordpress site.
  • As an administrator, the plugin grants all permissions to the administrator user.
  • Administrator can create and publish studies.
  • Create a subscriber user Creating a simple subscriber
  • Notice that the user has nothing - and can't add studies.
  • Install the Capability Manager Enhanced plugin
  • Switch oto the Administrator user, and load the Capability Manager Enhanced plugin
  • load the Subscriber role - it should look something like this : Initial subscriber settings
  • Now set the edit permission for the subscriber user - the subscriber can now edit studies. Initial subscriber settings
  • Switch to the subscriber user - note that the menu now shows a studies option Initial subscriber settings
  • Subscriber can click on Studies option, and can see studies that have already been created Initial subscriber settings
  • Subscriber can create a new study - a subscriber has no publish permission, so they can only submit for review. Initial subscriber settings
  • Clicking on the submit for review button presents the following screen. Initial subscriber settings

About

Custom Post Type Security (WordPress)

License:GNU General Public License v3.0


Languages

Language:PHP 95.1%Language:JavaScript 4.4%Language:CSS 0.5%