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

Viewing 8 results - 31 through 38 (of 38 total)
  • Author
    Search Results
  • #3835
    Vladimir
    Keymaster

    Hi,

    URE shows (0/0) for a custom post type (CPT) if it users WordPress built-in ‘post’ based capabilities set, like ‘edit_posts’, ‘edit_published_posts’, etc.

    You have two alternative options to block CPT menu for the role:
    1) use admin menu access add-on for it.

    2) activate “Force custom post types to use their own capabilities” option at the Settings->User Role Editor->Additional Modules tab. It will require to modify existing roles to provide access to the custom post type. Conflicts with some plugins are possible.

    #3772
    fuseo
    Participant

    Thank you. I’ve written a review.

    One more question though: I’m creating a new user role called ‘Equilli Brugge’. This person should have access to 3 specific pages, a custom post type (called ‘nieuws’) and the Booked plugin appointments.

    Here’s the problem:

    When I activate “Force custom post types to use their own capabilities”, this user has access to the ‘nieuws’ custom post type, but can’t access the Booked plugin. When I disable “Force custom post types to use their own capabilities”, the user has access to the Booked plugin, but not the ‘nieuws’ posts.

    What should I do to fix this?

    bcspca
    Participant

    Sorry. I just discovered that this is resolved when I enable “Force custom post types to use their own capabilities”.

    https://www.role-editor.com/forums/search/Force+custom+post+types+to+use+their+own+capabilities/

    #3686
    Vladimir
    Keymaster

    This shows that you don’t have custom post types which use user capabilities different from defined by WordPress for posts: edit_posts, etc.

    If you wish to force all existing custom post types to use their own user capabilities, like ‘edit_videos’ for ‘videos’ custom post type, etc., then go to “Settings->User Role Editor->Additional Modules” and turn ON the “Force custom post types to use their own capabilities” checkbox.

    Pay attention then Media Library items will require ‘edit_attachments’, instead of ‘edit_posts’ after that.

    #2666
    Vladimir
    Keymaster

    Often custom post types are protected with the same capabilities set as the built-in posts: edit_posts, edit_others_posts, etc.

    In order to check what capabilities are in use for the custom post type you may use “Admin menu access” add-on.
    Activate it and open for ‘Administrator’ role. Found ‘Testimonials’ at the list of menu items opened. Look what it’s shown at the ‘User capability’ column.

    Other way to check selected post type capabilities is to add this code to the functions.php and look at its output at the admin page HTML source:

    
    add_action('admin_head', 'debug_output');
    
    function debug_output() {
        $post_type = get_post_type_object('post'); // replace post with custom post type ID if needed
        echo '<!--start debug---' . PHP_EOL;
        print_r($post_type->cap);
        echo '---stop debug-->' . PHP_EOL;
    }
    

    If it uses its own capability, like ‘edit_testimonials’, just grant/revoke them with URE.
    If it uses ‘edit_posts’, etc. you have 2 options:
    1) block access to other post types blocking access to their menu items via “Admin menu access” module.
    2) Activate “Force custom post types to use their own capabilities” option at the “Settings->User Role Editor->Additional Modules” tab. Any custom post type (including reserved one, like ‘attachment’ will use its own capabilities set.

    heather
    Participant

    Okay, so I went to Settings > User Role Editor > ‘Force custom post types to use their own capabilities’ and was able to refine the role’s access to certain items.

    This worked very well.

    #2408

    In reply to: WordPress Team Manager

    Vladimir
    Keymaster

    You are right. My apologies – I had ‘Force custom post types to use their own capabilities’ option turned ON at my test site User Role Editor Settings page. So I had a different picture and misleaded you, slightly I hope.

    By default, ‘WordPress Team Manager’ uses the same capabilities for its CPT ‘team_manager’ as WordPress does for the posts.

    Let’s start from the very begin. Do you as admin see at the ‘Team’ menu some list of the members with different groups? User with ‘editor’ role should see them all also.
    For example:
    If you activated ‘Activate user access management to editing selected posts, pages, custom post types’ option at URE’s Settings, you should see the ‘Posts Edit’ button at the User Role Editor. If you open it for the ‘Editor’ role and input some groups ID (comma separated) there, you will see as the Editor just members from those groups.

    SilverwoodMedia
    Participant

    The administrator has all permissions. I have set Force custom post types to use their own capabilities

    /wp-admin/edit.php?post_type=et_pb_layout

    Cheating, are we?
    You are not allowed to edit posts in this post type.

    et_pb_layout is not an option in UREPro.

    Switching force cpt off remedies the problem.

Viewing 8 results - 31 through 38 (of 38 total)