I created a page and a menu item for it. I have simple access module installed. I only want this page visible to logged in users. I set simple access to only allow authorized users, and that works ok, but the menu item remains visible in the navigation menu regardless.

I want the menu item to appear only for authorized users but I don't see the way to do it. I'm new at Drupal.

-Mike (New site at www.myallo.com)

Comments

Barry Pretsell’s picture

try http://drupal.org/node/55296

searching for 'restricting menu' will return a few more threads.

angelopc’s picture

Lepton,
I understand what you want to do. I haven't seen it covered, correctly, in any other post, without having to add some PHP code. I have the Primary Links menu, at the top of my page. I want EVERYONE to see that menu, but I want to add a "My Account" menu item, that only logged-in users will see. Creating a different menu doesn't really solve the problem. It's just a workaround.

This option should be included in the Menu module.

Ed Coyne
http://www.angelopc.com

Update: I'm using Suckerfish menus on my site. All I did was create another menu (only one menu item) and added the block to the Suckerfish Menu area and edited the visibilty settings. It displays right along side of the Primary Links menu and it only displays to logged-in users.

oknate’s picture

In drupal 6, you can use hook menu in your custom module:


function mycustommodule_menu() {
	
	$items = array();

	$items['about-us'] = array(
    'title' => 'About Us',
    'description' => 'test description 1',
    'page callback' => 'mycustommodule_aboutus_page',
    'access arguments' => array('access content'),
    'type' => MENU_SUGGESTED_ITEM,
    );
	
	
	$items['faq'] = array(
    'title' => 'Frequently Asked Questions',
    'description' => 'test description 2',
    'page callback' => 'mycustommodule_faq_page',
    'access callback' => 'user_is_logged_in',
    'type' => MENU_SUGGESTED_ITEM,
    );
	
	return $items;
}

Notice the access calback function on the second item. This will restrict your page to only logged-in users.

Check out the documentation on hook_menu