• Resolved wonderbird

    (@wonderbird)


    Hey, I have a custom role ‘styrelse’ that I want to be able to do the exports. What function do I need to check in the User Role Editor plugin for that to wotk? Or do you have a snippet I can insert so it will work? Or does it not work at all?

    Thanx.

Viewing 1 replies (of 1 total)
  • Plugin Author WebToffee

    (@webtoffee)

    Hi @wonderbird,

    You may please copy the below code snippet to your active theme’s functions.php to grant export/import permission for other user roles. Please make sure to replace the user role ‘admin’ in the snippet(6th and 7th line) with your required one.

    add_filter('wt_iew_allowed_screens_basic', 'wt_iew_add_cap_to_role');
    function wt_iew_add_cap_to_role($screen) {
        $user = wp_get_current_user();
        $roles = (array) $user->roles;
        foreach ($roles as $key => $role) {
            if ($role == 'admin') {
                $role_object = get_role('admin');
                $role_object->add_cap('manage_options');
            }
        }
        return $screen;
    }
Viewing 1 replies (of 1 total)
  • The topic ‘Custom role to handle export’ is closed to new replies.