vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=251)
-   -   Custom Profile Field Multiple Selection Checkbox (https://vborg.vbsupport.ru/showthread.php?t=278122)

Abhik 02-06-2012 01:07 PM

Custom Profile Field Multiple Selection Checkbox
 
Hello,
I have a multiple selection checkbox user field where I have 10 options. I have limited maximum 5 options can be checked.

Now, I want to show only the checked options (even if the number of checked options are below 5) in postbit. How can I do that?

Code:

<vb:if condition="$post['field9'] & 1">Option 1</vb:if>
<vb:if condition="$post['field9'] & 2">Option 2</vb:if>
<vb:if condition="$post['field9'] & 3">Option 3</vb:if>
<vb:if condition="$post['field9'] & 4">Option 4</vb:if>
<vb:if condition="$post['field9'] & 5">Option 5</vb:if>
<vb:if condition="$post['field9'] & 6">Option 6</vb:if>
<vb:if condition="$post['field9'] & 7">Option 7</vb:if>
<vb:if condition="$post['field9'] & 8">Option 8</vb:if>
<vb:if condition="$post['field9'] & 9">Option 9</vb:if>
<vb:if condition="$post['field9'] & 10">Option 10</vb:if>

That seems to return the options randomly even if the option is not checked.

kh99 02-06-2012 01:11 PM

Each option corresponds to one bit, so each mask you '&' with the value has to be a single bit. So the mask values should be 1, 2, 4, 8, 16, 32, 64, 128, 256, 512.

Lynne 02-06-2012 05:35 PM

See this - Using your User Profile Fields in your postbit templates (w/ all plugin method)


All times are GMT. The time now is 03:57 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
  • Page Generation 0.01321 seconds
  • Memory Usage 1,713KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (3)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete