How can I check in a theme-file.tpl.php if the administration toolbar is visible or not?

The easiest, but not nicest way to check that, if the user has certain user roles. But is there a way to check that, without checking the roles?


I think using the user_access function to see if they have the "access toolbar" permission should work.

Some example code:

if (user_access('access toolbar')) {
  // Your logic here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.