On a Drupal 7 site, I created a login link on the main menu with the path user/login. For some reason, the link remains visible to users that are already logged in. I thought this link is supposed to automatically disappear when a user is logged in.

I also have a logout link that works correctly and only appears to users that are logged in.

Any ideas to get this working correctly?

EDIT: I went to /admin/structure/menu/manage/main-menu and added a new link. In the path field I entered "user/login."

closed as too broad by leymannx, kiamlaluno Aug 19 at 6:19

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • How did you create the login link? How did you create the logout link? How did you place them on your site? – leymannx Aug 17 at 19:06
  • I went to /admin/structure/menu/manage/main-menu and added a new link. In the path field I entered "user/login." – Finn Aug 17 at 19:30

The menu per role module does exactly like you want. It allows you to set a menu link to only be visible by a specific role, in this case anonymous users.

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