Navigation: Automatic Login, Logout & Register Items
Created 6 years ago by finnito

Hey all, I want to be able to automatically show "Login" and "Register in the navigation when a user is not logged din, and only show "Logout" when the user is logged in.

I note that using the menu() function doesn't seem to allow you to conditionally insert menu items using auth_check() (for example) and therefore I'm not sure about how to proceed. Here is what I am currently doing:

{{ menu("Header") .activeClass("current") .render()|raw }}

Thanks!

ryanthompson  —  6 years ago Best Answer

You will want to use the allowed groups and allow only guest for the login/register and only your user group for the other ones. You can also use this technique with the pages module.

finnito  —  6 years ago

Nice yep got it! Thanks!