when a Drupal site is in maintenance mode (not due to a technical fault), users without permission cannot access any page other than /user.

Is there any special hook to define a specific menu router should be allowed in maintenance mode ?

I checked user_menu but there does not seem to be any clue about this.

1 Answer 1


You can use hook_menu_site_status_alter() to change the site status for a specific path.

Control site status before menu dispatching.

The hook is called after checking whether the site is offline but before the current router item is retrieved and executed by menu_execute_active_handler(). If the site is in offline mode, $menu_site_status is set to MENU_SITE_OFFLINE.

The user module implements that hook (user_menu_site_status_alter()) to make sure the site is always online for the user, user/login, user/password and user/reset/* paths. It should be simple enough to use the logic from that function to implement it for your custom path, e.g.

function MYMODULE_menu_site_status_alter(&$menu_site_status, $path) {
  if ($menu_site_status == MENU_SITE_OFFLINE && $path == 'my-path') {
    $menu_site_status = MENU_SITE_ONLINE;
  • Exactly what I was looking for. Thanks a million times Clive!
    – AKS
    Commented Mar 7, 2013 at 18:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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