HowTo Create a 'country' profile field
This page describes how to create a 'country' field in your users' profiles, similar to the one on Drupal.org, that lets you easily find users in any country.
- Create a new profile field.
- Go to the profile settings page (administer > settings > profiles ?q=admin/settings/profile)
- Select the 'list selection' type of form field.
- Category (required): It can be a category you already have or a new one. (Suggested: Personal Information)
- Title (required): Anything is OK. (Suggested: Country)
- Form name (required): Anything is ok, as long as it is unique. (Suggested: profile_country)
- Explanation (optional): Usually, country is self explanatory, but you may want to write a note here to your users about this field.
- Selection options: Copy the list from the attached file here. This file is from Wikipedia
(http://en.wikipedia.org/wiki/List_of_countries May 2006) - Weight: Select whatever you like (this is the weight in the category selected above).
- Visibility: Select one of the 'Public Field' options.
- Page title (required): You must put something here. (Suggested: People who live in)
- Check boxes: Check 'the user must enter a value' to make this field required. Check 'visible in user registration form' to make it part of user registration.
- Click on 'Save field.'
| Attachment | Size |
|---|---|
| profile-country-list.txt | 2.72 KB |

Country names and Yahoo! Geocoder
If yo try to use the country names for geocoding to display the locations on a map, make sure the geocoder you intend to use understands the country name format.
I used the long name like instead of 'Angola', I used 'Republic of Angola', which cannot be understood in any case by (at least) Yahoo! geocoder api.
Also keep in mind, that Yahoo! geocoder has its focus on the United States, so if you try to find 'Berlin', the chance to find a Berlin in US is much higher, then somewhere else.