finnlesueurgmailcom - 4 months ago

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!

Answer

ryanthompson - 4 months ago

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.

ryanthompson - 4 months ago

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.

finnlesueurgmailcom - 3 months ago

Nice yep got it! Thanks!