xen syntax in scripts

tehMorag

Member
Hey there,
Been trying my hand at make my own addons for my site.
I have found that if I want to read/write info from a database in a php script (XenForo or external), I need to use the <xen:callback> tag in the templete

What I am currently trying to do is get xen syntax working in on of these scripts. The main one I am trying to make is limit the visablilty of a few things to admin/mods only.
I would normally use <xen:if is="{$visitor.is_admin} OR {$visitor.is_moderator}"> but it isnt working.

Will I have to call the usergroup via php instead of using xen syntax or is there a way to be able to use the syntax in php scripts... Anything that could help me out here?

Thanks!
 
To get the visitor object in PHP:
PHP:
$visitor = XenForo_Visitor::getInstance();

Usage:
PHP:
if ($visitor->is_admin || $visitor->is_moderator)
{
    // Do stuff here
}
 
To get the visitor object in PHP:
PHP:
$visitor = XenForo_Visitor::getInstance();

Usage:
PHP:
if ($visitor->is_admin || $visitor->is_moderator)
{
    // Do stuff here
}
Awesome thank you!
Is there a resource that I am missing that has a list of calls?
I can see that the IF statement is easily translatable but does this work for the rest of the xen template commands?
 
Some, but not all.

The best resource is the XenForo code, or you know, just ask here if there's anything you're unsure about or can't find :)
 
Top Bottom