View Full Version : <if> code help
SVTCobraLTD
02-16-2009, 11:42 PM
I am trying to get this code to work. The example below I know is incorrect but I need it fixed so I do not have tons of lines of IF commands.
<if condition="$post[usergroupid] == X, X, X, X and is_member_of($post, X, X, X, X )"><img src="images/misc/airforce.gif"></if>
TigerC10
02-17-2009, 03:00 AM
So you want the airforce.gif image to display in the postbit if the poster is in a certain set of groups?
Try:
<if condition="is_member_of($post[usergroupid], X, X, X, X )"><img src="images/misc/airforce.gif"></if>
Dismounted
02-17-2009, 04:43 AM
Fixed up the image tag, as well as the conditional:
<if condition="is_member_of($post, X, X, X, X)"><img src="images/misc/airforce.gif" border="0" alt="" /></if>
vbplusme
02-17-2009, 05:26 AM
TigerC10, "So you want the airforce.gif image to display in the postbit if the poster is in a certain set of groups?" good guess at problem description." I wasn't sure what he was trying to do.
Fixed up the image tag, as well as the conditional:
<if condition="is_member_of($post, X, X, X, X)"><img src="images/misc/airforce.gif" border="0" alt="" /></if>
Nice, I suspected he was using the wrong conditional. This is clean and tidy.
Good work. thanks for the lesson.
SVTCobraLTD
02-17-2009, 10:34 AM
What I need is the member is part of a main usergroup but ALSO the member is part of a secondary member group (air force) then that image will display for them.
bananalive
02-17-2009, 06:26 PM
<if condition="$post[usergroupid] == B && is_member_of($post, X)"><img src="images/misc/airforce.gif"></if>
So the primary usergroup has to be 'B' and X must be secondary usergroup (air force).
SVTCobraLTD
02-17-2009, 08:44 PM
<if condition="$post[usergroupid] == B && is_member_of($post, X)"><img src="images/misc/airforce.gif"></if>
So the primary usergroup has to be 'B' and X must be secondary usergroup (air force).
But I am in need of it to work with multiple primary usergroups. So if the user is part of primary usergroup 2, 3, 4, 5, 6 or 7 and their secondary group is 8, then it will show the image.
Right now I have the code, like I posted in my first post, repeated over and over again changing the primary usergroup number each time. I figure there has to be a way to condense this code.
UncoderMom
02-17-2009, 09:45 PM
Why not just use the Vb rank system? LOL
AdminCP>user ranks>add new user rank.
I never change my users primary user group from registered. If they are VIP or Mods, their status is secondary and the icon ranks for secondary show up just fine :) Including multiple group rank images. Even through vb promotions.
HTH
Lynne
02-18-2009, 12:16 AM
Maybe....
<if condition="in_array($post[usergroupid], array(2,3,4,5,6,7)) && is_member_of($post, 8)"><img src="images/misc/airforce.gif" border="0" alt="" /></if>Or, as Lisa suggested, use Ranks.
Dismounted
02-18-2009, 05:58 AM
You may want to choose to exclude some usergroups, instead of include (if there are less "other" usergroups).
SVTCobraLTD
02-18-2009, 01:08 PM
Thanks Lynne as usual!
vBulletin® v3.8.12 by vBS, Copyright ©2000-2024, vBulletin Solutions Inc.