hide "create new account" tab in "/user" page. To hide menu tabs we have to use hook_menu_alter hook. This hook changes the menu items. So here we are going to alter menu tabs that come with user module. Using this hook we can also do some other changes like title, permissions etc.
###For hiding menu tabs
Eg: Hide 'create new account' tab and 'request password' tab.
In your Custom module
/**
* Implements hook_menu_alter().
*
*/
function MYMODULE_menu_alter(&$items) {
$items['user/password']['type'] = MENU_CALLBACK;
}
In your theme. File template.php
/**
* Implements hook_menu_alter().
*
*/
function themename_menu_alter(&$items) {
$items['user/password']['type'] = MENU_CALLBACK;
}
###Access Permission
`The following implements hook_menu_alter to remove access to the "user/register" url for the anonymous user:`
/**
* Implements hook_menu_alter.
* Check access for forum menu item.
*/
function MYMODULE_menu_alter(&$items) {
$items['forum']['access callback'] = '_accesscheck';
}
/**
* Callback to disallow access for the anonymous user.
*/
function _accesscheck(){
global $user;
// here you can check any user. Based on that, return the value 0(False) or 1(True).
return $user->uid; /* Uid of anonymous is 0 */
}