Change WordPress user roles and capabilities › Forums › Give user access to plugin – how to › Give User Full Access to "Page" but restrict Post ID in "Post Type"
- This topic has 5 replies, 3 voices, and was last updated 3 years, 10 months ago by Vladimir.
-
AuthorPosts
-
18/07/2016 at 09:39 #2560James WeeParticipant
How do I do that?
Basically I want User A to be able to change everything in “Page”, but restrict User A to only 1 specific post ID (1601) in “Custom Post Type”.
I’m using User Editor Restrictions to limit a user to post ID 1601 and selected “Look at Roles” (I assume “Look at Roles” means on top of the current settings”. But it is not showing.
Shed some light here?
18/07/2016 at 10:01 #2561VladimirKeymasterTo what post type post with ID=1601 really belongs: post, page or custom post type (CPT)? You need to know this to be clear what capabilities are in use for item with ID=1601: posts, pages or special for that CPT.
User should be capable to edit this CPT item before you apply edit restrictions with URE. So if item ID=1601 was created by other author, user should have ‘edit_others_pages’ for pages, ‘edit_others_posts’ for posts or CPT which uses the same capabilities as posts do, or ‘edit_others_cptname’ for that CPT, e.g. ‘edit_others_videos’ for videos CPT.
You may look at ‘Admin Menu’ at this CPT menu for administrator role to be sure what capabilities CPT uses.
“Look at Roles” is related to the “What to do” (restriction type) field only: prohibit or allow or look 1st not empty value from roles assigned to this user.
So if you need to add a special restriction just for this user make it at this user profile without reference to the roles, assigned to this user.
You may set edit restrictions at the role level and use them for the group of users.
19/07/2016 at 02:17 #2562James WeeParticipantOkay, let’s rephrase everything again.
I have 2 post types
1. Pages
2. Community (Custom Post Type)I’ve given full access (create delete edit publish read) on both post types. So the user can create and edit everything within the 2 post types listed above.
But I only wanted the user to be able to edit post 1601 only in “Community” but everything else in “Pages”.
So I went ahead and added “1601” in “Posts/Pages/Custom Post Types Editor Restrictions”
with post ID (comma separated) : 1601 and press “Update User”.Now the user cannot see all posts in “Pages” and “Community” except post 1601 in “Community”. It’s like the URE is overwriting the Role Editor global settings when it is supposed to compliment it.
Ideally when I set with post ID (comma separated) : 1601. I should:
1. Page: Still be able to create and edit all posts – according to global role editor settings
2. Community: Can only see post 1601 and cannot see all other posts.19/07/2016 at 02:58 #2563VladimirKeymasterIn order to exclude ‘page’ post type from the edit restriction you may use a custom ure_restrict_edit_post_type filter.
Modify example code according with your needs and add it into your active theme functions.php file or setup as a “must use” plugin.Let me know if you need further help.
11/02/2021 at 14:06 #7361miliarisParticipantHi,
I have same puzzle to solve..
I have a User Role set to edit, create, remove all posts of transparency (custom post type).
I have done this activeting “Force custom post types to use their own capabilities”.
To the same Role/User I have to let him edit 2 pages (classic wp pages).
If I add the ID’s on Edit Posts, he cannot modify anything but those 2 pages.I don’t see any codes in your link above.
I need to operate in functions.php? Can you give me a hint?
Thank you11/02/2021 at 16:22 #7362VladimirKeymasterHi,
I fixed the linked article. Code is available now. Just replace ‘post’ with your custom post type slug.
Yes, you can place it to functions.php file.
-
AuthorPosts
- You must be logged in to reply to this topic.