We build. You grow.

Get best community software here

Start a social network, a fan-site, an education project with oxwall - free opensource community software

Show A Users U.S. State Location With Flag Image. | Forum

Wilson
Wilson Jan 5 '14

A cool way to show a users US state location with flag.

Now there’s some steps you will need to take to make it work but worth it.


NOTE: You will need to add all the US states names in the question area.  So you’re going to have to make two (2) Question to list all 51 US states…this includes ‘District of Columbia’...because we can’t change the value count code from 31 to 51 (http://www.oxwall.org/forum/topic/15340)


Step 1.

Go to admin/users/and click onto profile questions tab…then click ‘Add New Question’.
In the ‘Question’ filed I put this: I live in the state of
In the ‘Question description’ filed I put this: Please choose the state you currently live in if listed in this section. If not don’t select anything.
In the ‘Section’ filed I selected: Base
Then in the ‘Answer type’ I picked: Single choice (drop down)

page refreshes

Then in the ‘Possible values (one per line)’ filed I listed the first 25 US states in alphabetical order.
In the ‘Columns count’ area it’s at 1
then I checked “On Sign Up”, “On Profile Edit” and “On Profile view”
press save!


The first section is now made. You should now see 25 states when you go to the ‘edit profile’ section.


Step 2. (REPEAT STEP 1)

Go to admin/users/and click onto profile questions tab…then click ‘Add New Question’.
Then in the ‘Question’ filed I put this: I live in the state of
In the ‘Question description’ filed I put this: Please choose the state you currently live in if listed in this section. If not don’t select anything.
In the ‘Section’ filed I selected: Base
In the ‘Answer type’ I picked: Single choice (drop down)

page refreshes

Then in the ‘Possible values (one per line)’ filed I listed the other 26 US states in alphabetical order.
this includes ‘District of Columbia’
In the ‘Columns count’ area it’s at 1
then I checked “On Sign Up”, “On Profile Edit” and “On Profile view”
press save!


The second section is now made. You should now see all 51 US states when you go to the ‘edit profile’ section.


Step 3.

Now for the flag image addition of this mod.


This is the hard part of the mod. You have to add these one at a time in the language area.  You CANNOT paste these directly in the question value (although that would be easyer) it won’t work because due to the use of html entities and other sanitation of the values field, the code will show in the dropdown instead of the symbol. So you HAVE to do this one at a time in the language area.


Took me about 20 min…..


So in the admin/settings/ choose the language tab. Then choose ‘Base’ in the “show” drop down. The first three pages should show all 51 states. After each states name you need to insert this code <img src="http://yourdomain.com/oxwall_folder/ow_US_states/flag_alabama.gif" width="30" height="20"> to make the flag images show up next to the users selection.


Ex. Alabama <img src="http://yourdomain.com/oxwall_folder/ow_US_states/flag_alabama.gif" width="30" height="20">


As you can see I put all the US states flag images in a folder and name it /ow_US_states/ then I put it within the OX directory to secure the images. (you don’t have to put it in the same directory) I also gave width and height values for the image.


You’re done

result: See attached image

I have added a zip file that holds all the US flags .gif images. It also has directions in case you need them.

You can check out what it looks like as I have added a few pics.


I like to give detailed information here because this is a community of newbie’s and veteran coders but we ALL want to make cool mods work for our site using this great script, so I share!


Enjoy,
Wilson

The Forum post is edited by Wilson Jan 16 '14
Attachments:
  zip.rar (43.37Kb)
  view-state-profile.jpg (115.74Kb)
  edit-profile.jpg (93.7Kb)
Daisy Team
Daisy Jan 6 '14
Topic was moved from Custom Code Modifications.