View Full Version : Conditional Statement Help!
tommyxv
05-21-2006, 06:43 AM
Can someone give me an example conditional to wrap my google ads in?
I want to remove google ads for members that have a certain user-group as their secondary.
The way I have my current subscriptions set is No Change primary and secondary is whatever they subscribed to.
Some member might have 2 or 3 secondaries, BUT if one of them is the user-group that removes the ads, I would like no ads to show.
Can this be done?
peterska2
05-21-2006, 06:49 AM
<if condition="!in_array($vbulletin->userinfo['usergroupid'], array(5,6,7))">Google ads code</if>
replace 5,6,7 with the usergroup id's that you wish to not display the ads too.
tommyxv
05-21-2006, 07:03 AM
Hrrrm, didn't work.
Here is another example:
User "Test" belongs to primary usergroup ID 5 and secondary usergroups 8 & 9
Usergroup 9 is not suppose to see ads but 5 & 8 do. Can we keep ads from showing with his usergroups setup like that?
peterska2
05-21-2006, 07:10 AM
Ok, try this one
<if condition="is_member_of($bbuserinfo, 5) OR is_member_of($bbuserinfo, 6) OR is_member_of($bbuserinfo, 7)">something to display for these user groups like a thanks for subscribing message or something, or just <else />google adds code</if>
Again replace the numbers with the appropriate usergroup ids, and repeat as required.
tommyxv
05-21-2006, 07:18 AM
Boom...That worked! :banana:
Thanks M8!
peterska2
05-21-2006, 07:51 AM
no worries. Glad it works :)
Boofo
05-21-2006, 08:05 AM
Ok, try this one
<if condition="is_member_of($bbuserinfo, 5) OR is_member_of($bbuserinfo, 6) OR is_member_of($bbuserinfo, 7)">something to display for these user groups like a thanks for subscribing message or something, or just <else />google adds code</if>
Again replace the numbers with the appropriate usergroup ids, and repeat as required.
You should be able to do an array on that Kerry. ;)
peterska2
05-21-2006, 08:09 AM
You should be able to do an array on that Kerry. ;)
note post #2. We tried an array, but for some reason it didn't work, so we went for the long hand way and it worked.
Boofo
05-21-2006, 08:17 AM
But that first one was just for the primary usergroups. The second one includes secondary usergroups also. Unless I'm reading them wrong, which has been known to happen. ;)
peterska2
05-21-2006, 08:27 AM
You are probably right. :)
Freesteyelz
05-21-2006, 08:51 AM
Something like this:
<if condition="is_member_of($bbuserinfo, x, y, z)">
Google_ads_here
</if>
Kirk Y
05-22-2006, 10:40 PM
I'm trying to display an image for each user in their postbit, assuming they're in a specific usergroup.
I tried:
<if condition="is_member_of($bbuserinfo, 9)
But that only applies to the specific end-user -- not to each individual user's settings. Oh and the usergroup is a secondary usergroup, not a primary. Thanks in advance!
peterska2
05-22-2006, 10:56 PM
try userinfo not bbuserinfo
Freesteyelz
05-22-2006, 11:20 PM
I think I get what you're saying. Not sure but it's a Monday. :) If the above doesn't work then change it to "post" so it'll look like:
<if condition="is_member_of($post,x)">
postbit_code_here
</if>
It checks both primary and secondary Usergroups. You can add multiple Usergroups here (e.g., x, y, z). Change "x" to ID.
Basically the code states that if you're in Usergroup "x" then this code will show up for everyone to see. Unless, of course, you've set another conditional to allow only select groups to see it.
Kirk Y
05-23-2006, 01:28 AM
Ah-ha! That did it... I kept thinking of what other statement I should use, I tried $userinfo, that didn't work. Thanks though Freesteyelz.
Adrian Schneider
05-23-2006, 02:21 AM
$post contains the post/poster information
$userinfo contains the info of the user's profile you're viewing
$bbuserinfo contains the info for the current user
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.