View Full Version : Need a <if> conditional
raiderlax
08-08-2007, 09:48 PM
Hello I'm looking for a conditional where say I just want to show ads to registered users(doesn't make sense :)), and not anyone else, what would the <if> conditional be for this?
Also say I want to show ads to just admins, moderators, and registered users, what is the conditional for this?
Thanks in advance :)
HMBeaty
08-08-2007, 09:58 PM
The conditional to show it to your registered users is this:
<if condition="$show['member']"> </if>
raiderlax
08-08-2007, 10:01 PM
Thanks, would this only show it to "registered users" and no one else?
As well how would I show it to both registered users and admins?
Thanks so much :)
Attilitus
08-08-2007, 10:01 PM
<if condition="$bbuserinfo['usergroupid']==2">
CODE FOR REGISTERED USERS
</if>
Replace 2 with the usergroup id that you want to display the ads to. You can also use the <else /> condition like this:
<if condition="$bbuserinfo['usergroupid']==2">
Show if usergroup id is 2
<else />
Show if usergroup id is not 2
</if>
raiderlax
08-08-2007, 10:09 PM
Thanks Attilitus, so with the first code, say I want to display to both registered users and admins,
for the usergroupid, could i put ==2, 6"> ? to show to both admin/registered user?
and does this only show the add to the admin/registered user and no one else?
Thanks alot :)
HMBeaty
08-08-2007, 11:04 PM
That would be correct.
Darkwaltz4
08-08-2007, 11:45 PM
actually thats completely wrong :-p
what you want is...
<if condition="is_member_of($vbulletin->userinfo, X)">
members of that group only see this...
</if>
Where X is the usergroupid. You can also do more than one such as
is_member_of($vbulletin->userinfo, X, Y, Z..)
dont use the dots, but basically add more usergroup ids with commas
HMBeaty
08-08-2007, 11:57 PM
You can actually use either one, just the one you posted Darkwaltz4, also checks the secondary usergroup of the users
Darkwaltz4
08-09-2007, 01:44 AM
no what i meant by what is wrong, is what you said was right, this:
==2, 6">
is bad php :-p, and doesnt check multiple usergroups. at the very least it would need
$vbulletin->userinfo['usergroupid'] == X OR $vbulletin->userinfo['usergroupid'] == Y
or
in_array($vbulletin->userinfo['usergroupid'], array(X, Y))
:D
raiderlax
08-09-2007, 02:10 PM
Thanks guys, this is very useful!, now I have ads that I do not want to show to one usergroup, what would the conditional be to not show ads to this one usergroup?
Thanks so much :)
Andrew Green
08-09-2007, 03:24 PM
<if condition="!is_member_of($vbulletin->userinfo, X)">
Mikecp421
08-11-2007, 03:34 PM
is there a way to do this for a forum title in the forum manager? These conditionals won't work there for some odd reason
Darkwaltz4
08-11-2007, 06:56 PM
No. Phrase tags neither.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2024, vBulletin Solutions Inc.