View Full Version : Profile field in condition?
ultranerds
04-26-2005, 03:46 PM
Hi,
I've added a new profile field for the forum users. It looks like;
Amazon.co.uk Search Box Single-Selection Menu Editable field14 [Edit] [Delete]
Its basically a yes/no select-box option, which is shown on the user profile page.
I'm basically trying to do something like;
<if condition="$bbuser['amazon_profile'] ne "No">
.. show amazon code
</if>
Is this possible?
TIA
Andy
Cyricx
04-26-2005, 04:46 PM
Certainly is, I use it a TON on the forumhome page as I have quite a few hacks in there so it lets people disable the ones they don't want to see :)
<if condition="$bbuserinfo[field14] == 'No'">
your amazon code
</if>
Notice the no IS case sensitive, so if you typed in for them to select from yes or no, you'll need to change the above to 'no'
ultranerds
04-27-2005, 08:31 AM
Hi,
Thanks for the reply :)
However, it doesn't seem to be working :'(
I have;
field: $bbuserinfo[field14] <br>
..which prints;
field:
The code looks like;
<if condition="$bbuserinfo[field14] == 'Yes'">
... in "navbar".
Do I need to do anything special to load the user options?
Also, may be pushing my luck here <G>
Can anyone point me in the right direction, so I can do something like this with the nav bar;
<if condition=IS_TOP>
... show one type of code
</if>
<if condition=IS_BOTTOM>
... show another type of code
</if>
Basically, I want to try and put 2 different codes on each page. One for the top navbar, and the other for the bottom one.
TIA :)
Andy
Cyricx
04-27-2005, 11:14 AM
So what your trying to do is create a yes/no radio button that users select what kind of navbar they see?
ultranerds
04-27-2005, 11:38 AM
Hi,
Not really.
I need a Yes/No option for the users, in their profile (which I have), and then a condition to see if the user option has been set, and show accordingly. If no option is set.. then it show the amazon search code :)
To keep things simpler, I'll leave the other part until I've got this working <G>
Cheers
Cyricx
04-27-2005, 02:41 PM
This is a Single selection menu or Radio?
If it's a single selection, double check whether you have them selecting from
yes
no
or
Yes
No
The If statement IS case sensitive.
If it's a radio, you'll need to use 0 or 1 if I recall right.
ultranerds
04-27-2005, 02:45 PM
Hi,
Its definatly a Single-Select dropdown, with Yes/No as the values. Seems really weird that it doesn't seem to show up ... yet its obviously being set in their profile, as it gets selected ok when changed (i.e if they edit their profile).
Is there a way to "dump" a list of the values/names of the info held in $bbuserinfo? Maybe a "foreach () "? That may be an easier way, so I can at least see if the value exists there, or whether it needs to be created somehow =)
TIA
Just put this together;
<?php
foreach ($bbuserinfo as $field => $value) {
echo "$field => $value <br>";
}
?>
Theoretically, this should give me all the values held in $bbuserinfo. Does anyone know where abouts I would put this? I guess PHP code isn't directly allowed in the templates?
TIA
Cyricx
04-27-2005, 03:59 PM
On a hunch, try a 0 or a 1 instead of Yes or No
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.