ctuxboy Hello, In the bottom off my website trying add a 'login' OR 'logout' link: <@ if @{ ?context=edit_page } @> <a href="/dashboard?context=logout>Logout</a> <@ else @> <a href="/dashboard>Login</a> <@ end @> But this doens't work. How can i solve that?
ctuxboy Update: Trying also the statement 'with' instead 'if': <@ with "/context=edit_page" @> ... Doesn't work!
mad ctuxboy Hi, you can check the user name. That's only possible with a little bit of PHP: <@ set { ":user": "<?php echo \Automad\GUI\User::get(); ?>"} @> <@ if @{ :user } @> <a href="/dashboard?context=logout">Log out</a> <@ else @> <a href="/dashboard">Log in</a> <@ end @> ?
michaelis Hey, Strange, the code produces and Uncaught Error. Class "Automad\GUI\User" not found. Is this still working, or are there changes due to a new version? Thanks for help.
mad michaelis Hi, yes there have been some changes. However, since that is not part of an official API it could change again in the future. The best solution would be to check what the method in question is supposed to do and implement that separately.
michaelis Hey Mad, thanks for the quick reply. Yes, i realized to late that the post is from 2018. However ist is possible to check for the active user in the php session.