Forum Replies Created

Viewing 15 posts - 2,266 through 2,280 (of 2,506 total)
  • Author
    Posts
  • in reply to: Block Visual and Text Tabs #1663
    Vladimir
    Keymaster

    Code below removes all metaboxes from the post editor page for all users with “editor” role. Modify it for your own needs. Revisions metabox is ‘revisionsdiv’.


    add_action('add_meta_boxes', 'remove_post_metaboxes', 11);

    function remove_post_metaboxes() {
    if (!current_user_can('editor')) {
    return;
    }

    $side_metaboxes = array('formatdiv', 'categorydiv', 'tagsdiv-post_tag', 'postimagediv');
    $normal_metaboxes = array('revisionsdiv', 'postexcerpt', 'trackbacksdiv', 'postcustom', 'commentstatusdiv', 'commentsdiv', 'slugdiv', 'authordiv');

    foreach($side_metaboxes as $metabox) {
    remove_meta_box($metabox, 'post', 'side');
    }
    foreach($normal_metaboxes as $metabox) {
    remove_meta_box($metabox, 'post', 'normal');
    }

    }

    add_action('add_meta_boxes', 'remove_page_metaboxes', 11);

    in reply to: Block Visual and Text Tabs #1662
    Vladimir
    Keymaster

    Hi,

    This code removes all HTML tags from the post content before save it for all users with ‘author’ role:

    add_filter('content_save_pre', 'nohtml_in_posts');

    function nohtml_in_posts($content) {
    if (current_user_can('author')) {
    $content = wp_filter_nohtml_kses($content);
    }

    return $content;
    }

    Include it into active theme’s functions.php file.

    Vladimir
    Keymaster

    Hi, this plugin does not introduce its own capabilities. It uses built-in WordPress manage_options user capability for its menu item:
    https://storage.googleapis.com/role-editor/downloads/support/si-contact-form-capability.png

    You may find user capability for any admin menu item with a help of “Admin access add-on”:
    https://www.role-editor.com/block-admin-menu-items
    Just open it for the Administrator role and find needed menu item in the list.

    in reply to: Custom Admin Menus – Serious Bugs #1657
    Vladimir
    Keymaster

    Thanks for the information.
    Could you tell me from what plugin that custom menu is, so I may directly test URE with it?

    As about “Block not selected” option, it works currently as straightforward as it named – blocked (as result user is redirected) all not selected URLs. So if some link is clicked from the allowed page, but that link was not selected at menu items list (it may even be not presented there) user will not get access to it.

    in reply to: Additional Roles #1654
    Vladimir
    Keymaster

    Hi,

    Thanks. I found an issue in URE with your help:
    Other default roles (in addition to the primary role) was assigned to a new registered user for requests from the admin back-end only. Now this feature works for the requests from the front-end user registration forms too.

    Try next update: development version 4.19.1.b2. It should work as expected now.

    in reply to: Editing Restricted pages #1652
    Vladimir
    Keymaster

    In order to edit published page, user should have ‘edit_published_pages’ capability. I added it directly to the user. checkman-test may edit allowed page now.

    in reply to: "Options" does not exist #1651
    Vladimir
    Keymaster

    Hi,

    OK. Thanks for letting me know, that you find an answer yourself.

    in reply to: Editing Restricted pages #1645
    Vladimir
    Keymaster

    Is it possible to look on that data online? Send admin credentials to the [email protected]

    in reply to: Editing Restricted pages #1643
    Vladimir
    Keymaster

    If that post is from other author, then user should have ‘edit_others_posts’ capability to get permission to edit it.

    in reply to: How to display admin bar for some user role #1642
    Vladimir
    Keymaster

    Thanks for the information. It’s a strange effect. Roles editing core was not changed. So I can not repeat and explain it.

    in reply to: How to display admin bar for some user role #1637
    Vladimir
    Keymaster

    Try this variant:

    add_filter('woocommerce_disable_admin_bar', '_wc_disable_admin_bar', 10, 1);
     
    function _wc_disable_admin_bar($prevent_admin_access) {
        if ( !( current_user_can('data_entry') || 
                current_user_can('operator') ||
                current_user_can('manager') ) ) {
            return $prevent_admin_access;
        }
        return false;
    }
     
    add_filter('woocommerce_prevent_admin_access', '_wc_prevent_admin_access', 10, 1);
     
    function _wc_prevent_admin_access($prevent_admin_access) {
        if ( !( current_user_can('data_entry') || 
                current_user_can('operator') ||
                current_user_can('manager') ) ) {
            return $prevent_admin_access;
        }
        return false;
    }
    
    in reply to: How to display admin bar for some user role #1635
    Vladimir
    Keymaster

    Good. Thanks for the information.

    You may use one complex expression for all roles, like this one:

    if (!(current_user_can('role1') || current_user_can('role2'))) {
        return ....
    }
    
    in reply to: How to display admin bar for some user role #1630
    Vladimir
    Keymaster

    It seems I found a problem with code. Replace ‘no’ to ‘false’. It should help.

    add_filter('woocommerce_disable_admin_bar', '_wc_disable_admin_bar', 10, 1);
     
    function _wc_disable_admin_bar($prevent_admin_access) {
     
        return false;
    }
    
    in reply to: How to display admin bar for some user role #1628
    Vladimir
    Keymaster

    Ok. I will re-test this code myself.

    in reply to: How to display admin bar for some user role #1626
    Vladimir
    Keymaster

    While it worked for me as it is, try to add filter with lower priority value – 9 instead of 10.

Viewing 15 posts - 2,266 through 2,280 (of 2,506 total)