Navigation: Automatic Login, Logout & Register Items
Created 6 years ago by finnitoHey 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!
You will want to use the
allowed groups
and allow onlyguest
for the login/register and only youruser
group for the other ones. You can also use this technique with the pages module.