Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #2184
    dweb360
    Participant

    Hello,
    Can you add ability to hide Screen Options by User roles ?
    Thank you in advance

    #2185
    Vladimir
    Keymaster

    Hi,

    Thanks for the idea. I will look how to make it.

    #2717
    shackbill
    Participant

    Hey Vlad.. Wondering if you ever had any ideas on how to do this? I wonder if you could just add a Role Dropdown Selector to each page and then select the options to display/hide and press apply and it would apply to that particular role. see attached image. Just a thought.

    Screen Options

    #2719
    Vladimir
    Keymaster

    Hi,
    It could be suitable for admin to manage it this way. Thanks for the right direction.

    #4399
    JamesJosephFinn
    Participant

    Hi Vladimir,

    Thanks for such an incredibly useful plugin!

    I would like to put in my support for adding this feature.

    My use-case is I have purchased the “WooCommerce Product Reviews Pro” plugin, and if “shop_manager” has the dashboard “screen option > activity” checked, “Recent Comments” will be listed in this widget, which in turn grants them the contextual ability (when hovering over the individual comments) to “approve”, “delete”, “edit”, etc.

    This happens even when access to the core permission “moderate_comments” has been revoked. Unchecking “moderate_comments” will remove the “reviews” tab from the “WooCommerce” submenu, but, strangely, this functionality is still exposed in the dashboard.

    #4400
    JamesJosephFinn
    Participant

    Actually, rescind my last comment! The contextual hover options are no longer there. I did something, and don’t know what. Regardless, again, yours is a great tool!!

    #4401
    Vladimir
    Keymaster

    Hi James,

    “Hide Screen Options by user roles” feature is still in plans.
    Thanks for the good feedback.

    #5845
    RunningBe
    Participant

    Hi Vladimir,

    Would like to set as checked a particular Screen Option (namely, Slug) for a specific role in the Edit Media screen. Was hoping URE Pro would allow me to do this, but apparently not?

    I’ve successfully used URE Pro to hide Meta Boxes, thank you.

    Regards, Barry

    #5856
    Vladimir
    Keymaster

    Hi Barry,

    Thanks for the feedback.

    URE does not include UI to turn ON for a role selected screen option (or in other words, show meta box). You can use this code though:

    
    /**
     * Turn ON 'Slug' screen option for user with 'author' role at the Media Library item (attachment) edit page
     */
    add_filter( 'hidden_meta_boxes', 'show_slug_metabox', 10, 3 );
    
    function show_slug_metabox( $hidden, $screen, $use_defaults ) {
    
        if ( $screen->id!=='attachment') {
            return $hidden;
        }
        
        $user = wp_get_current_user();
        if ( empty( $user) || empty( $user->roles ) ) {
            return $hidden;
        }
        if ( !in_array( 'author', $user->roles ) ) {
            return $hidden;
        }
        
        $slug_key = array_search( 'slugdiv', $hidden );
        if ( $slug_key !== false ) {
            unset( $hidden[ $slug_key ] );
        }
    
        return $hidden;
    }
    

    Change ‘author’ to your own role ID and setup this code as a Must Use plugin.

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