#7430
Vladimir
Keymaster

WPBE plugin developer decides that this plugin should be available only to users with ‘administrator’ or ‘editor’ role. Instead of user capability, which you would grant to any custom role, plugin checks directly ‘administrator’ and ‘editor’ role before add its menu page:


if (WPBE_HELPER::can_manage_data()) {
    add_action('admin_menu', function() {
                add_menu_page(esc_html('WPBE Bulk Editor', 'bulk-editor'), esc_html('WPBE Bulk Editor', 'bulk-editor'), 'publish_posts', 'wpbe', function() {
                    $this->print_plugin_options();
                }, 'dashicons-hammer', 90);
            }, 99);
}

public static function can_manage_data($user_id = 0) {

    if ($user_id === 0) {
        $user = wp_get_current_user();
    } else {
        $user = get_userdata($user_id);
    }
    // !!! this condition does not allow custom roles to use this plugin 
    if (in_array('administrator', $user->roles) OR in_array('editor', $user->roles)) {
        return TRUE;
    }

    return FALSE;
}