I have a custom post type job-application which needs to have view access controlled. Administrator, supervisor and manager roles should be able to view all job-application posts. All other roles should only be able to view job-applications which they created (the user is the author). The method I'm trying to use to control the ability to view job-application posts is by setting them all to "private" and then add the capability for admins, supervisors and managers to read_private_job-application. This did not work.
Here's what I did:
I followed instructions I found in this article https://toolset.com/forums/topic/protected-content-showing-in-directory-view/
Verified Posts are managed by Access.
Added a custom capability "read_private_job-application" and enabled it for administrators, supervisors and managers.
Changed individual job application posts to "private" so I can test visibility
Administrator role can view a private job application.
Supervisor role is unable to view a private job application.
Private job applications are not showing up in a View for either Administrators or Supervisor roles.
I expected administrators, managers and supervisors to be able to view all private job-application posts. I also expected private job application posts to show up in a View listing job-applications if viewed by one of these roles.
The site is on a development server. Login is required to view the site. I can provide login credentials if you'd like access.
Hello,
Please try these:
Dashboard-> Toolset-> Access control-> Custom Roles
- Enable Advanced mode
- Change permissions for "Supervisor" role
click "Other capabilities", find and enable option "read_private_posts", and test again
More help:
https://codex.wordpress.org/Roles_and_Capabilities#read_private_posts
Thank you that helped address a few of my problems. I still have an issue where job applications marked private are not showing up in some Views.
For example, I have a view with shows job-applications with a query filter for author = the currently logged in user. When the job-application is set to public it shows up in the View. When it's set to private it does not. Shouldn't a user be able to see their own private job-application posts?
Please try this, edit your post view, add a post status filter, like this:
Select posts with status of publish or private.
More help:
https://toolset.com/documentation/user-guides/filtering-views-query-by-post-status/
And test again