[MOD] Select box wi...
 
Notifications
Clear all

[MOD] Select box with images showing on profile

12 Posts
5 Users
0 Reactions
4,889 Views
Jan_AQ
(@jan_aq)
Posts: 1300
Noble Member
Topic starter
 

Level: Easy. User requires knowledge of html image links and will have to upload several images somewhere to use.

Keywords: Affiliation, Sorting House Hat, Select box with images (profile)

The custom code was written by Tammy. All credit goes to her.

---------

There is already a Select Box option in the Edit Profile Field but it just shows text; what about if you want to display an image on the member's profile?

For example, if you had a Hogwarts House affiliation profile field, here's how to change the display of

Hogwarts House: Gryffindor
to
Hogwarts House: Gryffindor

---------

Step 1. Create the images that you wish to use for this mod and upload them to your site or somewhere you can legally link from.

You may save these and upload them to your own server:

Step 2. Go to the Profile Information panel in the admin panel (/admin.php?action=authorfields)

Step 3. Click the link to Add new profile field.

Step 4. Input this information, making sure that you replace the YOUR IMAGE URL GOES HERE! with the url to your images in the Custom Profile Code area: (The Name: and Title: parts can be changed to whatever you want)

Name: sorting
Title: Hogwarts House
Field enabled: (check)
Type: Custom Code

Custom Form Code:

$output .= "<div><label for='af_".$field['field_name']."'>".$field['field_title'].":</label><SELECT type='text' class='textbox'  name='af_".$field['field_name']."'><option".(!empty($user["af_".$field['field_id']]) && $user["af_".$field['field_id']] == "Hufflepuff" ? " selected" : "").">Hufflepuff</option><option".(!empty($user["af_".$field['field_id']]) && $user["af_".$field['field_id']] == "Gryffindor" ? " selected" : "").">Gryffindor</option><option".(!empty($user["af_".$field['field_id']]) && $user["af_".$field['field_id']] == "Ravenclaw" ? " selected" : "").">Ravenclaw</option><option".(!empty($user["af_".$field['field_id']]) && $user["af_".$field['field_id']] == "Slytherin" ? " selected" : "").">Slytherin</option></select></div>";

Custom Profile Code:*

if($field['info'] == "Hufflepuff") $thisfield = "<img src ='YOUR IMAGE URL GOES HERE!'>Hufflepuff";else if($field['info'] == "Gryffindor") $thisfield = "<img src="'YOUR" IMAGE URL GOES HERE!'>Gryffindor";else if($field['info'] == "Ravenclaw") $thisfield = "<img src="'YOUR" IMAGE URL GOES HERE!'>Ravenclaw";else if($field['info'] == "Slytherin") $thisfield = "<img src="'YOUR" IMAGE URL GOES HERE!'>Slytherin";

*Make sure that you replace the four instances of YOUR IMAGE URL GOES HERE!'s with the url to your images. Make sure that the single set of ' surrounding the url is there.

If you want to change this sorting hat example to something else, then all you need to do is change the instances of "Gryffindor" "Hufflepuff", "Ravenclaw" and "Slytherin" to whatever you want them to be.

You can add more types than the four listed here but try and see if you can get this to work before fiddling with it. You may want to create an unsorted hat and have it be the default; when you add it, list it first.

Step 5. Save/Submit.

Step 6. Make sure that it will be shown on your skins. If you are using the {authorfields} variable on the profile pages of you skins then you don't have to change anything, but if you are using the individual variables by themselves them you will use {sorting} or whatever you named the field.

Working example:

http://www.potionsandsnitches.net/fanfiction/viewuser.php?uid=1


Whoever said nothing is impossible never tried slamming a revolving door.

url: https://www.potionsandsnitches.org/fanfiction
php: 7.4.33 msql: 5.6.51-community GPL
efic version: 3.5.5 latest patches: yes
bridges: none mods: challenges, tracker, story end, beta, word

 
Posted : 12/10/2006 3:12 pm
(@fanfictionworld)
Posts: 149
Estimable Member
 

this is exactly what I would like but for a starsign field with images

you see  i've only just started to use the new efiction and im a bit lost :p as much of it is different then 2.0

maybe someone could help as im not sure about step 6 in the this topic - where do u set efiction to use the {authorfields} variable or in the skins where do u put the {starsign} tag

thanx for the help


~Spikey~

my site url: http://www.fanfictionworld.org
efic version:3.5.3

 
Posted : 10/04/2007 3:43 am
Jan_AQ
(@jan_aq)
Posts: 1300
Noble Member
Topic starter
 

Read the skinning docs for that information. πŸ™‚ It's part of the skins .tpl pages coding.


Whoever said nothing is impossible never tried slamming a revolving door.

url: https://www.potionsandsnitches.org/fanfiction
php: 7.4.33 msql: 5.6.51-community GPL
efic version: 3.5.5 latest patches: yes
bridges: none mods: challenges, tracker, story end, beta, word

 
Posted : 10/04/2007 2:50 pm
(@fanfictionworld)
Posts: 149
Estimable Member
 

I tried using this to mod the gender field so that it shows an image but now i get this

Parse error: syntax error, unexpected '&', expecting ']' in /home/fanficti/public_html/user/profile.php(70) : eval()'d code on line 1

(basically i deleted the slytherin section so there was only options when there was 4 it worked fine

any idea about this anyone?


~Spikey~

my site url: http://www.fanfictionworld.org
efic version:3.5.3

 
Posted : 11/05/2007 8:41 pm
Jan_AQ
(@jan_aq)
Posts: 1300
Noble Member
Topic starter
 

Well the gender profile field is a default that came with the script. Did you try editing that field, or did you try making a new field?

Try making a new one based on this mod but change the names to the gender ones. Once you get it working, you can then try replacing the old one, or just changing the database info listed...


Whoever said nothing is impossible never tried slamming a revolving door.

url: https://www.potionsandsnitches.org/fanfiction
php: 7.4.33 msql: 5.6.51-community GPL
efic version: 3.5.5 latest patches: yes
bridges: none mods: challenges, tracker, story end, beta, word

 
Posted : 11/05/2007 11:02 pm
(@fanfictionworld)
Posts: 149
Estimable Member
 

Well the gender profile field is a default that came with the script. Did you try editing that field, or did you try making a new field?

Try making a new one based on this mod but change the names to the gender ones. Once you get it working, you can then try replacing the old one, or just changing the database info listed...

wel I made a new one named gender2 (so I didnt mess the origional one up) but then like I said when I deleted the 4th option I got that error generated


~Spikey~

my site url: http://www.fanfictionworld.org
efic version:3.5.3

 
Posted : 12/05/2007 1:40 am
Jan_AQ
(@jan_aq)
Posts: 1300
Noble Member
Topic starter
 

You probably deleted it wrong. Try again and delete the third option instead. You are probably deleting a space or something like ; by accident.


Whoever said nothing is impossible never tried slamming a revolving door.

url: https://www.potionsandsnitches.org/fanfiction
php: 7.4.33 msql: 5.6.51-community GPL
efic version: 3.5.5 latest patches: yes
bridges: none mods: challenges, tracker, story end, beta, word

 
Posted : 12/05/2007 3:01 am
(@marauder-by-night)
Posts: 33
Eminent Member
 

Parse error: syntax error, unexpected '&', expecting ']' in /home/snotori1/public_html/work/user/profile.php(70) : eval()'d code on line 1

I got that same error too yet didn't change anything.  All I did was add the code, save the images, and replace the URLs.  Now the Hogwarts House: works but nothing after it is showing yet if I look at the code in tinyMCE the hats show up so what did I do wrong?


 
Posted : 15/06/2007 9:00 pm
(@tammy)
Posts: 2577
Member Moderator
 

Do not use tinyMCE when uploading code.


 
Posted : 16/06/2007 6:07 am
(@jacci)
Posts: 503
Honorable Member
 

Jan_Aq, will this work with 3.3??
thanks,
jacci


why is nothing ever easy?
url: http://www.pretendercentre.com/missingpieces/     
php: 5.2.5  msql: 5.0.45-community
efic version: 3.4.3           latest patches: yes
bridges: none              mods: challenges, displayword, beta-search

 
Posted : 17/06/2007 11:25 am
Jan_AQ
(@jan_aq)
Posts: 1300
Noble Member
Topic starter
 

Yes.

This is not a mod really, it's a profile field.


Whoever said nothing is impossible never tried slamming a revolving door.

url: https://www.potionsandsnitches.org/fanfiction
php: 7.4.33 msql: 5.6.51-community GPL
efic version: 3.5.5 latest patches: yes
bridges: none mods: challenges, tracker, story end, beta, word

 
Posted : 17/06/2007 9:33 pm
(@jacci)
Posts: 503
Honorable Member
 

thanks so much Jan_AQ, that worked perfectly and your instructions were clear and easy to follow.
πŸ˜€


why is nothing ever easy?
url: http://www.pretendercentre.com/missingpieces/     
php: 5.2.5  msql: 5.0.45-community
efic version: 3.4.3           latest patches: yes
bridges: none              mods: challenges, displayword, beta-search

 
Posted : 18/06/2007 1:55 am
Share: