• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Xenforo Expressions

=MGN=RedEagle

Well-known member
#1
Hi there,

I am a PHP noob trying to learn how to customize Xenforo a little bit. I am playing around with what I think are expressions:

$visitor['user_id'] > 0

How can I find a list of such expressions?
 

=MGN=RedEagle

Well-known member
#3
Aha! Yes, seems like what I am looking for. It seems BD widget framework leverages this. It has an area called "Expressions" and leaves a blank space. Then it gives the hint:


Enter your expression here. Please use the correct PHP syntax and make sure you know 100% which variables are available in target position. For template position, all template parameters will be accessible but for hook position, only hook parameters will be accessible. Some common used expressions:

$visitor['user_id'] > 0 -- means: show the widget for logged in users only.

XenForo_Template_Helper_Core::callHelper('ismemberof', array($visitor,3)) -- means: show the widget for users of user group #3 only.


Does Xenforo have a list of commonly used expressions?
 

Brogan

XenForo moderator
Staff member
#4
Conditional statements are for use in HTML templates.
The syntax is completely different from PHP.

There is no commonly used list as PHP code isn't generally used outside of PHP files, by developers.