![]() |
Display custom field in memberlist that contains multiple selections.
Yep, it's me again. ;)
I have been using the code below to display custom fields in my new custom memberlist. It's been working great so far, but I just realized it doesn't work like I intended when the custom field values are from a multiple selection check box. Code:
{vb:raw userinfo.field17} Example: User can select any number of the following - Snacks, Breakfast, Lunch, Dinner So if they check Breakfast and Dinner, that is what I want the output to be in my template. Instead, the code above will output the number assocciated with that option. Thanks! :D |
Custom Fields with more than one option are sorted based on the geometric formula. Meaning You would do something like this:
Userfield6(Radio, Select, Checkbox it doesn't matter) Yes(1) No(2) Maybe(4) Never(8) PHP Code:
so to continue it would be 1,2,4,8,16,32,64 etc.. |
I checked the values in the databse to make sure I had them correct, but this doesn't seem to work. My template is still outputting numbers instead of text values.
PHP Code:
Code:
{vb:raw userinfo.field23} |
I didn't convert it to template format
Something like this: <vb:if condition="$userfield['field23'] & 1"> Yes <vb:elseif condition="userfield['field23'] & 2"> No <vb:endif> |
I am using this in my template and am getting an error when I try to save the template. Can anyone see a problem with this?
Code:
<vb:if condition="$userfield['field23'] & 1"> The following error occurred when attempting to evaluate this template: %1$s This is likely caused by a malformed conditional statement. It is highly recommended that you fix this error before continuing, but you may continue as-is if you wish. |
All your condition expressions except the first one are missing the $ in front of "userfield".
|
I can't believe I didn't see that!! Lol!
However, I was finally able to save the template changes, but that code is not outputting anything. Grrr! This is what I have... Code:
<vb:if condition="$userfield['field23'] & 1"> |
It might help to temporarily output the value of $userfield['field23'] to see what's going on.
That seems like a strange set of bits to check (normally they'd be 1, 2, 4, 8, 16, 32, 64, etc), but I don't know exactly how they're being used so what you have could be correct. |
I got those numbers from the database. They may have skipped around from me deleting and adding options. How can I temporarily output the values?
|
Quote:
Quote:
|
All times are GMT. The time now is 02:02 PM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|