• OzzModz is no longer taking registrations. All registrations are being redirected to Snog's Site
    All addons and support is available there now.

Template Conditionals For vB3 Series

Ozzy47

Administrator
I figured that it would come in handy to quite a few people especially those of us who code so much. I've had to refer back to this and the vB4 one several times myself.

Show only members:
Code:
<if condition="$show['member']">
    Show this to members only
</if>

Show only guest:
Code:
<if condition="$show['guest']">
    Show this to guest only
</if>

Show specific user groups :
Code:
<if condition="is_member_of($bbuserinfo, 1,2,3)">
    Show this to user group 1, 2, and 3
</if>

Show one member:
Code:
<if condition="$bbuserinfo['userid'] == 318713">
    Show this only to the member with the user id of 318713
</if>

Show every one but one member:
Code:
<if condition="$bbuserinfo['userid'] != 318713">
    Show this to every one but the member with the user id of 318713
</if>

Show only moderators of any forum:
Code:
<if condition="can_moderate()">
    Show this to all moderators
</if>

Show Moderator of one forum: Remember to change x
Code:
<if condition="can_moderate($forum['x])">
    Show this if moderator is moderator of the forum with the id of x
</if>

Show Moderator of current forum:
Code:
<if condition="can_moderate($forum['forumid'])">
    Show this to the moderator of the current forum
</if>

Show in one forum: Remember to change x
Code:
<if condition="$forum[forumid] == x">
    Show this if forum id is x
</if>

Show is every forum but one: Remember to change x
Code:
<if condition="$forum[forumid] != x">
    Show this if forum id is not x
</if>

Show in several forums:
Code:
<if condition="in_array($forum['forumid'], array(1,2,3))">
    Show this to forum 1, 2 and 3
</if>

Show in only one file: Look for define('THIS_SCRIPT', 'calendar'); in the top of the php file you want it to show in.
Code:
<if condition="THIS_SCRIPT == 'calendar'">
    Show this only on calendar.php
</if>

Show in every file but one: Look for define('THIS_SCRIPT', 'calendar'); in the top of the php file you do not want it to show in.
Code:
<if condition="THIS_SCRIPT != 'calendar'">
    Show this only on calendar.php
</if>

If $customvar is set:
Code:
<if condition="$customvar">
    Show this if $customvar is set
</if>

If $customvar equals:
Code:
<if condition="$customvar == blah">
    Show this if $customvar equals blah
</if>

If $customvar does not equal:
Code:
<if condition="$customvar != blah">
    Show this if $customvar does not equal blah
</if>

vBulletin else statement:
Code:
<if condition="$show['guest']">
    Show this to only guest.
<vb:else />
    Show this to all registered users
</if>

vBulletin else if statement:
Code:
<if condition="$show['guest']">
    Show this to only guest.
<vb:elseif condition="is_member_of($bbuserinfo, 5,6)" />
    Show this to user group 5 and 6 which is mods and admins
<vb:else />
    Show this to all registered users
</if>

This is all that I can think of right now off the top of my head.
 
Back
Top