Using the GeoIP module with Context GeoIP module, it makes it really easy to create a context which has a specific condition to only display a block if your IP location is from a particular country.
Furthermore GeoIP has a powerful API to pull out location information.
In this article I’ll show you how to setup GeoIP and Context GeoIP module.
A few modules will need to be downloaded before we start. Download the following modules:
Once the modules have been downloaded go and enable the GeoIP and Context GeoIP module.
Once you have enabled GeoIP you’ll have to download the MaxMind database file.
The country binary file can be downloaded from: http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz
Once you have downloaded the file, uncompress the file and copy it into “sites/all/libraries/geoip”. To make sure everything is working to go “admin/settings/geoip” and if you get an error, double check and make sure the binary file is in “sites/all/libraries/geoip”.
Context Geo IP
If you haven’t already done so go and enable the Context Geo IP module. NOTE: Don’t forget to enable Context and Ctools.
Now go to a context rule and you should see Geo IP in the condition select box.
And there you have it, now you can create context rules for a specific IP location.