This, for example, would be disallowed by the vBulletin template system, as it contains a call to a 'forbidden' function: mysql_query.
<vb:if condition="$my_variable = mysql_query('SELECT * FROM mytable')"> <!-- naughty naughty... --> </vb:if>
- in_array
- is_array
- is_numeric
- isset
- empty
- defined
- array
- can_moderate*
- can_moderate_calendar*
- exec_switch_bg*
- is_browser*
- is_member_of*
Note:
Functions marked * are custom functions defined by vBulletin itself. Each function name is a link that will take you to the documentation for that function. Use of these functions requires knowledge of PHP
<vb:if condition="isset($my_variable) AND is_browser('ie')"> <!-- $my_variable is set and the browser is Internet Explorer --> </vb:if>
[code]<if condition="is_member_of($bbuserinfo, 6)">foo</if>[/code]
The first variable is the users userinfo (if the user surfing is meant, use $bbuserinfo), the second variable is the usergroup that member has to belong to, for the condition to return true.
Both primary and additional usergroups are searched.
Edit:
Some useful variables to use in a conditional to check against a user's permissions are:
$show['admincplink']
$show['modcplink']
$show['member']
$show['guest']
Hook name: template_safe_functions
Hook code:
$safe_functions[] = 'htmlspecialchars';
$safe_functions[] = 'rawurlencode';
// etc...
Usage:
<if condition="$html_username=htmlspecialchars($username)"></if>
<if condition="$url_username=rawurlencode($username)"></if>
<a href="/users/?id=$url_username">$html_username</a>
i was searching how to check whether the loggedin user is admin or not.I used the code given by Colin..
Thanks a lot and lot it worked very well.....
Sarita Sharma
My first use is to register the PHP Rand() function so I can have various bits of the interface appear only occasionally to both create interest and reduce load times.
Thanks!