1

Possible Duplicate:
Hiding link from anonymous users

I have 2 nodes on Drupal 7 site, that only authenticated users can access. But even if I logout, links to these nodes appear in the main menu. When I click any of them, it gives:

Access denied 
You are not authorized to access this page.

Which is correct. As far as I know, Drupal must hide the links, that the user can't access. But for these items it doesn't.

How to fix?

enter image description here

marked as duplicate by mpdonadio Nov 2 '12 at 12:42

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    Please check if answers for this question helps you. – GoodSp33d Nov 2 '12 at 11:52
3

Follow Below things:

1) Make sure that in admin/people/permissions "View published content", "view own Unpublished Content are "Unchecked" for the "anonymous user".

2) Still if you are getting those "Disclaimer and Policies" menu links. i) Create a new menu and add those links in to that menu. While adding links Give the Parent menu link to "Main Menu". and save the menu. ii) Then admin/structure/block, configure the menu block: Give the permission to access only to Authenticated User and save the block

0

It's definitely a bug in Drupal core. It shouldn't give links, the user doesn't have access to.

I fixed it, using the programming in page.tpl.php in my theme, adding if($user->uid != 0):

<?php
      global $user;
      if($user->uid != 0)
      {
             if ($main_menu):
?>
      <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;
      }
 ?>
  • Its not a bug actually. It depends on the scenario/requirements. – GoodSp33d Nov 2 '12 at 13:17

Not the answer you're looking for? Browse other questions tagged or ask your own question.