View Full Version : If Profile Field Then Do Action
TheInsaneManiac
02-04-2009, 02:59 AM
Ok, so basically what I got here is a dropdown profile field. If a member selects something specific from this profile field I want something to be displayed.
So if the profile field says "Red" I want certain things to be in red.
So like:
<if condition="$bbuserinfo[field1]" == red>
<font color="red">
$content
</if>
</font>
Lynne
02-04-2009, 03:13 AM
The variable to use depends on what page/template you are trying to use it in and who the variable relates to - the person viewing the page or the page/post of another user?
TheInsaneManiac
02-04-2009, 03:22 AM
The variable to use depends on what page/template you are trying to use it in and who the variable relates to - the person viewing the page or the page/post of another user?
I want it so that any user who selects red via their usercp will see a certain page in red.
Lynne
02-04-2009, 03:50 AM
Then $bbuserinfo is probably the correct variable to use.
TheInsaneManiac
02-04-2009, 04:13 AM
So I have it set up correctly? Should red be in quotations?
Example:
<if condition="$bbuserinfo[field1]" == "red">
Lynne
02-04-2009, 04:17 AM
single quotes.
<if condition="$bbuserinfo[field1] == 'red'">
Dismounted
02-04-2009, 04:48 AM
Always better to quote array keys in conditionals (and you can and should use the identical operator, as it is faster).
<if condition="$bbuserinfo['field1'] === 'red'">
TheInsaneManiac
02-04-2009, 05:13 AM
Sweet thanks!
Always better to quote array keys in conditionals (and you can and should use the identical operator, as it is faster).
<if condition="$bbuserinfo['field1'] === 'red'">
Huh?
Dismounted
02-04-2009, 05:19 AM
I was just posting optimisations to the original code posted.
TheInsaneManiac
02-04-2009, 11:01 AM
I was just posting optimisations to the original code posted.
I see, well thanks to both of you. :D
Lynne
02-04-2009, 02:36 PM
Always better to quote array keys in conditionals (and you can and should use the identical operator, as it is faster).
<if condition="$bbuserinfo['field1'] === 'red'">
Always learning new things..... :)
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.