Report reply mrc 0 Posted November 18, 2020 Wondering how to use the magic menus to link to a URL based on whether the user is logged in. In a magic menu, I have: {{$member=\IPS\Member::loggedIn();}} {{if ($id>0)}} LINK1 {{else}} LINK2 {{endif}} How do I send a redirect to the correct page/link within the template logic? Or do I use a Magic Menu at all? Is there a different way to do this? Thanks! Quote Share this comment Link to comment
Report reply Michael 263 Posted December 1, 2020 you are on the right track, you just need to write the html yourself for it: {{if \IPS\Member::loggedIn()->member_id}} <a href="foo.html">Logged In</a> {{else}} <a href="foo2.html">Logged Out</a> {{endif}} Quote Share this comment Link to comment
Report reply mrc 0 Posted December 1, 2020 Thanks @Michael I should have been more clear, however. Instead of displaying the link based on logic, I just want to send them there onclick. I'm looking how to write the code so that when the user clicks on the actual menu, they are directed to a particular link. So if they are logged in, the JOIN menu item click sends them to PAGE01 and if not logged in, a menu clicks sends them to PAGE02 Thanks Quote Share this comment Link to comment
Report reply Michael 263 Posted December 1, 2020 well then the magic menu isn't what you want. the magic menu will create a sub menu so you can create a customize sub menu outside of what mgm offers. you can create two menu items instead, and set one to have permissions only for guest and the other one for actual groups. Quote Share this comment Link to comment
Report reply mrc 0 Posted December 1, 2020 Excellent, thank you @Michael Quote Share this comment Link to comment
Report reply Guest Posted December 15, 2020 Changed Status from Pending to Closed Quote Share this comment Link to comment