How can I hide menue at drupal 7 website

I would like to hide drupal standart menu for editing content but only for normal users. Admin should stil see this menu? Does anybody know how to do this?

Codemaster's picture

You need to add some code

You need to use hook_menu_alter in your module.

In your module implement hook_menu_alter function. Then check user roles if user has administrator role or not.

If user does not have administrator role then set menu type as MENU_CALLBACK. It will hide menu tab for non admin user.

Here is working code.

* Implementing hook_menu_alter()
function MYMODULE_menu_alter(&$items) {
global $user;
// Checking if user is admin
if(!in_array("administrator", array_values($user->roles))) {
$items['node/%node/edit']['type'] = MENU_CALLBACK;


Vote the answer: 
No votes yet