Page 1 of 1

GEO filtering

PostPosted: March 23rd, 2011, 12:43 pm
by jb1360
I'd like to TURN OFF S2Member (making the site completely free) in certain zip codes. Getting the GEO info is being handled by maxmind.com.

Whats the best way to effectively turn off S2member dynamically?

Re: GEO filtering

PostPosted: March 23rd, 2011, 8:26 pm
by Cristián Lávaque
Well, s2Member doesn't do that off the box, but you could create something to make it work the way you need it.

What comes to mind is to use conditions where you'd protect content, instead of protecting the whole page. If you have a function that checks the user's location, you can then determine if s2Member should have anything to do with him or not.

Code: Select all
<?php
if 
(dont_use_s2member_with_this_user() || current_user_is('s2member_level1')) {
    echo 'The content goes here.';
}
 else {
    echo 'A message asking him to purchase access.';
}
?>


You could probably also have anything that s2Member would moderate access to, go through the function automatically using a hook, and decide there if s2Member has to mess with that person or not.