IP 2 Nation Location Wordpress Plugin

I modified the wordpress plugin called IP 2 Nation in order to retrieve 2 important values of the ip2nation database used in the generation of maps: the Longitude and Latitude of the country based on the IP. This plugin is based on the version 1.1 by Ozh and Per Gustafsson.

This is my first plugin update for Wordpress, I hope it is useful. I am planning to use it to generate another plugin for create a Google Map based on the IP addresses of the comments of a user.

Any suggestion, is welcomed, thank you.


Set up the MySQL database (as mentioned on Ozh website)

First of all, go to ip2nation and download the .sql file (I’m not mirroring it because it is updated from times to times, so get the latest one) This .sql file will create two tables, ip2nation and ip2nationCountries.

Tips : first, install PHPMyAdmin on your website. This is a great interface for anything you can do with MySQL databases. Once it’s done, look for the “SQL” link in the menu : you will be prompted for a .sql file, for example the one you just downloaded on your computer. It will set up and populate the required tables.


Download the plugin

Wordpress plugin: IP 2 Nation Latitude and Longitude Update Version 1.0 - April 05, 2007, Downloads: 668 times

Click in the file and save it in your preferred drive. You will need a compression utility like WinZip to uncompress the zip file of the plugin; then drop the file “wp_vz_ip2nationlocation.php” in your plugin directory (yourblog/wp-content/plugins). Then activate the plugin (in the admin interface).

Note: If you have the previous version of IP 2 Nation you first need to deactivate it and delete the file “wp_ozh_ip2nation.php” of your wp-content/plugins directory.


Use the plugin

The use of this plugin is exactly the same as mentioned by Ozh in the original plugin page, I only added 2 extra functions to obtain the Latitude and Longitude of a country:

Both functions have two optional parameters:

As mentioned it implements exactly the two other functions defined by the original plugin: wp_ohz_getCountryName() and wp_ohz_getCountryCode(), you can see the definition and examples of these two function here.


Examples of use

Here is a simple example of using the two new functions implemented with the default parameters:

< ?php
echo “Your country Longitude is “.getCountryLon();
echo “Your country Latitude is “.getCountryLat();
?>

Another example with different parameters, where the Longitude and Latitude is printed and the IP is obtained from the comment author IP in Wordpress:

< ?php comment_author_link() ?>
from Longitude < ?php getCountryLon(1,$comment->comment_author_IP) ?>
and Latitude < ?php getCountryLat(1,$comment->comment_author_IP) ?>


Notes

If you need support, please be as simple, consistent and accurate as possible. If you need to post lines of code, please upload it somewhere and give me the information to check the code. I can not give support of anything in relation with ip2nation or the original IP 2 Nation Wordpress plugin.

Posted by Vadim Zendejas 05.Apr.07

You can follow any responses to this entry through the RSS 2.0 feed.
You can leave a response, or trackback from your own site.

22 Responses to “IP 2 Nation Location Wordpress Plugin”

  1. Written from Romania
    Andrei Gravura Says:

    That car looks awesome. I would pay anything to own it. Has anyone made any bids on it yet?:D Sow i want 2 o them if its possible

  2. Written from United States
    Classifieds Says:

    I really enjoyed reading this article. I didn’t know any of these! So glad to have found this.

  3. Written from United States
    Kristen Says:

    Hi there-

    Can this be used to call post author information instead of (or in addition to) comment authors?

    Thanks and best wishes,
    Kristen

  4. Written from United States
    Antione Apolo Says:

    Cool! But I alternative thoughts personally. But I unreservedly support your right to believe what you like.

  5. Written from Russia
    Roma Guerreiro Says:

    Heartfelt thanks to

  6. Written from United States
    Shonari Says:

    Can the plugin be mdified to pull a category based on location?

    ie the plugin will read the visitors latitude and longtitude and based on results will call for a category.

  7. Written from Philippines
    Ambo Says:

    open sesame! just testing. Thanks for this wonderful plugin.:-)

  8. Written from Japan
    sven Says:

    On my blog it always shows the flag of the country where my webhost is located (Germany), but never the actual poster’s country (Japan in my case)…
    Anyone knows how to solve this? :(

  9. Written from Venezuela
    impropio Says:

    prueba

  10. Written from Mexico
    - Says:

    hello :D

  11. Written from Great Britain (UK)
    Ugg Boots Says:

    Finest Ugg Boots anywhere.

  12. Written from Japan
    Vadim Zendejas Says:

    Welcome evitc… always is a pleasure to help, my best regards!

  13. Written from China
    evitc Says:

    Hi vadimz! I have fixed it and now it works correctly. Thank you again, my sincere friend!

  14. Written from China
    evitc Says:

    Hello vadimz, I have updated my database to the latest but still the wrong display.:-(

  15. Written from Japan
    Vadim Zendejas Says:

    Yeah, I see that the plug-in is displaying wrong the information, but is not a problem of the plug-in, is because your ip2nation database is not updated, I recommend to you that you download the latest version of it from http://www.ip2nation.com/
    Please install it and check if now the location is correct.
    I think the information of the browser and the OS is correct, if u don\’t want that this information appears, then you need to modify your comment template and delete that part.

    Please let me know about the results after upgrading the ip2nation database… Thanks.

  16. Written from China
    evitc Says:

    Vadizm, please help me. Wherever the commenter is, the plugin always display my location and my browser and OS info.

  17. Written from China
    evitc Says:

    I see it! Great Job! Thank you, I would like to install it for my weblog.

  18. Written from China
    evitc Says:

    leave a comment and have a look ^_^

  19. Written from Japan
    Vadim Zendejas Says:

    Hello marc, as you can see in the comment that you posted the flag of your country is displayed correctly. Anyway, the ip2nation database is not 100% accurate, and is not updated every day, so in some cases the IP address that your internet provider assigns to you can be misclassified. Any way, try to be updated with the most recent version of the ip2nation database.

  20. Written from Philippines
    marc Says:

    testing my flag.

    Using Oz’s ver and a change to DSL for whatever reason caused my flag to shift from the correct Philippines to the French Flag.

    Here goes.

  21. Written from Japan
    Vadim Zendejas Says:

    Again Nicky… if I understand, (is not that I speak Chinese, but Google Language Tools always help) I update the IP 2 Nation by Ozh just in order to create my new plugin “Comments on a Map” that I posted today here in my web page… so check it, maybe you will like it. Thanks.

  22. Written from Japan
    Vadim Zendejas Says:

    Thank you Nicky… can you post in English please?

4 pingbacks and 1 trackbacks to this post.

  1. ManyakHost // Tasarım » Post Topic » Wordpress Eklenti Sürümleri »» December 25th, 2007 at 1:24 am from Germany
  2. IP 2 Nation Location | わーどぷれすっ! »» July 23rd, 2007 at 7:02 pm from United States
  3. WP Plugins DB » Blog Archive » IP 2 Nation Longitude and Latitude Update »» May 20th, 2007 at 4:59 pm from United States
  4. WP Plugins April 8, 2007 « Blogtology »» April 9th, 2007 at 3:37 am from United States
  5. Nicky's blog »» April 6th, 2007 at 7:34 pm from China

Leave a Reply

IP 2 Nation Location Wordpress Plugin

I modified the wordpress plugin called IP 2 Nation in order to retrieve 2 important values of the ip2nation database used in the generation of maps: the Longitude and Latitude of the country based on the IP. This plugin is based on the version 1.1 by Ozh and Per Gustafsson.

This is my first plugin update for Wordpress, I hope it is useful. I am planning to use it to generate another plugin for create a Google Map based on the IP addresses of the comments of a user.

Any suggestion, is welcomed, thank you.


Set up the MySQL database (as mentioned on Ozh website)

First of all, go to ip2nation and download the .sql file (I’m not mirroring it because it is updated from times to times, so get the latest one) This .sql file will create two tables, ip2nation and ip2nationCountries.

Tips : first, install PHPMyAdmin on your website. This is a great interface for anything you can do with MySQL databases. Once it’s done, look for the “SQL” link in the menu : you will be prompted for a .sql file, for example the one you just downloaded on your computer. It will set up and populate the required tables.


Download the plugin

Wordpress plugin: IP 2 Nation Latitude and Longitude Update Version 1.0 - April 05, 2007, Downloads: 668 times

Click in the file and save it in your preferred drive. You will need a compression utility like WinZip to uncompress the zip file of the plugin; then drop the file “wp_vz_ip2nationlocation.php” in your plugin directory (yourblog/wp-content/plugins). Then activate the plugin (in the admin interface).

Note: If you have the previous version of IP 2 Nation you first need to deactivate it and delete the file “wp_ozh_ip2nation.php” of your wp-content/plugins directory.


Use the plugin

The use of this plugin is exactly the same as mentioned by Ozh in the original plugin page, I only added 2 extra functions to obtain the Latitude and Longitude of a country:

Both functions have two optional parameters:

As mentioned it implements exactly the two other functions defined by the original plugin: wp_ohz_getCountryName() and wp_ohz_getCountryCode(), you can see the definition and examples of these two function here.


Examples of use

Here is a simple example of using the two new functions implemented with the default parameters:

< ?php
echo “Your country Longitude is “.getCountryLon();
echo “Your country Latitude is “.getCountryLat();
?>

Another example with different parameters, where the Longitude and Latitude is printed and the IP is obtained from the comment author IP in Wordpress:

< ?php comment_author_link() ?>
from Longitude < ?php getCountryLon(1,$comment->comment_author_IP) ?>
and Latitude < ?php getCountryLat(1,$comment->comment_author_IP) ?>


Notes

If you need support, please be as simple, consistent and accurate as possible. If you need to post lines of code, please upload it somewhere and give me the information to check the code. I can not give support of anything in relation with ip2nation or the original IP 2 Nation Wordpress plugin.

Posted by Vadim Zendejas 05.Apr.07

You can follow any responses to this entry through the RSS 2.0 feed.
You can leave a response, or trackback from your own site.

22 Responses to “IP 2 Nation Location Wordpress Plugin”

  1. Written from Romania
    Andrei Gravura Says:

    That car looks awesome. I would pay anything to own it. Has anyone made any bids on it yet?:D Sow i want 2 o them if its possible

  2. Written from United States
    Classifieds Says:

    I really enjoyed reading this article. I didn’t know any of these! So glad to have found this.

  3. Written from United States
    Kristen Says:

    Hi there-

    Can this be used to call post author information instead of (or in addition to) comment authors?

    Thanks and best wishes,
    Kristen

  4. Written from United States
    Antione Apolo Says:

    Cool! But I alternative thoughts personally. But I unreservedly support your right to believe what you like.

  5. Written from Russia
    Roma Guerreiro Says:

    Heartfelt thanks to

  6. Written from United States
    Shonari Says:

    Can the plugin be mdified to pull a category based on location?

    ie the plugin will read the visitors latitude and longtitude and based on results will call for a category.

  7. Written from Philippines
    Ambo Says:

    open sesame! just testing. Thanks for this wonderful plugin.:-)

  8. Written from Japan
    sven Says:

    On my blog it always shows the flag of the country where my webhost is located (Germany), but never the actual poster’s country (Japan in my case)…
    Anyone knows how to solve this? :(

  9. Written from Venezuela
    impropio Says:

    prueba

  10. Written from Mexico
    - Says:

    hello :D

  11. Written from Great Britain (UK)
    Ugg Boots Says:

    Finest Ugg Boots anywhere.

  12. Written from Japan
    Vadim Zendejas Says:

    Welcome evitc… always is a pleasure to help, my best regards!

  13. Written from China
    evitc Says:

    Hi vadimz! I have fixed it and now it works correctly. Thank you again, my sincere friend!

  14. Written from China
    evitc Says:

    Hello vadimz, I have updated my database to the latest but still the wrong display.:-(

  15. Written from Japan
    Vadim Zendejas Says:

    Yeah, I see that the plug-in is displaying wrong the information, but is not a problem of the plug-in, is because your ip2nation database is not updated, I recommend to you that you download the latest version of it from http://www.ip2nation.com/
    Please install it and check if now the location is correct.
    I think the information of the browser and the OS is correct, if u don\’t want that this information appears, then you need to modify your comment template and delete that part.

    Please let me know about the results after upgrading the ip2nation database… Thanks.

  16. Written from China
    evitc Says:

    Vadizm, please help me. Wherever the commenter is, the plugin always display my location and my browser and OS info.

  17. Written from China
    evitc Says:

    I see it! Great Job! Thank you, I would like to install it for my weblog.

  18. Written from China
    evitc Says:

    leave a comment and have a look ^_^

  19. Written from Japan
    Vadim Zendejas Says:

    Hello marc, as you can see in the comment that you posted the flag of your country is displayed correctly. Anyway, the ip2nation database is not 100% accurate, and is not updated every day, so in some cases the IP address that your internet provider assigns to you can be misclassified. Any way, try to be updated with the most recent version of the ip2nation database.

  20. Written from Philippines
    marc Says:

    testing my flag.

    Using Oz’s ver and a change to DSL for whatever reason caused my flag to shift from the correct Philippines to the French Flag.

    Here goes.

  21. Written from Japan
    Vadim Zendejas Says:

    Again Nicky… if I understand, (is not that I speak Chinese, but Google Language Tools always help) I update the IP 2 Nation by Ozh just in order to create my new plugin “Comments on a Map” that I posted today here in my web page… so check it, maybe you will like it. Thanks.

  22. Written from Japan
    Vadim Zendejas Says:

    Thank you Nicky… can you post in English please?

4 pingbacks and 1 trackbacks to this post.

  1. ManyakHost // Tasarım » Post Topic » Wordpress Eklenti Sürümleri »» December 25th, 2007 at 1:24 am from Germany
  2. IP 2 Nation Location | わーどぷれすっ! »» July 23rd, 2007 at 7:02 pm from United States
  3. WP Plugins DB » Blog Archive » IP 2 Nation Longitude and Latitude Update »» May 20th, 2007 at 4:59 pm from United States
  4. WP Plugins April 8, 2007 « Blogtology »» April 9th, 2007 at 3:37 am from United States
  5. Nicky's blog »» April 6th, 2007 at 7:34 pm from China

Leave a Reply