hi there,

i've installed the bbb module which has a hook_menu with some items defined, which looks something like this:

function bbb_menu()
{
  ...
  $items['node/%node/meeting/moderate'] = array(
    'title' => 'Moderate Meeting',
    'page callback' => 'bbb_join',
    'page arguments' => array(1, 3),
    'access callback' => 'bbb_access_moderator',
    'access arguments' => array(1),
    'type' => MENU_LOCAL_TASK,
  );
  ...
}

now i've created a custom module called "foo", which consists of these files:
sites/all/modules/foo.info
sites/all/modules/foo.install
sites/all/modules/foo.module

the install file sets the weight column in the system table to 100, the rest is pretty basic. the module file has only one function in it, which looks like this:


function foo_menu_alter(&$items)
{
  $items['node/%node/meeting/moderate'] = false;
  return $items;
}

after clearing all caches and rebuilding the menues, i was hoping that the menu item "moderate meeting" would disappear, but the hook doesnt seem to be called at all. i've put some var_dumps into the hook, and added this line to the index.php to clear all caches on every request:
drupal_flush_all_caches();

but still no debug output and the menu item remains.

thanks in advance
regards benjamin

Comments

damien tournoud’s picture

Category: bug » support

hook_menu_alter() is definitely called each time the menu is rebuilt (for example when validating the modules page).

Not sure what exactly happens here, but there is probably something wrong in the way you have built those modules.

Just note that your alter function should probably look like this:

function foo_menu_alter(&$items)
{
  unset($items['node/%node/meeting/moderate']);
}

Setting a menu entry to FALSE is just not the same as unsetting it.

avpaderno’s picture

Status: Active » Fixed

I am marking this report as fixed because it has been already replied.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.