HI I want to hide the register menu item of the user.module through a different module:

Specifically I want to hide user/register:

function user_menu($may_cache) {
  global $user;
  $items = array();

  $access = user_access('administer users');

  if ($may_cache) {
    $items[] = array('path' => 'user/register', 'title' => t('register'),
      'callback' => 'user_page', 'access' => $user->uid == 0 && variable_get('user_register', 1), 'type' => MENU_LOCAL_TASK);
  }

  return $items;
}

So that in my hook I get the following:

function myhook_menu($may_cache) {
	global $user;
	
	$items = array();
	if ($may_cache) {
	    $items[] = array("path" => "user/register",
	    			"type" => MENU_CALLBACK,
                                 //HERE IS MY PROBLEM:
	                     "access" => $user->uid == 0);

	    $items[] = array("path" => "user/register&doit=".$doit,
	                     "access" => $user->uid == 0,
	                     "callback" => "user_page",
	                     "type" => MENU_LOCAL_TASK);
	}
	
	return $items;
}

MY PROBLEM: is that if i have access false, then I won't have access, the only thing I want is to hide it!
There must be a way to hide a menu, without restricting the permissions on it. We had this on 4.4.0, what happened?

Comments

paddy_deburca’s picture

Does

Administer > Users > configure

and, the setting the
"User Registration Settings" to "Only site administrators can create new user accounts."

solve your problem ?
Paddy

adrian’s picture

a type of MENU_CALLBACK will not make it show up anywhere.

--
The future is so Bryght, I have to wear shades.