PDA

View Full Version : Conditionals


bpat1434
05-01-2008, 07:04 PM
Hi all. I'm new to this vB skinning thing and I have a question. Is it possible to limit if something (like ad sections) are shown based on a usergroup?

I.e.: If a user pays for a subscription to my forum, I'd like to remove the ads; however, they should be visible to everyone else that's not in the "subscriber" group.

Is this possible? And if so, how?

Lynne
05-01-2008, 07:31 PM
In the template, put this code around the ad:
<if condition="!is_member_of($bbuserinfo, x)">
Ad for users not in in usergroupid x
</else>
Stuff for users in all other usergroups
</if>Without an else:
<if condition="!is_member_of($bbuserinfo, x)">
Ad for users not in in usergroupid x
</if>

bpat1434
05-01-2008, 07:52 PM
Thanks for your help. I figured it would be something as easy as that.

Is the "X" the usergroup ID?

Lynne
05-01-2008, 08:32 PM
Thanks for your help. I figured it would be something as easy as that.

Is the "X" the usergroup ID?
Whoops, yes, the x is the usergroup id.

HybridIllusions
05-01-2008, 09:40 PM
If this doesn't work, another way would be:

<if condition="$bbuserinfo[usergroup] = X">

Replace the X with the number ID of the usergroup.

bpat1434
05-02-2008, 02:03 AM
What about multiple conditions? I.e. can I use the typical php operator "||" and "&&" to make:

<if condition="!is_member_of($bbuserinfo, 26) || !is_member_of($bbuserinfo, 6)">
<!-- Ad Code -->
</if>

I.e. If they're not a member of "subscriptions" or "admin" then show the ads.

Boofo
05-02-2008, 02:05 AM
<if condition="!is_member_of($vbulletin->userinfo, 6,26)">

bpat1434
05-02-2008, 02:07 AM
Well that was easy!

Boofo
05-02-2008, 02:24 AM
It usually is. ;)