Skip Navigation

[Resolved] Giving Custom User Roles capability to view Private Posts

This thread is resolved. Here is a description of the problem and solution.

Problem:

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.

Solution:

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

Relevant Documentation:

https://codex.wordpress.org/Roles_and_Capabilities#read_private_posts

This support ticket is created 5 years ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

Author
Posts
#1227368

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.

#1227662

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

#1227902

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?

#1228297

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

#1229059

Thank you. That worked!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.