Disable core pages in a Drupal site

How to disable standard path's and pages from core (or third party) modules.

Sometimes you want to disable users from accessing pages in your website which are offered by required core modules (e.g. 'user'). Since you can't disable the required core modules, you'll have to address the issue in another way.

In this example we'll assume that you have created your own custom Login Form and you don't want your visitors to access the /user/login page anymore.

This can be accomplished by writing your own module which will remove or disable the /user/login page from the menu.

In your module you'll have to implement the following hook: hook_menu_alter()

function hook_menu_alter(&$items) {
// Example - disable the page at user/login
$items['user/login']['access callback'] = FALSE;
}
?>

For more info: see http://api.drupal.org/api/function/hook_menu_alter

Tags: 

Share