• vonsa

    (@vonsa)


    Hi,

    For instance to hide notifications for all users except admin.
    Someone posted this one and a half year ago, you said it was a great idea and you were already thinking of implementing it. Is it something you’re still thinking of adding?

    Could it possibly be done by code similar to the code shown below? And to have it only display for say role-administrator / role-super-administrator or however it’s targeted. I’m a newb so I have no idea if this is how it works, but hope it helps.

    if ( is_user_logged_in() ) {
    add_filter(‘body_class’,’add_role_to_body’);
    add_filter(‘admin_body_class’,’add_role_to_body’);
    }
    function add_role_to_body($classes) {
    $current_user = new WP_User(get_current_user_id());
    $user_role = array_shift($current_user->roles);
    if (is_admin()) {
    $classes .= ‘role-‘. $user_role;
    } else {
    $classes[] = ‘role-‘. $user_role;
    }
    return $classes;
    }

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

    (@webtemyk)

    Hello.

    We are still planning to update the plugin.

Viewing 1 replies (of 1 total)
  • The topic ‘Feature request: user role based’ is closed to new replies.