PriMoThemes — now s2Member® (official notice)

This is now a very OLD forum system. It's in READ-ONLY mode.
All community interaction now occurs at WP Sharks™. See: new forums @ WP Sharks™

Clearing punished members

s2Member Plugin. A Membership plugin for WordPress®.

Clearing punished members

Postby Nemrod Kedem » August 24th, 2010, 2:30 pm

Hi,

Is there a way to list the members that have been punished by the Unique IP Access Restrictions?
Is there a way to reset them so they can get back to work without waiting for the punish to end?
Is there a (future) way to exclude members from being punished?

Thanks,
Nemrod Kedem
User avatar
Nemrod Kedem
Registered User
Registered User
 
Posts: 5
Joined: August 15, 2010

Re: Clearing punished members

Postby Jason Caldwell » August 27th, 2010, 2:26 pm

Hi there. Thanks for the great question.

No, there's not currently a method built into s2Member that can list all punishments.
However, you can use this method to remove punishments early if you like:

Code: Select all
$restriction = strtolower("JohnDoe22");
delete_transient (md5 ("s2member_ip_restrictions_" . $restriction . "_breached"));

$restriction = the Username ( lowercase ).

@TODO :: API function to list all punishments.
~ Jason Caldwell / Lead Developer
& Zeitgeist Movie Advocate: http://www.zeitgeistmovie.com/

Is the s2Member plugin working for you? Please rate s2Member at WordPress.org.
You'll need a WordPress.org account ( comes in handy ). Then rate s2Member here Image
.
User avatar
Jason Caldwell
Lead Developer
Lead Developer
 
Posts: 4045
Joined: May 3, 2010
Location: Georgia / USA

Re: Clearing punished members

Postby sugeneris » November 18th, 2010, 11:25 am

In case votes matter at all, I have a client who's just asked for such a listing.
User avatar
sugeneris
Registered User
Registered User
 
Posts: 20
Joined: October 15, 2010

Re: Clearing punished members

Postby foliovision » January 18th, 2012, 9:15 am

Hello Jason,

I can see that this thread was created shortly after I posted the same question here: viewtopic.php?f=4&t=14345

When can we expect this list of users who use too many IPs?

Can you at least give us a piece of code which would exclude a single user from these restrictions? Looking at the code, it looks like there is a filter hook called ws_plugin__s2member_disable_all_ip_restrictions which has to return false, otherwise the check will be skipped.

However I could not debug that, as I couldn't get the includes/classes/ip-restrictions.inc.php file to load for my test user.

Any help would be appreciated.

Thanks,
Martin
User avatar
foliovision
Customer
Customer
 
Posts: 30
Joined: August 4, 2011

Re: Clearing punished members

Postby foliovision » January 18th, 2012, 9:51 am

Hello Jason,

actually here is the code, I'm just not sure if the filter is used at all.

Otherwise it's simple. If user post meta is set, then a function is hooked onto the filter hook, which should exclude user from IP restrictions:

Code: Select all
add_action( 'wp', 'custom_user_exclude_ip_restrictions_check_user' );

function 'custom_user_exclude_ip_restrictions_check_user() {
   $current_user = wp_get_current_user();
   if( is_object($current_user) ) {
      $exclude = get_user_meta( $current_user->ID, 'exclude_ip_restriction', true );

      if( isset($exclude) && $exclude == 'on' ) {
         add_filter( 'ws_plugin__s2member_disable_all_ip_restrictions', 'custom_user_exclude_ip_restrictions_filter' );

      }
   }
}

function custom_user_exclude_ip_restrictions_filter() {

   return true;
}


This is the IF statement I was trying to affect with this (s2member/includes/classes/ip-restrictions.inc.php):
Code: Select all
if (!apply_filters ("ws_plugin__s2member_disable_all_ip_restrictions", false, get_defined_vars ())
                  /* Also allow specific exclusions here. */ && !apply_filters ("ws_plugin__s2member_disable_specific_ip_restriction", false, get_defined_vars ())
                  /* And enabled by site owner? */ && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["max_ip_restriction"] /* And a valid ``$restriction``? */ && $restriction && is_string ($restriction)


I have this code up and running and the site works for me, but it's highly experimental.

Thanks,
Martin
User avatar
foliovision
Customer
Customer
 
Posts: 30
Joined: August 4, 2011


Return to s2Member Plugin

Who is online

Users browsing this forum: Google [Bot] and 1 guest

cron