The MU forums have moved to WordPress.org

New plugin - limit signups to specific country (7 posts)

  1. amanzi
    Member
    Posted 15 years ago #

    Not everyone would want this, but I thought I would share anyway...

    I created a simple plugin which checks the IP address of visitors accessing the signup form. If they don't originate from a country of your choice, they receive an error message.

    http://wpmudevorg.wordpress.com/project/Limit-Country-Signups

    I wanted this because I only wanted my site to be used by people in NZ to keep that 'niche' feel. And I was getting heaps of splogs from overseas.

    If you're not in NZ you can see the plugin here: http://blogtown.co.nz/wp-signup.php

    (by the way... I know it's not fool-proof, but it works well enough.)

  2. lunabyte
    Member
    Posted 15 years ago #

    Hmmm... That's pretty spiffy for niche sites.

    Like you say, not fool proof, but every little bit helps.

  3. qrof
    Member
    Posted 15 years ago #

    Nice plugin! I've modified it though, changed the IP check to use GEOIP database which is more accurate imo, and also faster since it uses a local DB file.

    
    include("geoip.inc");
    $gi = geoip_open("GeoIP.dat",GEOIP_STANDARD);
    $country = geoip_country_code_by_addr($gi, $ip);
    if($country) != 'SI') {
      wp_die( $err_msg );
    }
    geoip_close($gi);
    

    GEOIP database is available at http://www.maxmind.com/app/geoip_country

  4. Ovidiu
    Member
    Posted 15 years ago #

    I'll give this mod a try, as the original, didn't even know about my current residential country :-) it just gave XX back instead of my countrycode...

  5. qrof
    Member
    Posted 15 years ago #

    That's why I've switched to GeoIP, seems it's more accurate.

  6. poddys
    Member
    Posted 13 years ago #

    I am looking for something similar, only to identify the country of a visitor so that I can display specific code in the sidebar.

    I have a set of rotating ads on Commission Junction, using a Smartzone, that just includes links from the USA. I would like to add multiple Smartzones with ads from specific countries, and display the appropriate one, depending on where the visitor is from.

    I am not sure what code I would need to add in the sidebar though. I am looking for something like...

    If country = GB display GB ad code, else display USA ad code.

    Thanks for any help...

  7. tdjcbe
    Member
    Posted 13 years ago #

    In all honestly, I'd ask CJ about that. Last time I checked, they had something in their AUP about modifying their code. I don't see a problem since all you;re doing is choosing which of their codes you want to display but they even might have something in place already for use.

    I was going to suggest http://blackholes.us for a source but I can;t get the site to come up.

    But anyway, maybe something like this as a start would be helpful:

    http://www.jasonlitka.com/2007/04/16/wordpress-plugin-block-countries/

About this Topic