Profile Locality provides dynamic country and postal code fields to the core profile module. It's the more outgoing, more athletic older brother of Profile Location because it's not limited to only primary and secondary countries and provides better compatibility with other profile oriented modules like Profile Privacy.
The postal code autocomplete field shows/hides depending on the existence of postal codes for the corresponding country selection.
Includes support for United States and Canada by default, but support for other countries is possible by inserting additional postal codes into the database. ISO data is available from a variety of sources on the web.
1) Enable core profile module.
2) Install/enable profile_locality module.
3) Go to to admin/user, select Profiles.
4) Create a profile list selection field for country:
4a) The category can be whatever you want. Exp. Personal
4b) Title can also be whatever you want, but you should pick a label that makes sense. Exp. Country
4c) Form name should typically correspond with the title using the profile_ prefix. Exp. profile_country
4d) The rest of the settings are up to you particularly making the field required and also visible on the registration page. Note you do not have to enter any Selection options, as profile_location will do this automatically.
5) Create a new textfield field type for postal code and repeat steps 4a-d:
5a) Use same category as used for country.
5b) Title should be contextual for both domestic United States and international postal codes. Exp. Postal Code
5c) Same as 4c, only for postal code. Exp. profile_postal
5d) Same as 4d.
6) Go to to admin/user, select Profile locality settings.
7) Select default country selection that appears on the registration (if enabled) or account edit page. Exp. United States
8) Select the profile list selection field for county and and textfield for postal code.
The actual size of the module itself is quite small (less than 300 lines including comments). The bulk of the tarball file size is made up of ISO country and postal code data.
Additional postal code data can be added to database table profile_locality_postal_code. The table consists of 9 columns (code, city, state, state_abbrev, iso, latitude, longitude, timezone, dst), but only the first 5 columns is required. Once the data has been added to the table, no module configuration change is required. If/when the data is imported correctly, the postal codes for the corresponding country will be immediately recognized when editing the profile form.
The core profile module has been deprecated in Drupal 7. This, combined with the low number of installs, makes it highly unlikely Profile Locality will be ported.
- Maintenance status: Unsupported
- Development status: No further development
- Module categories: User Management
- Downloads: 739
- Last modified: January 12, 2016
- Stable releases are covered by the security advisory policy.
Look for the shield icon below.