Change WordPress user roles and capabilities › Forums › How to or FAQ › Edit Page – but a specific page only
- This topic has 29 replies, 2 voices, and was last updated 5 years, 1 month ago by Vladimir.
-
AuthorPosts
-
27/09/2019 at 20:59 #5952ederingParticipant
Hi. I can’t find how to create a Role that can edit a Page we made already, and no other pages/posts. the only thing we want for this Role is to edit the one page, and add Media (not delete) so that they can publish files that their page needs. How do we do this?
28/09/2019 at 04:33 #5954VladimirKeymasterHi,
1) Allow this role to edit pages including this one.
2) Use Posts/pages edit restrictions add-on and input for a role page ID, which you allow to edit for this role. After that user with this role will can edit this single page only.29/09/2019 at 12:25 #5955ederingParticipantThanks. I the Role set to with only: Edit Page, Read, and Upload Files (so they can upload Media). I enabled the setting you showed me, and set the Page ID (I tripled checked that it is right – https://www.screencast.com/t/lcfCJ9xN ) – seen here: https://www.screencast.com/t/pCb3tf8qA But when I login, it shows no Pages as shown here: https://www.screencast.com/t/5jtrid0QpLsf Any ideas why the Page is not showing for this Role/User?
30/09/2019 at 12:24 #5957VladimirKeymasterSwitch off ‘edit restrictions’ temporally. Check if user can edit this page among other pages without any additional restrictions.
Is this page has a published state. Then you have to grant ‘edit_published’ pages in order user ca edit it.Take into account that with edit restrictions activated, only those pages are visible to a user at the Pages list, which this user can edit.
30/09/2019 at 12:50 #5958ederingParticipantI turned off the Edit Restrictions for the User. I saw all the pages but with a View ability only. https://www.screencast.com/t/sXHOiRFDYuYZ When I turned on Edit Published pages, and put back the Page ID, it is just like before showing no pages to edit. Role – https://www.screencast.com/t/rGfiNswYMTPr and the User’s Role – https://www.screencast.com/t/0m73NeQO and the User’s Page Restriction – https://www.screencast.com/t/ZaYec5hoZqK and what the User sees – https://www.screencast.com/t/stZ7N6CUv Any other ideas? Am I doing something wrong?
30/09/2019 at 13:22 #5959VladimirKeymasterDo not hurry with edit restrictions. User should be capable to edit desired page 1st. I suppose that page (which you wish this user edit) was created by other user. edit_others_pages capability is required in this case. Try to add it to a role.
And just when your user will can edit a page, maybe between others, proceed with page ID to restrict editing by this single page only.
30/09/2019 at 13:25 #5960ederingParticipantThat was it. It was Edit Others Pages. I did not know I needed to explicitly select that if I was defining what Pages the User can edit in Edit Restrictions. Thanks!
30/09/2019 at 15:47 #5962ederingParticipantIs there a way for this same Role to allow the User to Delete their Media, but only their media? We don’t want them to be able to delete any Pages. This will help keep our Media clean (when they make a mistake uploading a Media file they will no longer use). Right now we have Upload Files on which means they can view and upload, and not delete any. Thanks
02/10/2019 at 01:46 #5963VladimirKeymasterWordPress checks for media library item the same permissions as for the posts or page to which it is attached. So if user can delete page he can delete image attached to this page too. Try delete_pages and delete_others_pages.
When user restricted by edit a specific page – he sees/can edit/delete this page only and sees only his own images and images attached to this page.
02/10/2019 at 17:56 #5964ederingParticipantThe User set to see only one Page and that works. But when I go to Media, they can SEE all Media (which is good), and they cannot delete Media, not even the Media they uploaded that is used for that page. I also tried access the Media via the Page, and then looked for the Delete Permanently link but it was not there. Current setting for this role are only: delete_others_pages, delete_pages, edit_others_pages, edit_pages, edit_published_pages, read, and upload_files.
02/10/2019 at 18:01 #5965ederingParticipantalso, I tried checking the option for “Own Data Only” for that user but that did not help.
03/10/2019 at 03:15 #5968VladimirKeymasterIt seems we missed ‘delete_published_pages’. Try to add it.
If issue is still there: Some plugin may change WordPress default behavior. Try to deactivate all plugins and test. If that will help, activate plugins back one by one to isolate a reason.
03/10/2019 at 12:04 #5969VladimirKeymasterBut I don’t want this role to be able to delete any pages, not even the pages I gave them access to edit.
Just remember that is default WordPress permissions – in order to delete item from Media Library user should can delete the page to which this image was attached.
There is workaround for your situation – force WordPress to use unique user capabilities for all post types including ‘attachment’ one.
Make fresh database backup – for the case if you will wish to rollback changes.
Go to Settings->User Role Editor->Additional Modules. Turn ON “Force custom post types to use their own capabilities” option under “Content editing restrictions” section. Go through your roles and check if they need new created capabilities, like for ‘Attachments’ post type.You can grant to a role ‘delete_attachments’ instead of ‘delete_pages’, etc. in this case.
08/10/2019 at 14:12 #5980ederingParticipantHi. After we did this last item, it worked for our URE-create Roles. But we noticed when we create new Custom Post Types (as the default WordPress Administrator), we are not seeing the Custom Post Type in WordPress. I deselected the setting of Force Custom Post Types to use their own capabilities” and that fixed it for us. But now I assume that will break what we did. Any idea why Administrators can’t access Custom Post Types that are new?
09/10/2019 at 03:17 #5986VladimirKeymasterHi,
When you add new CPT with a default ‘edit_posts’ capability, URE should add this CPT own capabilities to ‘administrator’ role automatically, at least when you open User Role Editor. ‘administrator’ role should get access to all CPTs after that. If it’s not happened you still can add needed capabilities to ‘administrator’ role manually. Check if ‘administrator’ role has full list of capabilities under ‘Custom Post Types’ group.
-
AuthorPosts
- You must be logged in to reply to this topic.