Currently 18:19:20 GMT

(Login | Register)

Owner: Stuart

Type: WPMU Plugin

Created: 2007-07-05 09:05:10

Last Modified: 2007-07-15 21:39:10


limit-country-signups.php (524 download(s))

I created this plugin for my site in NZ. I only wanted people in NZ to sign up for new blogs as I was getting tons of splogs from overseas. So I created a simple plugin which checks the IP address against a geolocation site. You can see it in action here: http://blogtown.co.nz/wp-signup.php - but only if you're not in NZ. Not every wpmu site would want this, but I thought I would share anyway... Here's a step-by-step (as requested):

  1. Download the plugin
  2. Edit the plugin and make changes to the error message (line 37) and the country code to look for (line 38)
  3. Copy the plugin to the 'mu-plugins' folder
  4. Test that it works



Posted 2007-07-05 18:32:21 by ovizii.

do you know of another ip-check-url? the one your plugin is using, returns XX for my countries IP... I am in Romania, it should return RO, you can test it with my this ip i.e. 86.122.60.97


Posted 2007-07-15 21:41:51 by stuart.

This was the easiest ip-checking service that I could find. There is a commercial one available here that you may want to check out: http://www.maxmind.com/ Also, try submitting your IP address using the form here: http://www.hostip.info/correct.html?spip=86.122.60.97 This will help to improve their service.


Posted 2007-07-25 05:28:29 by oxeen.

Hi. You can use the maxmind "free" file database as well. It is not 100% accurate on area lookup within cities but sure as hell do a good job on city and country level. I use it when parsing access logs. It is quite fast since it fits quite well in memory (if you allow it). It is better to do local db lookups than remote url ones (if service is down etc). It is the same as lighttpd uses in cojunction with mod_geoip. Some links: http://trac.lighttpd.net/trac/wiki/Docs%3AModGeoip http://www.maxmind.com/download/geoip/api/php/ If you have any questions I hopefully can help some... Kindly //Marcus


Posted 2007-07-25 05:31:47 by oxeen.

Oh and you can use it to generate google maps of where your users come from in the world like this. I have a similar oout there. http://vowe.net/visitors.php


Posted 2007-11-23 12:14:20 by gbishop.

How can i limit multiple country codes?


Posted 2007-11-23 12:23:37 by gbishop.

How can i limit multiple country codes?


You must be registered and logged in to post comments. Not registered? Click here to get your free account!