Closed (fixed)
Project:
Country codes API
Version:
6.x-1.1-alpha1
Component:
Documentation
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
13 Mar 2009 at 14:21 UTC
Updated:
14 Mar 2012 at 05:08 UTC
Jump to comment: Most recent file
Comments
Comment #1
mrfelton commentedNot as far as I know. I'm not really sure how to go about getting such a thing either.
Comment #2
roball commentedThank you Tom for replying. Could you then please just let me know those modules that you are knowing about using your API?
Comment #3
mrfelton commentedWell, there is a neat little project here http://drupal.org/project/module_browser/ that can actually give you the answer. There is a demo site here http://www.brickswithoutclay.com/module_browser?page=1, however, it seems it will only tell you the information for Drupal 6 modules, and the D6 version of countries_api was only released very recently and is not included in the information provided on the demo site. I don't really fancy downloading the entire cvs contrib directory myself to find it out either!
I ported this module to Drupal 6 very recently, and have never even used the Drupal 5 version. The only reason I ported it was because I needed it in a custom module I was developing for a client, so I actually don't know of any other modules using it. Looking at the usage stats though, I can see that there are 110 people using the module, so it must be a required dependency somewhere... I 'd be interested to know your findings if peruse this any further. Perhaps backporting the Module Dependency Browser module would be the quickest way to find out?!
Comment #4
roball commentedThe list created by the "Module Dependency Browser" is in fact very useful - wish to have this available directly on drupal.org.
However, I also don't know yet if there are official Drupal 6 modules out depending on yours. I found yours in searching for a base to implement a replacement of the method mentioned in http://drupal.org/node/375307. My background is that I administer a project site that uses both Drupal and Moodle sharing the same user data provided by an LDAP server. Since Moodle's core user handling stores the country of each user as ISO 3166-1 alpha-2 country code, I need Drupal to do so as well. Thus, I have created a custom profile field profile_countrycode where a country name can be selected, but the country code actually gets stored. I will now try to get the list offered at that field auto-generated from an SQL table. Your API provides exactly what I need for this at the SQL side. I also considered your "IP to Country" module, but the cc database in that module is not as accurate/up-to-date as in your API.
Comment #5
mrfelton commentedThe ip2cc module is designed for finding out information about an IP address, including, but not limited to country code/name. You are right that the country code database in ip2cc is not as accurate as in the countries_api module and I intent to rework ip2cc to get its country code information from countries_api - so that will be one module that depends on countries_api! Whilst the country code information provided by countries_api is currently accurate and upto date, I would like to implement a new feature that lets it periodically connect to a web service to pull the very latest information... I'm just not sure of a web service that can provide this as yet.
Comment #6
roball commentedThe planned feature to regulary update the country list to the official list maintained by the ISO 3166 Maintenance agency is an excellent idea! It seems that there is an official permalink http://www.iso.org/iso/list-en1-semic-3.txt always containing has an up-to-date CSV in the format "COUNTRY;CC" (see http://www.iso.org/iso/country_codes/iso_3166_code_lists.htm). This list could be fetched and processed regularly. Unfortunately, it does not contain a printable_name field which is that what users should actually see.
Comment #7
roball commentedI'm glad to finally have solved the problem described in comment #4, thanks to your API :-)
Attached is the patch against DRUPAL-6-10 that does it. It actually adds one function to the core user.module to implement the hook_form_alter hook, as suggested by John Hanley. Maybe I will publish it as an own module later, so that there is no need to hack the core.
The hook does not do anything unless the "Country codes API" module is installed and enabled - thus we have a D6 module that depends on yours :-)
Comment #8
roball commentedHere is the same patch as in my comment #7, but this time it no more touches a "holy" required core module. The hook_form_alter hook is now implemented by the optional core profile.module. This is also the place seeming more natural to be at, until it will be sourced out to be a contributed module of its own.
Comment #9
roball commentedAnd here is the replacement of the patches I've posted above, so that no core code has to be hacked. It's an module for its own (which I call countrycodes_field for now). Actually my first Drupal module :-)
Comment #10
roball commentedThe code I have published above has been succeeded by the Country codes Field module version 6.x-0.2 and above, which can now be found at issue #409218: Profile "Country codes Field" module 6.x-0.2 released.
Comment #11
roball commentedThere is now a great module that may make use of the Country codes API module: Webform! That feature has been added to webform 6.x-3.0-beta3 (see http://drupal.org/node/406486#comment-2809158) :-)