Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A user with multiple roles confuses remove-toolbar-frontend #29

Closed
neilgilmour opened this issue Jan 10, 2019 · 1 comment
Closed

A user with multiple roles confuses remove-toolbar-frontend #29

neilgilmour opened this issue Jan 10, 2019 · 1 comment

Comments

@neilgilmour
Copy link

I have added intervention('remove-toolbar-frontend', 'all-not-admin'); and it removes the toolbar when a user has a role other than admin (excellent!) even when that user ALSO has an admin role (boo!).

It's an edge case so I'm flagging it up for interest really.

The following snippet works for admins who also have other roles

/* *
 *
 * Remove admin bar for all users except admin
 */

add_action('after_setup_theme', 'remove_admin_bar');

function remove_admin_bar() {
    if (!current_user_can('administrator') && !is_admin()) {
        show_admin_bar(false);
    }
}
@darrenjacoby
Copy link
Owner

Thanks @neilgilmour , I'll be re-working the ways roles are used with Intervention for an upcoming major release and will keep this in mind.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants