vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   Display custom field in memberlist that contains multiple selections. (https://vborg.vbsupport.ru/showthread.php?t=260867)

AFemaleProdigy 11-28-2011 04:17 AM

Okay, you were right about the numbers. Some were wrong. I updated the numbers though and it still didn't do anything. I tried using == like you said and that didn't work. Did I do it like you were thinking... ?

Code:

<vb:if condition="$userfield['field23'] == 1">
                            Unknown
                            <vb:elseif condition="$userfield['field23'] == 2" />
                            No Food
                            <vb:elseif condition="$userfield['field23'] == 4" />
                            Breakfast
                            <vb:elseif condition="$userfield['field23'] == 8" />
                            Lunch
                            <vb:elseif condition="$userfield['field23'] == 16" />
                            Dinner
                            <vb:elseif condition="$userfield['field23'] == 32" />
                            Snacks
                            </vb:if>


kh99 11-28-2011 05:25 AM

OK, I went back and read the above posts again, and since it's multiple selection, I think you do want to use '&'. And are you sure $userfield is what you want to check? You might want $bbuserinfo[field23] (assuming this is displaying the data to the user who selected it, and not to another user (like an admin or someone).

Also, like you mentioned in an earlier post, since it's possible to have multiple options selected you don't want to use elseif, you would just want a bunch of if statements, like:

Code:

<vb:if condition="$bbuserinfo['field23'] & 1">Unknown </vb:if>
<vb:if condition="$bbuserinfo['field23'] & 2">No Food </vb:if>
<vb:if condition="$bbuserinfo['field23'] & 4">Breakfast </vb:if>

etc.

AFemaleProdigy 11-28-2011 09:18 PM

This output will be shown to any usergroup type viewing it on a public profile and also in the custom member list I created. It is not meant to show the viewer their own personal selections, but to show the viewer the selection of whoever's profile they are viewing.

kh99 11-28-2011 09:25 PM

In that case you don't want to use $bbuserinfo, of course.

AFemaleProdigy 11-28-2011 09:54 PM

So this does not work either. Any ideas?

Code:

<vb:if condition="$userfield['field23'] & 1">
                            Unknown
                            <vb:elseif condition="$userfield['field23'] & 2" />
                            No Food
                            <vb:elseif condition="$userfield['field23'] & 4" />
                            Breakfast
                            <vb:elseif condition="$userfield['field23'] & 8" />
                            Lunch
                            <vb:elseif condition="$userfield['field23'] & 16" />
                            Dinner
                            <vb:elseif condition="$userfield['field23'] & 32" />
                            Snacks
                            </vb:if>


kh99 11-28-2011 10:06 PM

Should have asked this from the start, but which template are you putting that in?

AFemaleProdigy 11-29-2011 02:51 AM

It is going in the template memberinfo_block_aboutme

kh99 11-29-2011 03:09 AM

Then I think you want this:

Code:

<vb:if condition="$userinfo['field23'] & 1">Unknown </vb:if>
<vb:if condition="$userinfo['field23'] & 2">No Food </vb:if>
<vb:if condition="$userinfo['field23'] & 4">Breakfast </vb:if>
etc


AFemaleProdigy 11-29-2011 12:54 PM

When I try to save the template with that, I get an error that says "adding child to non-existent node!".

Code:

<vb:if condition="$userinfo['field23'] & 1">
                            Unknown</vb:if>
                            <vb:if condition="$userinfo['field23'] & 2" />
                            No Food</vb:if>
                            <vb:if condition="$userinfo['field23'] & 4" />
                            Breakfast</vb:if>
                            <vb:if condition="$userinfo['field23'] & 8" />
                            Lunch</vb:if>
                            <vb:if condition="$userinfo['field23'] & 16" />
                            Dinner</vb:if>
                            <vb:if condition="$userinfo['field23'] & 32" />
                            Snacks</vb:if>


kh99 11-29-2011 01:05 PM

I think you need to take the '/'s out of the <vb:if... tags, like this:

Code:

<vb:if condition="$userinfo['field23'] & 1">
                            Unknown</vb:if>
                            <vb:if condition="$userinfo['field23'] & 2" >
                            No Food</vb:if>
                            <vb:if condition="$userinfo['field23'] & 4" >
                            Breakfast</vb:if>
                            <vb:if condition="$userinfo['field23'] & 8" >
                            Lunch</vb:if>
                            <vb:if condition="$userinfo['field23'] & 16" >
                            Dinner</vb:if>
                            <vb:if condition="$userinfo['field23'] & 32" >
                            Snacks</vb:if>



All times are GMT. The time now is 01:53 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.00994 seconds
  • Memory Usage 1,746KB
  • 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
  • (6)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete