• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Country/Flag Mod Question

#1
If this has been discussed before...I apologize. Couldn't find anything.

Is there a mod (or if not how difficult would it be?) to have a new user select a flag representing his country so it appears in his profile and in the thread discussions?

Thanks.

Ken
 

ArnyVee

Well-known member
#6
Ken, in essence, you are asking the member/user to select their flag from a custom user profile field. Then, by them selecting that option/image, it will display that image wherever you set that custom field to display.
 
#8
Ken, in essence, you are asking the member/user to select their flag from a custom user profile field. Then, by them selecting that option/image, it will display that image wherever you set that custom field to display.
So the custom user profile field is something I have to set up correct? Meaning, I have put all the flag images in etc...?
 

John L.

Well-known member
#15
John, I noticed that one was showing as 'not working' by a few folks. Is it working? If so, you may want to add it as an active tip so folks can ask their questions, etc. :)
Just put it on my forums running the latest XenForo and it works fine for me :). No idea what others were doing.
 

ibaker

Well-known member
#19
That is great work, but not everyone wants to be bothered doing that. Here is a new resource for people to use to make it a bit easier:

http://xenforo.com/community/resources/country-flags.806/
I just found this thread...I am the owner of that web site in the OP. I saw that mod above but I don't like the fact that every page a person goes to on your site, they are pulling up the Extra.css template so if you are in any page other then in thread view, you would be pulling up all that extra css for nothing so this is how I did it...if it helps anyone.

This is what it look like:
4.jpg

1. Unzip the attached flags.zip file and upload all the flag images to styles/default/flags/

2. Create a Custom User Field called country:
1.jpg 2.jpg 3.jpg
2.a In the 2nd screen shot you will see just the top part of the country list. You need to create an entry for every country flag image file that you uploaded

2.b The html display that is in the 3rd screen shot is:
Code:
<img src="../styles/default/flags/{$choice}.gif" alt="Country" title="My Home Country: {$choice}" border="0" />
3. In the Admin Control Panel, go to Appearance => Style Properties => Message Elements
and make sure "Show custom user fields" is ticked.

I think that's all! There's no addon needed and should stay the same if upgrading

Notes:
- In 2.b above you will see that the code shows "choice" as gif flag image file. This is because the country name that a user can choose is the same name as the image flag file that will be used. If a user select the country Australia in your list, the image that will be displayed is Australia.gif. This makes it easy to add more, or even take away, any country flag you want by simply uploading the country_name.gif flag image and add an entry for it in the Custom User Field
- If you want to customise the way it is displayed in the post bit, just change the html code in 2.b above to suit.

I hope this is of some help to other XF users
 

Attachments

#20
I just found this thread...I am the owner of that web site in the OP. I saw that mod above but I don't like the fact that every page a person goes to on your site, they are pulling up the Extra.css template so if you are in any page other then in thread view, you would be pulling up all that extra css for nothing so this is how I did it...if it helps anyone.

This is what it look like:
View attachment 35635

1. Unzip the attached flags.zip file and upload all the flag images to styles/default/flags/

2. Create a Custom User Field called country:
View attachment 35632 View attachment 35633 View attachment 35634
2.a In the 2nd screen shot you will see just the top part of the country list. You need to create an entry for every country flag image file that you uploaded

2.b The html display that is in the 3rd screen shot is:
Code:
<img src="../styles/default/flags/{$choice}.gif" alt="Country" title="My Home Country: {$choice}" border="0" />
3. In the Admin Control Panel, go to Appearance => Style Properties => Message Elements
and make sure "Show custom user fields" is ticked.

I think that's all! There's no addon needed and should stay the same if upgrading

Notes:
- In 2.b above you will see that the code shows "choice" as gif flag image file. This is because the country name that a user can choose is the same name as the image flag file that will be used. If a user select the country Australia in your list, the image that will be displayed is Australia.gif. This makes it easy to add more, or even take away, any country flag you want by simply uploading the country_name.gif flag image and add an entry for it in the Custom User Field
- If you want to customise the way it is displayed in the post bit, just change the html code in 2.b above to suit.

I hope this is of some help to other XF users

Hi, this works great. thank you.