Community Support Forums — WordPress® ( Users Helping Users ) — 2012-01-18T09:51:25-05:00 http://www.primothemes.com/forums/feed.php?f=4&t=607 2012-01-18T09:51:25-05:00 http://www.primothemes.com/forums/viewtopic.php?t=607&p=60881#p60881 <![CDATA[Re: Clearing punished members]]>
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:
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:
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

Statistics: Posted by foliovision — January 18th, 2012, 9:51 am


]]>
2012-01-18T09:15:31-05:00 http://www.primothemes.com/forums/viewtopic.php?t=607&p=60880#p60880 <![CDATA[Re: Clearing punished members]]>
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

Statistics: Posted by foliovision — January 18th, 2012, 9:15 am


]]>
2010-11-18T11:25:48-05:00 http://www.primothemes.com/forums/viewtopic.php?t=607&p=4761#p4761 <![CDATA[Re: Clearing punished members]]> Statistics: Posted by sugeneris — November 18th, 2010, 11:25 am


]]>
2010-08-27T14:26:08-05:00 http://www.primothemes.com/forums/viewtopic.php?t=607&p=2624#p2624 <![CDATA[Re: Clearing punished members]]> 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:
$restriction = strtolower("JohnDoe22");
delete_transient (md5 ("s2member_ip_restrictions_" . $restriction . "_breached"));

$restriction = the Username ( lowercase ).

@TODO :: API function to list all punishments.

Statistics: Posted by Jason Caldwell — August 27th, 2010, 2:26 pm


]]>
2010-08-24T14:30:42-05:00 http://www.primothemes.com/forums/viewtopic.php?t=607&p=2559#p2559 <![CDATA[Clearing punished members]]>
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

Statistics: Posted by Nemrod Kedem — August 24th, 2010, 2:30 pm


]]>