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

Country/Flag Mod Question

Discussion in 'Styling and Customization Questions' started by Kenneth Holland, Jun 15, 2012.

  1. Kenneth Holland

    Kenneth Holland Active Member

    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
     
    gordy likes this.
  2. Kenneth Holland

    Kenneth Holland Active Member

  3. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

  4. Kenneth Holland

    Kenneth Holland Active Member

  5. Kenneth Holland

    Kenneth Holland Active Member

  6. ArnyVee

    ArnyVee Well-Known Member

    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.
     
  7. ArnyVee

    ArnyVee Well-Known Member

  8. Kenneth Holland

    Kenneth Holland Active Member

    So the custom user profile field is something I have to set up correct? Meaning, I have put all the flag images in etc...?
     
  9. Kenneth Holland

    Kenneth Holland Active Member

  10. ArnyVee

    ArnyVee Well-Known Member

    It should, you would just need to see where you wanted to display the actual image (since mine is at the top of the profile page).
     
  11. Kenneth Holland

    Kenneth Holland Active Member

  12. ArnyVee

    ArnyVee Well-Known Member

  13. John L.

    John L. Well-Known Member

  14. ArnyVee

    ArnyVee Well-Known Member

  15. John L.

    John L. Well-Known Member

    Just put it on my forums running the latest XenForo and it works fine for me :). No idea what others were doing.
     
  16. ArnyVee

    ArnyVee Well-Known Member

    Okay cool. Hadn't tested it out, but figured I'd let you know just in case (y)
     
  17. Luxus

    Luxus Well-Known Member

    I have pasted all hundreds of countries myself without messing with phpMyAdmin. It was a lot of work, but it paid off.
     
  18. John L.

    John L. Well-Known Member

    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/
     
    TheVisitors likes this.
  19. ibaker

    ibaker Well-Known Member

    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
     

    Attached Files:

    Jake Bunce and davespanzer like this.
  20. davespanzer

    davespanzer Active Member


    Hi, this works great. thank you.
     

Share This Page