5

i'm using drupal 7 and i want to hide the admin toolbar from the normal sites. but in the configuration i can only find the option to disable the toolbar completely. what i want is that it is only visible on "mysite.com/admin/" and removed from the actual website.

i found some drupal modules with which you can collapse the toolbar or hide it by pressing the UP key but what i want the complete admin toolbar markup gone on my actual site.

i'm removing all the drupal system css and js anyway (using the template.php file) so even if i wanted the admin toolbar on my sites it would look messed up because of the missing styles and scripts.

any ideas?

10

You can remove the toolbar from the "normal" part of you're site by unsetting its entry in the $page array using hook_page_alter. You can do this in either a module or a theme.

function mymodule_page_alter(&$page) {
  unset($page['page_top']['toolbar']);
}
|improve this answer|||||
1

You can use the function admin_menu_supress() to remove the admin menu from a specific page. It can be called from almost anywhere.

Reference - https://www.rit.edu/drupal/api/drupal/sites!all!modules!admin_menu!admin_menu.module/function/admin_menu_suppress/7.43

|improve this answer|||||
0

The admin toolbar is only visible when you log in as admin; for the normal users, this toolbar will not be display.

|improve this answer|||||
  • 2
    Not true...any role can be granted the 'Use the administration toolbar' permission. – Clive Mar 13 '12 at 17:23
  • ok, But For the questioner don't want admin toolbar for the normal users.He needs only on /admin.Thats why i said like that. – sathishkumar Mar 13 '12 at 17:27
  • What if his users have access to some parts of the admin section but not others? The downvote was perhaps a bit harsh though, I've removed it – Clive Mar 13 '12 at 17:28
  • i did indeed want to remove it for the admin as well, so that it's removed no matter which role you are. – toxinlabs Mar 13 '12 at 18:46
  • If it so, then "Toolbar" is a module, you can go to modules and uninstall the toolbar module. – sathishkumar Mar 14 '12 at 5:01

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.