Change WordPress user roles and capabilities Forums Search Search Results for 'Force custom post types to use their own capabilities'

Viewing 15 results - 16 through 30 (of 38 total)
  • Author
    Search Results
  • #6570
    Vladimir
    Keymaster

    Hi @thebigbanik,

    URE’s “Force custom post types to use their own capabilities’ works only for CPT, which has capability type ‘post’ – default for WordPress.

    If you set other capability type for CPT you really should create capabilities list yourself, but look how WordPress does that for capability type ‘post’:
    create_posts, edit_posts, delete_posts, publish_posts, edit_publish_posts, edit_others_posts.

    So you have to add not edit_blog, but edit_blogs, etc. Add ‘s’ to the end, if did not insert special multiple form at the CPU UI plugin.

    #6569
    thebigbanik
    Participant

    Hi Vladimir, I use the CPT UI plugin to create 3 custom post types BLOG, PROGRAMS and PERSONEL. In each custom post I have set accordingly “blog”, “programs” and “personel” as Capability type. Then in user role editor I have created capabilities for each type (create_blog, edit_blog, read_blog, delete_blog, publish_blog) and so on for programs and personel. If a user role has all this new types enabled he can see only the blog CPT in the admin menu. The other 2 capabilities seams to not work dispite that I have already enable them. BUT, if in the CPT UI “PROGRAMS”, I change the Capability type to “blog” then the user can see the PROGRAMS in the admin menu. I am not sure if there is something else that I have to set. (Of course “Force custom post types to use their own capabilities” is enabled from the beggining). Thank you for your time in advanced.

    scottcodes
    Participant

    Resolved. We see that we needed to activate Settings -> User Role Editor -> “Force custom post types to use their own capabilities”

    awyeah
    Participant

    Is there any way to set “Force custom post types to use their own capabilities” on individual sites in a multisite configuration? This would be a useful feature.

    #5993
    edering
    Participant

    As a followup, I have a Role setup called Scholarships. Here are screenshots of what the Role can do: https://www.screencast.com/t/Cb4NEOLk and https://www.screencast.com/t/lrlZz8uL6Xf and https://www.screencast.com/t/13cjfAilwgE8 and “Force Custom Post Types to use their own capabilities” is still enabled.

    #5987
    edering
    Participant

    The problem I am having is when “Administrator” is not showing in the dropdown menu for “Select Role and Change its Capabilities” as shown here: https://www.screencast.com/t/nPZ9xVBq To me that would make sense because shouldn’t the default Administrator role have access to everything, regardless of what what settings are applied in URE, such “Force custom post types to use their own capabilities”? And whether I enabled “Force custom post types to use their own capabilities” or not, the list still does not show “administrator”

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

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

    #5383

    In reply to: Doesn't seem to work.

    Vladimir
    Keymaster

    About custom post type capabilities:
    Custom post type is defined with special parameter ‘capability type’. If custom post type uses the same capability type as the WordPress built-in ‘post’ does, that is ‘post’, then this custom post type is protected by the same capabilities set: edit_posts, ‘delete_posts’, ‘publish_posts’, etc.
    Any capability, like ‘edit_posts’ is granted to a role, not to a custom post type, or WordPress built-in type post. Capabilities groups to the left in a User Role Editor just shows a kind of permissions required for access to the functionality related to a group. Thus if few post types uses the same capability type you change access to all of them at once when: revoke ‘edit_post’ from a role. It does not matter which group you use to find ‘edit_posts’ and turn OFF its checkbox.

    If you need manage access to all custom post types separately there is a special option at “Settings->User Role Editor”: “force custom post types use their own capabilities”.
    You have to aware that if you turn this option ON, you need to check roles if they have needed capabilities, e.g. ‘edit_attachments’, etc., as every post type will get its own capability type: post type ‘video’ – ‘edit_videos’, ‘project’: ‘edit_projects’, etc.

    #5353
    tracedef
    Participant

    EDIT: It looks like Redis object cacheing was the issue, flushing cache corrected issue.

    I have enabled ” Force custom post types to use their own capabilities” so custom post types can have more control. One user assigned as an administrator has all permissions enabled for a custom post type that were set as default as checked at the administrator level. I have decided against enabling these permissions at the administrator level and have disabled them via settings > user role editor.

    The issue is that if I edit the user’s role permissions directly, the custom post type check boxes are enabled and greyed out, so I am unable to disable the permissions at the user level. I’m on a multisite install and even resettings user roles via tools > reset has no effect. How do I edit user roles on a per user basis if the check boxes are greyed out and I can’t uncheck them? TIA

    #4670
    Vladimir
    Keymaster

    Hi,

    In general, user should be capable to edit post to which media file is attached. It it’s true, user can edit this media file (attachment) property and delete it. ‘upload_files’ allows just to add new item to the media library.

    If you turn ON the “Force custom post types to use their own capabilities” checkbox at the “Settings->User Role Editor->Additional Modules” tab, then WordPress will check ‘delete_attachments” capability instead of ‘delete_posts’. So you have to look if required capabilities from the “Attachments” group were granted to a role or user.

    Some plugin can introduce a problem also. So all plugin temporal deactivation may help to isolate a reason.

    #4601
    FreshySites
    Participant

    I am using the latest version of your Pro plugin, and of Divi: 3.0.100

    As you mentioned, I went to Settings > User Role Editor, and turned off “Force custom post types to use their own capabilities”.

    This fixed the error.

    However, I really need that option. Unless you could supply a method to implement it via a function.

    I really only need that option for one of the roles, and for one post type.

    I have a custom role that, when logged in to wp-admin, only has capability to:

    1. read
    2. create_polls
    3. publish_polls
    4. read_private_polls
    5. delete_polls
    6. edit_polls
    7. delete_private_polls
    8. delete_published_polls
    9. edit_private_polls
    10. edit_published_polls
    #4594
    Vladimir
    Keymaster

    Hi,

    Try to temporally switch Off this option “Force custom post types to use their own capabilities” at the “Settings->User Role Editor” and re-test “Users->User Role Editor”. If it will help, then the error from screenshot is related. This fatal PHP error requires a fix any way though.

    What version of Divi do you use? I tested URE Pro with 3.0.98.

    #4455
    Vladimir
    Keymaster

    If custom post types use the same capability type ‘post’, ‘Yes’, role may have access to all CPT with ‘edit_posts’ or to none of them.
    But if every CPT uses own unique capability type then videos will be protected by ‘edit_videos’, ‘books’ – by ‘edit_books’, etc. You can grant access to the selected CPT at the role level in this case.
    If you define CPT yourself via PHP or plugin, like “Custom Post Types User Interface” then use unique capability type for this purpose.
    If CPT is defined by external source (theme or plugin) you can use “Force custom post types to use their own capabilities” option at “Settings->User Role Editor->Additional Modules” tab. Take into account that this option is applied to all existing custom post types, including WordPress built-in ‘attachments’. Correspondent roles modification would be required.

    #4319

    In reply to: Permissions Issue

    Vladimir
    Keymaster

    Hi,

    Please clarify. Does user see existing images at Media Library after you added ure_attachments_show_full_list filter returning true?
    So what is a problem?
    1) User can not insert existing media into a post?
    or
    2) User can not upload a new image into Media Library?
    If the 2nd, let me know is the checkbox for “Force custom post types to use their own capabilities” option turned ON or OFF. I mean if it turned ON, then role or user should have capabilities from the ‘Attachments’ group, like ‘edit_attachments’, etc.

Viewing 15 results - 16 through 30 (of 38 total)