Custom Profile Field display problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • oglsmm
    Member
    • Apr 2004
    • 46
    • 3.6.x

    Custom Profile Field display problem

    I have created a Multiple-Selection Menu profile field. I want to display the selection in the postbit, but with the code if have below:

    Code:
    <if condition="$post[field5]"><div class="info">Main Job : $post[field5]</div></if>
    This displays it ok, but it display's a number instead of the Selection they picked. (ie. If choice 8 was Truck Driver, it would display 8 in the postbit instead of "Truck Driver")

    Any idea on how i can correct this?

  • Jake Bunce
    Senior Member
    • Dec 2000
    • 46598
    • 3.6.x

    #2
    Multiple selection fields use a binary scheme to store the selected values, like this:

    option 1 = 2^0 = 1
    option 2 = 2^1 = 2
    option 3 = 2^2 = 4
    option 4 = 2^3 = 8
    option 5 = 2^4 = 16
    option 6 = 2^5 = 32

    If options 1 and 4 are selected then the stored value would be 1 + 8 = 9

    Parsing the stored value into a list of real values would require modifying the vBulletin files or creating template conditionals for every possible sum.

    Did you mean for users to be able to select multiple values at once? If not then I recommend you change the profile field to a single selection menu. Single selection menus store the actual selected value instead of a binary representation... meaning your current code would work.

    Comment

    widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
    Working...