Build custom module with similar maintenance mode behaviour I'm building a custom module that denies access to the site based on some custom rule.

I;ve already build the module form, variables get stored, in hook_init I do my check against the variables I set on my custom module.

What I would like to do now is to have a template behaviour like the maintenance mode one.

By default it should be a blank page with Site name and message like maintenance mode(maybe overriding html.tpl.php). The default mymodule-page.tpl.php should leave in mymodule/templates/

This page can be overridden in theme folder so the user can apply its own style, logo, region etc...

function my_custom_module_menu{
  $items['my-custom-module-page'] = array(
    'title' =&gt; t('My custom module  title'),
    'page callback' =&gt; 'my_custom_module_page_callback',
    'type' =&gt; MENU_CALLBACK,
  );
}

function my_custom_module_theme($existing, $type, $theme, $path) {
  return array(
    'my_custom_module_template' =&gt; array(
      'template' =&gt; 'my-custom-module-template',
      'variables' =&gt; array('variable' =&gt; NULL),
    ),
  );
}

function my_custom_module_page_callback() {
  return theme('my_custom_module_template');
}


The code above keeps the layout of the page but I would like to override the entire page.

Which hooks should I use to achieve this?
How can I call this template from my hook_init?

Thanks in advance.
You are getting the regions being printed because your page callback is returning a string. If you want your page callback to just print your output, you need to change your code to the following one.

function my_custom_module_page_callback() {
  print theme('my_custom_module_template');
}


The reason is visible in drupal_deliver_html_page(), which uses the following code.

// Menu status constants are integers; page content is a string or array.
  if (is_int($page_callback_result)) {
    // Omissis
  }
  elseif (isset($page_callback_result)) {
    // Print anything besides a menu constant, assuming it's not NULL or
    // undefined.
    print drupal_render_page($page_callback_result);
  }

If your page callback returns NULL (which also happens when it doesn't have an explicit return statement), then drupal_render_page() will not be called. As result, just the output from your page callback will be returned to the browser.

This is what node_feed() does: It prints an RSS feed without letting Drupal output anything else. Contrary, the output would not be handled as a RSS feed from the client side.