Hope you all people are enjoying your good health!
I am newbie to PyroCMS and I am facing issue with displaying Login and Logout links on the basis of User session. I tried hard to google to get help about this but could find proper help.
{ if'{session:data name="user_id" != "" }'}
<li><a href="{{url:base}}users/logout">logout</a></li>
{/else}
<li><a href="{{url:base}}users/login">log in</a></li>
{/if}
It is not working. Please help me to fix this issue!
Thank You.
PyroCMS has a tag specifically for checking if a user is already logged in. Try something like this:
{{ if user:logged_in }}
<a href="{{ url:site uri='users/logout' }}">Logout</a>
{{ else }}
<a href="{{ url:site uri='users/login' }}">Login</a>
{{ endif }}