0

Possible Duplicate:
hook_menu_alter() is not working

I have implemented a hook function hook_menu_alter in a module I have created. I have printed something inside that function call but nothing shows up. Though the function hook_init() is executed from the same module. The output of the hook_init shows up in the page but not from the hook_menu_alter even after clearing the cache. Do somebody has any idea regarding this issue?

function mymodule_init(){
print "here";
}

function mymodule_menu_alter(&$items) {
print "I am here";
return $items;
}
  • not sure but try removing the print statement from the init function. It Performs setup tasks. To see if the init was called or not you can use watchdog. – ayush Jul 29 '11 at 4:39
  • Which version of drupal are you using? – vstm Jul 29 '11 at 4:40
  • I am using drupal 6.22 – John K Jul 29 '11 at 5:02
0

hook_menu and hook_menu_alter are only called when rebuilding the menu table, not on each table load. So you won't see your print statements.

As a side note, I would use drupal_set_message() rather than print when debugging.

| improve this answer | |