How can I restrict a specific logged user (current role is subscriber) via wp_get_current_user() to view only specific pages?
I wish to create a custom capability for accessing the interface of my plugin.
I’m trying to implement what seemed like a relatively straight forward idea, basically I am building an access control plugin to control viewing and editing of a custom post type (in this case ‘Projects’).
I have a restricted area on a website that can only be accessed by logged in users. For that I created a page template with a ‘current_user_can()’ condition.
In the Comments page (/wp-admin/edit-comments.php
), every logged in user can see all the site comments.
I have a situation where I need to hide a specific category and it’s children from users who are logged in as Contributors. I don’t want them to see this category and it’s children in the categories meta-box on the add new post screen.
We currently have about 50 pages, each of which I want a user (eg, bob, rob, smith) to be able to edit only 1 page. For example, bob & smith each have their own page. I do not want bob to be able to edit smith’s page. I want bob to ONLY be able to edit bob’s page. I don’t care if he can see other pages.
Looking through the user roles, I don’t see a way to currently to do this- I only see how to allow restrict access on a global scale.
I like the idea of enabling any user of my website to suggest edits to a page. Much like the edit system on Stack Exchange but different in that anyone should be able to edit, not just registered users. All edits would go through an approval process.
I have a very specific use case where the site built for a lawyer and each of his clients can login to their own ‘specific page/portal’ (custom post type) without the ability to access wp-admin etc. (I created all the login/register/profile-editing pages in the front end). In this page/portal the lawyer will leave messages and files for the client to download, now theoretically speaking, one client can guess (or if has knowledge of another client’s files) other file names and download then thus creating an issue with privacy/security/confidential material etc.