PDA

View Full Version : Custom Field Images


merk_aus
11-20-2010, 02:23 AM
Hey all,
Well once again my mind has hit a blank when trying to customize my postbit and I am hopeful that someone here will be able to help me out.

I want to create a custom profile field where there are radio buttons.
What I would like is something like:

What Interests you:
- Music
- Movies
- TV
- Computers

What I would like is for the user to be able to select as many of the options I put as they would like, however here comes the tricky part.

What I would like to do is have a number of images/icons set up and so if they select (for example):
Music and Computers from the profile fields in the post bit it would display the little icons I have created for Music and Computers.

Please if someone can assist it would be greatly appreciated, I am racking my brain and it is driving me insane.

kh99
11-20-2010, 03:04 PM
You can use the "Add New User Profile Field" under "User Profile Field" in the ACP to add your field, pick "Multiple-Select Checkbox" as the type and just list your choices in the Options box, one per line. After adding it, if you go to the User Profile Field Manager you can see what field number it is.

Lets say for example the field you added is Field20. Then in the postbit and/or postbit_legacy template, the value $post[field20] will contain the information about what the user selected by setting a bit for each choice: the first choice is 1, the second 2, the third 4, (8, 16, 32, 64, etc). So if for example you had 4 choices: Music, Movies, TV, Computers, your postbit could have something like:


<if condition="$post[field20] & 1"> (code for Music Image) </if>
<if condition="$post[field20] & 2"> (code for Movies Image) </if>
<if condition="$post[field20] & 4"> (code for TV Image) </if>
<if condition="$post[field20] & 8"> (code for Comp Image) </if>


I hope that makes sense.

merk_aus
11-21-2010, 04:29 AM
It does thank you so much for your help... I am glad you came to my rescue I knew the whole <if condition> stuff I had just never used it with the options before.

Really appreciate your help.