comment_country_screenshot.png

The Comment Country module enables the display of the author's country information in comments. Available formats are the country name, the 2 letter country code, and the country flag (requires the 1.x version of the Country Icons module).

D7 Version

Looks like the http://drupal.org/project/countries module replaces this module for d7. Looks like there's still a need for this module. The 7.x-1.x version is compatible with the 7.x-1.x version of the countryicons module. Also, the D7 version exposes country code and name to comment views including a field handler for the country code field that displays the flag if the countryicons module is installed.

D6 Version

Since the module uses the api available at http://ipinfodb.com, it does not require the installation and maintenance of any type of country database. It looks up and stores the comment author's country information upon comment creation and update. There's also an option on on the configuration settings page to refresh all comment country info at once.

For convenience, if the Country Icons module is enabled, the module uses the theme_countryicons_icon_sprite theme function (for performance) to display the country flag as a css sprite. You can always disable the flag display option in the comment_country settings and generate the flag display manually using whatever Country Icons method you prefer. See the Country Icons module documentation for more information.

Why another ip / country type module?

All I wanted to do was add a little country flag to the 'submitted' line of comments on my site. I tested all the ip / country modules and all were either buggy, too complex, unmaintained, required registered users, required installation and support of a 3rd party country database, or otherwise a mess and complete overkill for such a simple task. Since registered users will quite likely prefer to manually choose their associated country from a select list rather than whatever IP they happen to be using at any given time, I don't believe in using ip to country conversion for user profiles-- just comments and/or visitor info. In fact, users may often choose to make their country of birth their profile country even though they live some place else with an entirely different IP range.

Kudos to twooten and the Visitor Info module for the inspiration to use the awesome service available at http://ipinfodb.com to retrieve the information instead of having to download and maintain any type of country knowledge store. There are other ip to country webservices available, but I find this one to be the most complete and accurate-- I have yet to stumble across an ip that couldn't be properly mapped.

Project Information

Downloads