Templates, USER variables and hiding content from guests
I have a bit of a dilemma trying to have part of a template adapt based on if somebody is logged in or not. I want to include a preformated link to create a particular kind of wiki page to logged in users only, and skip over the link when viewing as a guest.
I thought it would just be a simple matter of using this in an if condition:
However, using this directly inside the [IF= .... doesn't work at all (probably due to the nested square brackets?).
So next I tried moving this part of the template into a separate (child) template, and now I can get a person's user id (0 for guest). The issue is this always seems to be validated as true. This means a condition check for !=0 or >1 will be true regardless of whether the ID is 12345 or 0.
Code:
in parent template: [template]name-of-child-template|userid=[var]USER|id[/var][/template]
in child template: [if="{{{userid|}}}>0"]code to run[/if]
Is there a more reliable way of determining if someone is logged in, within a wiki template page?
If not, I should be able to hide the link using XenForo's .LoggedOut CSS class.