View Full Version : multiple selection custom profile field in postbit
restless
01-19-2004, 10:45 PM
i've been trying to add a multiple-selection profile field for "Sex" with the options, "boy", "girl" and "yes, please." to my postbit.
i know how to add a custom field to the postbit, but the multiple-selection thing is putting "1", "2" or "3" in the postbit instead of the actual option names.
Gary King
01-20-2004, 01:31 AM
Okay, what variable are you using right now for displaying the field which gives you 1, 2 or 3?
Also, exactly what type of profile field is the Sex one?
restless
01-20-2004, 09:16 PM
<b>Sex:</b> $post[field10]
it's a multiple-selection checkbox.
Gary King
01-20-2004, 10:46 PM
You have to unserialize the field, etc. in order to get the proper answer. Maybe someone could help you out with this as I don't have the time to do this at the moment, although it shouldn't take too long to do for most coders :)
Cassidy
01-21-2004, 02:20 AM
If your using RC1 or 2:
Change your custom user profile field to: "Yes, including a first blank option" ALSO make sure it's editable by the user.
Then in your postbit (or Postbit legacy) put the code:
Sex: <if condition="$post[field99]">$post[field99]</if>
Probebly above 'Rank' would be best.
Change all the "field99" to the number of the profile field. For example if it's 'Biography' it would be profile "field1". And that should work for you.
Gary King
01-21-2004, 02:25 AM
If your using RC1 or 2:
Change your custom user profile field to: "Yes, including a first blank option" ALSO make sure it's editable by the user.
Then in your postbit (or Postbit legacy) put the code:
Sex: <if condition="$post[field99]">$post[field99]</if>
Probebly above 'Rank' would be best.
Change all the "field99" to the number of the profile field. For example if it's 'Biography' it would be profile "field1". And that should work for you.
That option isn't available for this profile field type.
restless
01-24-2004, 12:45 AM
anyone? :nervous:
Princeton
01-24-2004, 01:27 AM
use
<if condition="$userinfo[field99]==1">$vbphrase[boy]</if>
<if condition="$userinfo[field99]==2">$vbphrase[girl]</if>
<if condition="$userinfo[field99]==3">$vbphrase[yes_please]</if>
Gary King
01-24-2004, 01:53 AM
use
<if condition="$post[field99]==1">$vbphrase[boy]</if>
<if condition="$post[field99]==2">$vbphrase[girl]</if>
<if condition="$post[field99]==3">$vbphrase[yes_please]</if>
No, it won't work. The values are stored in bitwise format.
Princeton
01-24-2004, 02:22 AM
sorry, it should be $bbuserinfo not $post
restless
01-24-2004, 02:29 AM
use
<if condition="$bbuserinfo[field99]==1">$vbphrase[boy]</if>
<if condition="$bbuserinfo[field99]==2">$vbphrase[girl]</if>
<if condition="$bbuserinfo[field99]==3">$vbphrase[yes_please]</if> i tried this, and everyone is listed as "boy".
restless
01-25-2004, 07:29 PM
anyone?
Zachery
01-25-2004, 08:15 PM
anyone?
not it should be post
$bbuserinfo == user currently browsering
$post == data posted into the postbit tempalte
use post
Gary King
01-25-2004, 08:28 PM
As I said, it's stored in bitwise format :rolleyes: So doing that wouldn't work anyways.
Zachery
01-25-2004, 08:29 PM
As I said, it's stored in bitwise format :rolleyes: So doing that wouldn't work anyways.
why wouldnt $post[fieldX] work?
Princeton
01-25-2004, 09:26 PM
I believe you can use $userinfo; but since it's in the postbit you can probaly use $post; however, I cannot test it.
-----------------------------------
Not all custom profile fields work the same way (very confusing). In this case, it's saving the selected data in numerical values. It's much easier this way.
let's say you have 5 choices (mulitple selections)...
boy = 1
girl = 2
not sure = 4
again, not sure = 8
since, this is mulitple selection you may choose more than one; so, if you select boy/girl your value will now be a 3 and the numbers will change according to the selections you chooose. If you look closely you will see that there is a large combination of possibilities.
Now, to display the correct data for boy/girl (3) onto any page ... you will use a conditional such as
<if condition="$userinfo[field15]==3">$vbphrase[boy]$vbphrase[girl]</if> If you select boy/not sure the data saved would be a 5
<if condition="$userinfo[field15]==5">$vbphrase[boy]$vbphrase[not_sure]</if> If the member selects all choices the data saved would be a 15
Zachery
01-25-2004, 09:29 PM
I believe you can use $bbuserinfo; but since it's in the postbit you can probaly use $post; however, I cannot test it.
-----------------------------------
Not all custom profile fields work the same way (very confusing). In this case, it's saving the selected data in numerical values. It's much easier this way.
let's say you have 5 choices (mulitple selections)...
boy = 1
girl = 2
not sure = 4
again, not sure = 8
since, this is mulitple selection you may choose more than one; so, if you select boy/girl your value will now be a 3 and the numbers will change according to the selections you chooose. If you look closely you will see that there is a large combination of possibilities.
Now, to display the correct data for boy/girl (3) onto any page ... you will use a conditional such as
<if condition="$bbuserinfo[field15]==3">$vbphrase[boy]$vbphrase[girl]</if> If you select boy/not sure the data saved would be a 5
<if condition="$bbuserinfo[field15]==5">$vbphrase[boy]$vbphrase[not_sure]</if> If the member selects all choices the data saved would be a 15
i cant stress enuf to you guys that this will only show YOUR info
$bbuserinfo is a global that will display the current USERS info, not user for that post
Princeton
01-25-2004, 09:33 PM
sorry, should be $userinfo ... that's what I get for cutting and pasting
Gary King
01-25-2004, 11:18 PM
why wouldnt $post[fieldX] work?
Because you have to decode the field first.
restless
01-27-2004, 08:47 PM
this is what i used.... and it works.
<b>Sex:</b>
<if condition="$userinfo[field10]==0">maybe</if>
<if condition="$userinfo[field10]==1">boy</if>
<if condition="$userinfo[field10]==2">girl</if>
<if condition="$userinfo[field10]==3">yes, please.</if>
Gary King
01-27-2004, 08:48 PM
this is what i used.... and it works.
<b>Sex:</b>
<if condition="$userinfo[field10]==0">maybe</if>
<if condition="$userinfo[field10]==1">boy</if>
<if condition="$userinfo[field10]==2">girl</if>
<if condition="$userinfo[field10]==3">yes, please.</if>
Okay that's cool :)
disect
02-07-2005, 12:15 PM
anybody able to help with this issue? i created a new selection field, and it's displayed in the postbit as a number that resembles the option the user chose instead of the text.
The code i used is:
<if condition="$post[field5]">Field: $post[field5]</if>
there are 7 fields, if i chose the first field in the options it will show a 1 instead of the field name.
maybe thats wrong.
disect
02-08-2005, 12:47 PM
bump, need help with this
djjeffa
02-16-2005, 02:49 PM
why wouldnt $post[fieldX] work?
this worked for me...so i dont know Zach...im still fresh so what do i kow lol
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.