New field in postbit like image

Peru_BobMarley

New Member
Create a new Multi-selection checkbox user field.
Admin CP -> User Profile Fields -> Add New User Profile Field -> Multi-selection checkbox

Title: Civilizations
Description: Pick your favorite civilizations
Limit Selection: 0
Items Per Line: 1
Field Required: No (unless you want it to be, then change to yes)
Field Editable by User: Yes

Click on SAVE.

Next goto the User Profile Field Manager
Admin CP -> User Profile Fields -> User Profile Field Manager
And make a note of the field number of the new field you just created. So for me on my new forum the field number was field5.


Now the fun part, getting a multi-selection field ti show up on a postbit can be a little tricky and instead of me trying to explain it I'll send you directly to the source by clicking here.

In short this is going to be the basis of which you will start:

Code:
<if condition="$post['fieldX'] & 1">
    CODE TO DISPLAY IF OPTION 1 IS SELECTED
</if>
<if condition="$post['fieldX'] & 2">
    CODE TO DISPLAY IF OPTION 2 IS SELECTED
</if>
<if condition="$post['fieldX'] & 4">
    CODE TO DISPLAY IF OPTION 3 IS SELECTED
</if>
<if condition="$post['fieldX'] & 8">
    CODE TO DISPLAY IF OPTION 4 IS SELECTED
</if>
<if condition="$post['fieldX'] & 16">
    CODE TO DISPLAY IF OPTION 5 IS SELECTED
</if>
<if condition="$post['fieldX'] & 32">
    CODE TO DISPLAY IF OPTION 6 IS SELECTED
</if>
<if condition="$post['fieldX'] & 64">
    CODE TO DISPLAY IF OPTION 7 IS SELECTED
</if>
<if condition="$post['fieldX'] & 128">
    CODE TO DISPLAY IF OPTION 8 IS SELECTED
</if>

Make sense? Hopefully it does because if it does then the following code will also make sense and is the code I used to make it work for me:

How to field to a users post?
Admin CP -> Styles & Templates -> Style Manager -> « » -> Postbit Templates -> postbit_legacy

Find:
Code:
<div>$post[icqicon] $post[aimicon] $post[msnicon] $post[yahooicon] $post[skypeicon]</div>

Below Add:
Code:
<div>
  <if condition="$post['[color=Magenta]field5[/color]']"><strong>Favorite Civilizations:</strong><br /></if>
  <if condition="$post['[color=Magenta]field5[/color]'] & 1">
  <img src="[color=Red]PATH_TO_IMAGE/aztecas.gif[/color]" width="24" height="24" alt="Aztecas" />
  </if>
  <if condition="$post['[color=Magenta]field5[/color]'] & 2">
  <img src="[color=Red]PATH_TO_IMAGE/bizantinos.gif[/color]" width="24" height="24" alt="Bizantinos" />
  </if>
  <if condition="$post['[color=Magenta]field5[/color]'] & 4">
  <img src="[color=Red]PATH_TO_IMAGE/celtas.gif[/color]" width="24" height="24" alt="Celtas" />
  </if>
</div>

Be sure to change the field5 to your correct field number as mentioned to do above.

Also be sure to change the PATH_TO_IMAGE in RED to the path of your images on your forum.

Attached is a screen shot of the profile edit page with two of the three Civz selected, then a screen shot of the two selected civs being displayed on the post bit. The last screen shot is of the post bit with no civs selected.

Enjoy.!!

PD: Thanks WoodiE55 for help me with my proyect.
 

kamcreation

New Member
Peru_BobMarley great share buddy i wanted to show the multiple checkbox field in my postbit but didn't knew how (as it always displayed the binary code).


So thanks once again for sharing this great info
 
Top