Simplify your Template Conditionals
by
06 Dec 2004
If you want to be able to show/hide things in your templates based on Usergroups, you can either use something like: Code:
<if condition="$bbuserinfo['usergroupid'] == '9' || $bbuserinfo['usergroupid'] == '10' || $bbuserinfo['usergroupid'] == '11'"> Code:
<if condition="in_array($bbuserinfo[usergroupid], array(9,10,11))"> Wouldn't it be easier to be able to use: Code:
<if condition="is_paid_member()"> Well now you can! In includes/functions.php, find: PHP Code:
// ###################### Start build datastore #######################
PHP Code:
function is_paid_member($usergroupid = 0) // replace is_paid_member with your new function/condition
PHP Code:
// vBulletin-defined functions
PHP Code:
'is_paid_member', // function to check if $user is member of paid member groups
Save and upload includes/functions.php and adminfunctions_template.php and you are done. You can now wrap Code:
<if condition="is_paid_member()"></if> Hoorah! |