Change WordPress user roles and capabilities Forums How to or FAQ Edit Page – but a specific page only

Viewing 15 posts - 1 through 15 (of 30 total)
  • Author
    Posts
  • #5952
    edering
    Participant

    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?

    #5954
    Vladimir
    Keymaster

    Hi,

    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.

    #5955
    edering
    Participant

    Thanks. 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?

    #5957
    Vladimir
    Keymaster

    Switch 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.

    #5958
    edering
    Participant

    I 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?

    #5959
    Vladimir
    Keymaster

    Do 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.

    #5960
    edering
    Participant

    That 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!

    #5962
    edering
    Participant

    Is 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

    #5963
    Vladimir
    Keymaster

    WordPress 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.

    #5964
    edering
    Participant

    The 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.

    #5965
    edering
    Participant

    also, I tried checking the option for “Own Data Only” for that user but that did not help.

    #5968
    Vladimir
    Keymaster

    It 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.

    #5969
    Vladimir
    Keymaster

    But 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.

    #5980
    edering
    Participant

    Hi. 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?

    #5986
    Vladimir
    Keymaster

    Hi,

    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.

Viewing 15 posts - 1 through 15 (of 30 total)
  • You must be logged in to reply to this topic.