Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Smarty {if} statement to check if user is logged in
fr3em1nd
✭✭
Hi guys, i cant seem to find a documentation, if i put a smarty code inside the .tpl template, what's the syntax of doing so?
example:
**inside default.master.tpl i'd like to have something visitors(not logged in users) to see
{if not $User="loggedin"}
<show this to the logged in >
{/if}
0
Comments
search any you will find
http://vanillaforums.org/discussion/22597
grep is your friend.
For a list of all Smarty variables, enable debug mode:
{debug}
Kasper Kronborg Isager (kasperisager) | Freelance Developer @Vanilla | Hit me up: Google Mail or Vanilla Mail | Find me on GitHub
thanks @kasperisager
@kasper: I know this thread is not the newest but i have a question about it.
The Smarty Tags work for the mobile version under 2.0.18.10, but not under the desktop theme. Any ideas why this could be the reason?
Thanx
Which tags specifically?
Kasper Kronborg Isager (kasperisager) | Freelance Developer @Vanilla | Hit me up: Google Mail or Vanilla Mail | Find me on GitHub
{if $User.SignedIn}{/if} works for me in the mobile theme but not the desktop?
I guess i should try with: {if $User="loggedin"} ?
Try adding
{debug}
and let me know what it spits outKasper Kronborg Isager (kasperisager) | Freelance Developer @Vanilla | Hit me up: Google Mail or Vanilla Mail | Find me on GitHub
Is your desktop theme tpl? or php ?
❌ ✊ ♥. ¸. ••. ¸♥¸. ••. ¸♥ ✊ ❌
$User.SignedIn
should work, so you should take a look at the{debug}
output that Kasper mentioned.In Vanilla 2.0.18.10, the default master template is a PHP file.
If the theme's view file is a PHP file, you can check the user's logged in status with:
If the theme's view file is a TPL file, please try the user name variable to see if it works:
Add Pages to Vanilla with the Basic Pages app
Thank you for your help @Shadowdare. That was, what i was looking for.
Wonder if there is a reason why this is not managed the same way for both template options (desktop and mobile).
It could be it is matter of choice, you can use a php based mobile theme too along with your desktop php theme. Or you can use both tpl based themes, or use the embed friendly tpl or php.
It is about what you want to use. Either or is good.
❌ ✊ ♥. ¸. ••. ¸♥¸. ••. ¸♥ ✊ ❌