Latest Register Log In

+ Advanced Search

Make registration easier from some countries

Make registration easier from some countries
By
10/06/14

Suppose you've set your member registration to require email verification, or even to manual validation or invite-only due to a high volume of spam. If your spam mostly comes from specific countries, this modification will allow you to loosen the registration requirements for people in safe countries. This requires that you have geolocation installed on the site.

Save the following code to /modifications/registration-begin.php (if you don't have a /modifications/ subdirectory, create it first):

<?php

if ($thismember->isguest())
{
$whitelistcountries = "United States,Canada,United Kingdom";
$ourcountry = $thismember->ipcountry();
if (strstr(",$whitelistcountries,", ",$ourcountry,")) $settings->registration = 'direct';
}

?>


Make sure you don't leave any spaces or newlines before <?php or after ?>.

The example above allows direct registration (no email verification) for anyone from the United States, Canada or United Kingdom. The rest of the world follows the registration setting you've selected at Admin Panel -> Members -> Member Settings. Possible values are:
direct - fully trusted
email - must click link in email to verify
validate - must be manually reviewed by admins
emailandmanual - must click link in email to verify, and then wait for admin to approve
invite - registration is by invitation-only
adminonly - only an admin can manually register people
disable - nobody can register

If you want to use a blacklist instead of a whitelist, just list bad countries and change 'direct' to the desired higher level of verification.




Rating
Views 279 views. Averaging 0 views per day.