Hi,

Just a quickie.

I would like to hide the main menu from anonymous users.

I saw the block "main menu" is available so I tried changing the permissions on this block but that did not work.

Please can someone shed some light on this.

Many thanks.

Shaun

Comments

dRaz’s picture

No bother, managed it :)

I made the following changes to page.tpl.php:

    <?php if ($page['header']) : ?>
      <?php print drupal_render($page['header']); ?>
    <?php else : ?>
    <?php  if ($main_menu && user_is_logged_in()): ?>
      <div id="main-menu" class="navigation">
        <?php print theme('links__system_main_menu', array(
          'links' => $main_menu,
          'attributes' => array(
            'id' => 'main-menu-links',
            'class' => array('links', 'clearfix'),
          ),
          'heading' => array(
            'text' => t('Main menu'),
            'level' => 'h2',
            'class' => array('element-invisible'),
          ),
        )); ?>
      </div> <!-- /#main-menu -->
    <?php endif; ?>
   <?php endif; ?>

i.e added lines 4 and 20

Hope this helps someone :)

shadcn’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.