Quick Flag

License

Quick Flag is released under GPLv2 license.

Quick Flag Demo

If you want to see Quick Flag in action you can check out my Quick Count or Quick Chat WordPress plugins demo pages.

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.

Features

Here are some of the features of Quick Flag WordPress plugin:

  • New in v2.00: Quick Flag database can be updated using single click without updating Quick Flag plugin.
  • New in v2.00: 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

Requirements

  • Requires at least: WordPress 3.0
  • Tested up to: WordPress 3.4.2
  • Current version: Quick Flag 2.11

Installation

You can find up to date installation instructions on Quick Flag WordPress.org installation page.

FAQ

You can find up to date FAQ on Quick Flag WordPress.org FAQ page.

Changelog

You can find up to date change log on Quick Flag WordPress.org changelog page.

Your translations

One of the ways to help spread Quick Flag is by translating it into your language or updating existing translation by translating untranslated strings. To make it easier for you to translate Quick Flag to your language I've configured Quick Flag online translation interface using open source application named GlotPress. Using GlotPress hosted on TechyTalk.info you can translate Quick Flag into your own language without the need for any additional tools. My plan is to download translation files before every Quick Flag release and include them into official Quick Flag package. This way your translation files will be available to you and to all Quick Flag users right out the box.

To keep translation files free of spam, before you are able to translate you need to register for TechyTalk.info user account. Then you can log into Quick Flag online translation interface using the following link:

Your donations

Quick Flag is open source web application created by single person and released under GPLv2 license. This means that you can use or even modify Quick Flag free of charge. Open source development and user support for my WordPress plugins takes at least few hours of my every day so if you find Quick Flag useful you can donate to help it's development. Thanks in advance.

Your feedback

Your feedback would be very appreciated. If you discover any bugs please describe your problem here or using contact form and I will do my best to resolve it. Feature requests and comments are also welcome and I will try to fulfill any feature requests.

Quick Flag stable version

Quick Flag is hosted by official WordPress plugin directory so that is where you can get it:

Comments
  • Riliwan Balogun May 10, 2013 at 22:56:37

    please i really love a feature on this website.

    I am a nigerian and a web designer with wordpress knowledge.

    The interactive map by the right please can you help me on a tutorial about it or just help me i love it cos it shows an accurate map and i do it manually with imagemapster limited to only a country not the world map in general

     

    Thanks Please

    • Marko May 11, 2013 at 20:15:25

      Hello, the feature you refer to is my open source WP plugin Quick Count.

      • Riliwan+Balogun May 15, 2013 at 08:44:45

        Thanks you’re awesome

  • TMP March 7, 2013 at 19:14:17

    75MB DATA @ MYSQL in 12hrs are normal?
    Speicherplatzverbrauch
    Daten 27.2 MiB
    Index 51.6 MiB
    Insgesamt 78.8 MiB
    Datensatz-Statistiken
    Format statisch
    Kollation utf8_general_ci
    Datensätze 1,676,960
    Zeilenlänge ø 17
    Zeilengröße ø 49 B
    Nächster Autoindex 1,676,961
    Erzeugt am 06. Mrz 2013 um 21:17
    Aktualisiert am 06. Mrz 2013 um 21:18
    Letzter Check am 07. Mrz 2013 um 19:57
    there is anything wrong probably?
    http://wordpress.org/extend/plugins/quick-flag/

    thats what i got out on database…..

  • Louis March 3, 2013 at 19:14:56

    Hi Marko,

    It has been a while since I last commented here on your Quick Chat plugin. I recently came across your Quick Flag plugin, it’s a nice complement to Quick Chat.

    I installed and activated it, but when I hit the “Update” button I got the following error.

    Fatal error: Cannot use object of type WP_Error as array in C:\Wamp\www\wp-content\plugins\quick-flag\quick-flag.php on line 472

    Hope you’ll be able to point me to the right direction to correct this erro.

    Thanks for your hard works and supports!

    Regards,

    Louis

    • Marko March 5, 2013 at 10:34:46

      Hi. I haven’t tested Quick Flag on Windows so I really can’t tell for sure but I do have a few suggestions. Does your Wamp installation has means to connect to the outside world like curl, fsockopen?

      • Louis March 6, 2013 at 02:03:44

        Yes, I have curl enabled, but still getting the error.

        Maybe it just not compatible with WAMP.

        Thanks.

        • Marko March 6, 2013 at 10:00:19

          Quick Flag works fine on any Linux server I’ve tested, maybe WAMP isn’t compatible with LAMP.

  • sumiti November 15, 2012 at 08:06:35

    Hi Marko
    How to change the country name in quick flag plugin????
    Thanks!

    • Marko November 21, 2012 at 10:33:01

      Hi. If you’re talking about translating them, you should review “Your translations” section on this page. If you just wan’t to change country names you can open “iso-3166-2.php” file and edit country names (you must know how to write PHP code).

  • Alex September 18, 2012 at 22:01:37

    Hi Marko,

    Awesome feature on translating the country names.

    Do you have it in spanish?

    I will begin translating but just wanted to make sure.

    Thanks!

    • Marko September 18, 2012 at 22:23:34

      No problem ;) A community member Alvaro has translated all 250 country names to spanish, you can get them on Quick Flag glotpress pages:

      http://www.techytalk.info/glotpress/projects/quick-flag/es/spanish

      Since there are steps you must take before translations start working, before installing please take a look at FAQ question “How do I translate country names to my own language?” from:

      http://wordpress.org/extend/plugins/quick-flag/faq/

      Good luck!

      • Alex September 19, 2012 at 00:05:27

        Great Job!

        Thanks.

        I may be doing something wrong though. I just copied, both po and mo files to the languages folder, and deleted both db files and update, but still doesn’t show in spanish. Anything else I must do?

        Thanks.

        • Marko September 19, 2012 at 00:09:45

          Country names are stored inside cookie so each user wouldn’t poll database for country name each time it reports using ajax. Because of that old users will still have old country names, new ones will get new names (if you did all correctly). To be sure you’ve done all good you can open your phpmyadmin and take a look inside quick_flag_country_names table. If you find Spanish country names there all is fine.

          • Alex September 19, 2012 at 00:19:06

            I think that’s the problem. The names in my database are still in english. Should I translate the pot file, or just paste de po and mo inside the languages folder? Thanks!

            • Marko September 19, 2012 at 00:40:39

              I’ll try to explain in as much detail as possible:

              First open your wp-config.php and check that following exists (standard procedure for changing WP language to Spanish):

              define('WPLANG', 'es_ES');

              Now go to Quick Flag Glotpress and download .mo (.po is optional) file and place it into ‘quick-flag/languages’ folder on your server. Whatever file name Glotpress offerers while exporting .mo file it is very important that you rename this .mo file into quick-flag-es_ES.mo because your WP_LANG is (should be) defined as ‘es_ES’. Now delete database files ip2country.db and ip2country.version from ‘quick-flag/database’ directory on your server, go to Quick Flag admin options and click update. Once you get ‘Base de datos de Quick Flag actualizada.’ message you’re done. Now check the ‘quick_flag_country_names’ table using phpmyadmin but notice that it looks like some country names are same in English and Spanish so it is a bit hard to notice that database is in fact correctly updated. I’ve done all these steps as I wrote theme here on my local WordPress installation and can verify it works. You can also use [quick-flag] shortcode to test Quick Flag it self, where you place it inside post you will get current user IP country name and flag straight from Quick Flag database.

              • Alex September 19, 2012 at 02:02:17

                Perfect!! I had named the file incorrectly. Now everything works OK. Thank you both Marko and Alvaro!

  • Alvaro September 14, 2012 at 15:15:37

    Hey!
    The flags besides a comment are made by Quick Flag only right?
    Can you guide me to include the flags on my website? Because I have the plugin and the flag doesn’t appears. What should I add?
    Thank you!

    • Marko September 14, 2012 at 16:27:38

      Hi,
      yes Quick Flag only but I’ve built it into my WordPress theme. Basic example is to place something like this into your theme PHP files where you want country flag to appear:

      global $quick_flag;
      if(isset($quick_flag) && is_object($quick_flag)){
          if(($info = $quick_flag->get_info(get_comment_author_IP())) != false){
              echo $quick_flag->get_flag($info, 'my-theme-country-flag'));
          }
      }

      If commenter is from Germany this will echo img HTML element like this:

      <img class="my-theme-country-flag" src="http://www.yoursite.com/wp-content/plugins/quick-flag/img/flags/DE.gif" />

      Then you should use CSS to edit your theme style.css to style this flag position to match your theme:

      img.my-theme-country-flag{
          /* Your CSS goes here */
      }

      Good luck!

      • Alvaro September 17, 2012 at 01:06:55

        I understood, just a part.
        Can you send me an email with instructions?
        I can send you the files from my theme so you can integrate Quick Flag.
        Thank you! And sorry.

        • Marko September 17, 2012 at 20:28:14

          Since you’ve been very helpful with contributing to my plugins translations and testing just send me zip package of your theme directory and I’ll integrate Quick Flag into your comments free of charge. We can work out the placement and appearance of country flags inside comments trough email ;)

  • Alex September 4, 2012 at 20:07:27

    Hi. First of all congratulations on this great plugin. I have configured everything I need to display user’s flags on my website but I am wondering if I can change the name of the country (translate it to another language). Right now when you roll over a flag it displays the name of the country in english. Do you guys have a po file that I can edit or I just need to go inside the quick-flag.php file? Thanks.

    • Marko September 5, 2012 at 00:34:03

      Unfortunately I haven’t thought about translating country names when I’ve designed it and this definitely goes into the next version I plan to release in a few days. If you need it sooner and if you know a bit about PHP I can point you in the right direction on how you can do it your self?

      • Alex September 10, 2012 at 03:08:03

        Thanks Marko.

        I know a bit of php, and I found out that the “easiest” way may be changing the names directly in the DB. Though 243 countries still not that easy. I think I can wait a few days for the next release. Thanks again!!

        • Marko September 12, 2012 at 02:25:21

          Hello,
          I have beta version of Quick Flag 2.10 that supports translating country names using .po, .mo and Poedit. Could you please contact me if you would like to beta test?

  • Tom+Farrell July 23, 2012 at 13:30:52

    Just tried the latest version and got this error.

    Parse error: syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM in /usr/local/pem/vhosts/136697/webspace/siteapps/39051/htdocs/wp-content/plugins/quick-flag/deprecated.php on line 5

  • Raphael July 22, 2012 at 19:30:14

    Error Warning: require_once(__DIR__/deprecated.php) [function.require-once]: failed to open stream: No such file or directory in /home/shalomtv/public_html/wp-content/plugins/quick-flag/quick-flag.php on line 2266

    Fatal error: require_once() [function.require]: Failed opening required ‘__DIR__/deprecated.php’ (include_path=’.:/usr/lib/php:/usr/local/lib/php’) in /home/shalomtv/public_html/wp-content/plugins/quick-flag/quick-flag.php on line 2266

    • Marko July 22, 2012 at 21:17:05

      There was a bug where Quick Flag couldn’t operate correctly on PHP versions older than 5.3.0. I’ve published 2.01 release that fixes this problem, it should be available in a few minutes. Sorry about that.

      • Raphael July 23, 2012 at 14:34:20

        Other error:
        Parse error: syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM in /home/shalomtv/public_html/wp-content/plugins/quick-flag/deprecated.php on line 5

        • Marko July 23, 2012 at 15:05:00

          I’m having difficulties because I’m currently away and do not have access to server with PHP < 5.3.0. I've published 2.02 version, this should fix this one but I couldn't test on PHP 5.2.x. Please report as soon as possible if you find any difficulties on your server, thanks.

          Edit: To force WordPress to show updated version sooner go to Plugins -> Add New, search for Quick Flag and where it usually stands “Install” it will write “Update Now” (if older version is already installed).

          • Raphael July 23, 2012 at 16:14:43

            Now it worked, no error php, thanks :)

  • Tom Farrell July 22, 2012 at 18:55:39

    Hello
    I just updated this and got the following error.
    It was working fine before the update.

    Warning: require_once(__DIR__/deprecated.php): failed to open stream: No such file or directory in /usr/local/pem/vhosts/136697/webspace/siteapps/39051/htdocs/wp-content/plugins/quick-flag/quick-flag.php on line 2266 Fatal error: require_once(): Failed opening required ‘__DIR__/deprecated.php’ (include_path=’.:/usr/share/pear:/usr/share/php’) in /usr/local/pem/vhosts/136697/webspace/siteapps/39051/htdocs/wp-content/plugins/quick-flag/quick-flag.php on line 2266

    • Marko July 22, 2012 at 21:20:08

      Hi. Thanks for reporting problems. I’ve uploaded 2.01 version that fixes this bug, it should turn up as update in a few minutes.

  • Hamed June 25, 2012 at 18:33:36

    how can i use your quick flag plugin to just show the flag and country name in simple php file without using wordpress?
    thanks

    • Marko June 25, 2012 at 22:48:17

      Hello. This isn’t hard but you must know some PHP to use it. I can point you in the right direction if you are willing to do it your self (I recommend you try your self cause its a lot of fun) or you can hire me to do this for you?

      • Hamed June 26, 2012 at 06:49:58

        Unfortunately i’m newbie in coding…
        if you have time do me a favor and email me the ready source.
        thanks in advance

        • Marko June 26, 2012 at 08:37:18

          Unfortunately it’s a lot of work to be done as a favor. Cheers.

          • Hamed June 26, 2012 at 09:12:10

            ok so please give me the some help for begin!
            sorry for i was causing trouble…

  • Yasith April 25, 2012 at 05:34:57

    its great..thank u much