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:

DOWNLOAD Quick Flag 2.11 from WordPress.org
DevGenii

A quality focused Magento specialized web development agency. Get in touch!

50 thoughts on “Quick Flag

    1. Marko Author

      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?

      Reply
  1. Tom Farrell

    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

    Reply
    1. Marko Author

      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.

      Reply
  2. Raphael

    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

    Reply
    1. Marko Author

      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.

      Reply
      1. Raphael

        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

        Reply
        1. Marko Author

          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).

          Reply
  3. Tom+Farrell

    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

    Reply
  4. Alex

    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.

    Reply
    1. Marko Author

      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?

      Reply
      1. Alex

        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!!

        Reply
  5. Alvaro

    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!

    Reply
    1. Marko Author

      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) &amp;&amp; is_object($quick_flag)){
          if(($info = $quick_flag-&gt;get_info(get_comment_author_IP())) != false){
              echo $quick_flag-&gt;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!

      Reply
      1. Alvaro

        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.

        Reply
        1. Marko Author

          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 😉

          Reply
  6. Alex

    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!

    Reply
    1. Marko Author

      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!

      Reply
      1. Alex

        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.

        Reply
        1. Marko Author

          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.

          Reply
          1. Alex

            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!

            Reply
            1. Marko Author

              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.

              Reply
    1. Marko Author

      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).

      Reply
  7. Louis

    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

    Reply
    1. Marko Author

      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?

      Reply
  8. TMP

    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…..

    Reply
  9. Riliwan Balogun

    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

    Reply
  10. Nick H

    Hi Marko

    I recently added an iframe to my page and it has broken both Quick Flag and Quick Chat (neither load properly) – can you think of any reason it would do that? Even just an empty frame on the page does it, so I don’t think it’s related to javascript. Any help would be appreciated!

    Thanks for a great plugin.

    Reply
    1. Nick H

      Hi Marko – sorry to bother you again, but you have any ideas on this? It is really causing me a problem! Many thanks again.

      Reply
      1. Marko Author

        Hi,
        this isn’t expected behaviour, unfortunately I really have no idea why this is happening. You can open your browser console and reload page with Quick Chat and look for errors. Quick Chat rarely fails without throwing a Javascript error. This should point you in the right direction.

        Cheers!

        Reply
        1. Nick H

          Hi Marko

          Thanks for getting back to me. In this case, it’s definitely not throwing any JS errors – it just says “Loading” for Quick Chat and never actually loads the chat itself. As soon as I remove the iframe it works fine – and I don’t see why that would interfere with JS, really… Thanks for your reply nonetheless, I’ll keep hunting (the page is at http://www.peoplesattitude.net/canada/) if you’re interested

          Cheers

          Reply
  11. Benjamin

    What does your comment.php code say for this blog here. I am trying to insert quick flag similar to how you have done so on this blog and curious to see your code and how you did it so I can integrate it into my theme.

    Reply
    1. Marko Author

      Hi Benjamin,
      I have simply replaced call to comment_author() with call to my customized function similar to following:

      1
      2
      3
      4
      5
      6
      7
      8
      9
      10
      11
      12
      13
      
      <?php
      function custom_comment_author(){
          $string = get_comment_author_link();
       
          global $quick_flag;
          if(isset($quick_flag) && is_object($quick_flag)){
              if(($info = $quick_flag->get_info(get_comment_author_IP())) != false){
                  $string = sprintf(__('%s  %s', 'inove'), $string, $quick_flag->get_flag($info, 'inove-country-flag'));
              }
          }
       
          return $string;
      }

      Good luck!

      Reply
  12. Scott

    I am getting the following error when I try updating the database.

    Couldn’t write Quick Flag database zip file to local file system

    I have already set the /wp-content/plugins/quick-flag/database directory to 0777.

    Any ideas?

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *