I have a private website in which content can only be viewed by authenticated users. All I want is the login box for non authenticated users. I am using NodeAccess and also Rules module to do this. Seems to work fine with one exception. The pages which should only be visible after login show their links to the anonymous user on the Bartik theme main menu right on the home page. All menu items appear including those for pages specifically limited to administrator viewing. True, clicking on them merely brings up the login dialog box so the individual can't see the page, however, I don't want the menu itself to appear at all until the person is authenticated. How do I make the entire menu disappear if unautenticated? Thanks in advance.
The main menu in Bartik theme is being output directly (you can see it in 'themes/bartik/templates/page.tpl.php' - starts with
<?php if ($main_menu): ?>). In order to hide the menu from anonymous users you could do the following:
<?php if ($logged_in): ?> <?php if ($main_menu): ?> // Code that prints the menu. <?php endif; ?> <?php endif; ?>
Modifying core should be avoided though so the proper way to handle this would be to create a copy of the theme inside the 'sites/all/themes' folder with a different name. Then renaming necessary files, modifying the code and making your site use that theme instead of the core Bartik.
In case you are using D7, when you configure your menu block, you have a section called "visibility settings".There select the Roles tab and check the option "authenticated user" under "show block for specific roles". Then click save block.
Beat, Just wondering, has anyone tried turning off the checkbox for Main Menu under: Appearance> Theme (eg. Bartik Settings)> Toggle Display> Remove checkbox from "main menu". that worked for me. Good luck.
You can insert the Menu as a block and then use the Visibility > Roles settings to hide it for anonymous users.