This plugin hasn’t been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues when used with more recent versions of WordPress.

Quick Flag

Description

Quick Flag resolves IP address to ISO 3166-1 alpha-2 two-letter country code and name using ip-countryside generated database and displays country flag if required. In contrast to other IP to country solutions this one allows you to create and update database your self using 5 Regional Internet Registrars (RIR) databases: AFRINIC, APNIC, ARIN, LACNIC and RIPE and ip-countryside open source application that does the work of generating database for you. You can also update IP to country database automatically with single click or schedule weekly automatic updates.

Big thanks to Markus Goldstein for ip-countryside project, weekly database updates and automatic update server used in the past. To offload Markus server, database updates are currently generated by me and stored inside GitHub repository.

Quick Flag feature highlights

  • New in v2.10: Country names can be translated using Poedit
  • Quick Flag database can be updated using single click without updating Quick Flag plugin.
  • Quick Flag database can be auto updated weekly without updating Quick Flag plugin.
  • Because of the way Quick Flag database is created it has probably the most accurate IP to country database you can find.
  • Database updates are generated using open source ip-countryside application.
  • Quick Flag provides PHP function to retrieve country code and country name for given IP address (see FAQ for more)
  • Quick Flag provides PHP function to retrieve country flag image for given country, 248 flag images provided by Mark James

Other WordPress plugins supporting Quick Flag

For more information and demo please visit Quick Flag demo page at TechyTalk.info.

Screenshots

Installation

Quick Flag can be installed using integrated WordPress plugin installer or manually.

Integrated WordPress plugin installer method:

  1. Go to Plugins > Add New.
  2. Under Search, type in ’Quick Flag’.
  3. Click Install Now to install the WordPress Plugin.
  4. A popup window will ask you to confirm your wish to install the Plugin.
  5. If this is the first time you’ve installed a WordPress Plugin, enter the FTP login credential information. If you’ve installed a Plugin before, it will still have the login information.
  6. Click Proceed to continue with the installation. The resulting installation screen will list the installation as successful or note any problems during the install.
  7. If successful, click Activate Plugin to activate it, or Return to Plugin Installer for further actions.
  8. Have fun using geolocation trough your own plugin.

Manual method:

  1. Upload ’quick-flag’ folder from quick-flag.zip file downloaded from Quick Flag WordPress plugin directory page to the ’/wp-content/plugins/’ directory.
  2. Activate ’Quick Flag’ plugin through the ’Plugins’ menu in WordPress.
  3. Have fun using geolocation trough your own plugin code.

FAQ

How do I test is Quick Flag installed properly?

You can place [quick-flag] shortcode to add current IP address country name and flag image to your page or post. To display country name and flag image of IP address other than current you can use this shortcode like [quick-flag ip="some_ip_address"].

Can you provide example for fetching country info and flag for imaginary `123.123.123.123` IP address from country Croatia?

You can use something like this:

// Query database with following IP address
$ip_address = '123.123.123.123';

global $quick_flag;
if(isset($quick_flag) && is_object($quick_flag)){
    if(($info = $quick_flag->get_info($ip_address)) != false){
        $version = $info->version;      // Quick Flag version (float): 2.00
        $ip = $info->ip;                // IP address (string): 123.123.123.123
        $code = $info->code;            // Country code (string): HR
        $name = $info->name;            // Country name (string): Croatia
        $latitude = $info->latitude;    // Country latitude (float): 45.1667
        $longitude = $info->longitude;  // Country longitude (float): 15.5
        $flag = $quick_flag->get_flag($info, 'my-own-css-class'); // CSS class is optional, 'quick-flag' by default
    }
}

$flag variable will contain following string:

<img
    class="my-own-css-class"
    title="Croatia"
    src="http://www.yoursite.com/wp-content/plugins/quick-flag/img/flags/HR.gif"
/>
How do I translate country names to my own language?

Like most WordPress plugins Quick Flag can be translated using gettext. You can use Poedit application to open translation template from ‘languages’ directory or you can use Quick Flag online translation interface. Please keep in mind that after you change your blog language or update language files you must trigger database update to update country names inside database. Currently the easiest way to do this is to delete ip2country.db and ip2country.version files from ‘database’ directory and click ‘Update’ button in Quick Flag settings.

Reviews

Quick Flag

We installed this ages ago and it is still working well as we have updated our WP. Thanks!

Read all 2 reviews

Contributors & Developers

“Quick Flag” is open source software. The following people have contributed to this plugin.

Contributors

Translate “Quick Flag” into your language.

Interested in development?

Browse the code, check out the SVN repository, or subscribe to the development log by RSS.

Changelog

2.11 (25.11.2012.)

  • Fix for ip2long returning signed integer on 32-bit systems

2.10 (12.09.2012.)

  • Add ability to translate country names using Poedit
  • Update ISO 3166-2 country names and codes
  • Change database update URLs to GitHub repository
  • Database updated to 11.09.2012. version

2.02 (23.07.2012.)

  • Code refactoring and minor cleanup
  • Fix another bug where Quick Flag fails to operate on PHP versions older than 5.3.0

2.01 (22.07.2012.)

  • Fix bug where Quick Flag fails to operate on PHP versions older than 5.3.0

2.00 (22.07.2012.)

  • Add admin settings page
  • Add single click database update feature and admin settings button
  • Add auto database update feature and admin settings toggle checkbox
  • quick_flag_get_info() deprecated. Use $quick_flag->get_info() instead.
  • quick_flag_get_flag() deprecated. Use $quick_flag->get_flag() instead.
  • Database updated to 17.07.2012. version

1.14 (07.07.2012.)

  • Database updated to 03.07.2012. version

1.13 (23.04.2012.)

  • Database updated to 17.04.2012. version

1.12 (27.03.2012.)

  • Database updated to 27.03.2012. version

1.11 (17.03.2012.)

  • Fix bug where all users were resolved to country Croatia

1.10 (16.03.2012.)

  • Database updated to 13.03.2012. version
  • Place latitude and longitude data inside
  • Add new global variable $quick_flag_version
  • Place Quick Flag version inside data returned by quick_flag_get_info(). If you are using cookies to store users geolocation data you can easily check cookie for Quick Flag version that created this data. If data is not up to date you can fetch new data and update cookie.
  • Split country and ip ranges data into separate tables, join them when necessary. This gives us around 40% database size reduction.

1.00 (06.03.2012.)

  • Initial release
  • Database updated to 06.03.2012. version