/**
  * Listens to Collective EOT/MOD Events processed internally by s2Member.
  *
  * This is only applicable when ``['custom_reg_auto_opt_outs']`` contains related Event(s).
  *
  * @package s2Member\List_Servers
  * @since 3.5
  *
  * @attaches-to ``add_action('ws_plugin__s2member_during_collective_mods');``
  * @attaches-to ``add_action('ws_plugin__s2member_during_collective_eots');``
  *
  * @param int|string $user_id Required. A WordPress User ID, numeric string or integer.
  * @param array      $vars Required. An array of defined variables passed by the calling Hook.
  * @param string     $event Required. A specific event that triggered this call from the Action Hook.
  * @param string     $event_spec Required. A specific event specification *(a broader classification)*.
  * @param string     $mod_new_role Required if ``$event_spec === 'modification'`` (but can be empty). Role the User is being modified to.
  * @param string     $mod_new_user Optional. If ``$event_spec === 'modification'``, the new User object with current details.
  * @param string     $mod_old_user Optional. If ``$event_spec === 'modification'``, the old/previous User obj with old details.
  */
 public static function auto_process_list_server_removals($user_id, $vars, $event, $event_spec, $mod_new_role = NULL, $mod_new_user = NULL, $mod_old_user = NULL)
 {
     global $current_site, $current_blog;
     // For Multisite support.
     static $auto_processed = array();
     foreach (array_keys(get_defined_vars()) as $__v) {
         $__refs[$__v] =& ${$__v};
     }
     do_action('ws_plugin__s2member_before_auto_process_list_server_removals', get_defined_vars());
     unset($__refs, $__v);
     $custom_reg_auto_op_outs = c_ws_plugin__s2member_utils_strings::wrap_deep($GLOBALS['WS_PLUGIN__']['s2member']['o']['custom_reg_auto_opt_outs'], '/^', '$/i');
     if (c_ws_plugin__s2member_list_servers::list_servers_integrated() && $user_id && is_numeric($user_id) && !in_array($user_id, $auto_processed) && is_array($vars) && is_string($event = (string) $event) && is_string($event_spec = (string) $event_spec) && (c_ws_plugin__s2member_utils_arrays::in_regex_array($event, $custom_reg_auto_op_outs) || c_ws_plugin__s2member_utils_arrays::in_regex_array($event_spec, $custom_reg_auto_op_outs)) && is_object($user = $_user = new WP_User($user_id)) && !empty($user->ID)) {
         $mod_new_role = $event_spec === 'modification' && $mod_new_role && is_string($mod_new_role) ? $mod_new_role : FALSE;
         // Might be empty(i.e. they now have NO Role).
         $mod_new_user = $event_spec === 'modification' && $mod_new_user && is_object($mod_new_user) && !empty($mod_new_user->ID) && $mod_new_user->ID === $_user->ID ? $mod_new_user : FALSE;
         $mod_old_user = $event_spec === 'modification' && $mod_old_user && is_object($mod_old_user) && !empty($mod_old_user->ID) && $mod_old_user->ID === $_user->ID ? $mod_old_user : FALSE;
         $user = $event_spec === 'modification' && $mod_old_user ? $mod_old_user : $_user;
         // Now, should we switch over to the old/previous User object ``$mod_old_user`` here? Or, should we use the one pulled by this routine with the User's ID?
         if (($event_spec !== 'modification' || $event_spec === 'modification' && (string) $mod_new_role !== c_ws_plugin__s2member_user_access::user_access_role($user) && strtotime($user->user_registered) < strtotime('-10 seconds') && ($event !== 'user-role-change' || $event === 'user-role-change' && !empty($vars['_p']['ws_plugin__s2member_custom_reg_auto_opt_out_transitions']))) && ($auto_processed[$user->ID] = TRUE)) {
             $removed = c_ws_plugin__s2member_list_servers::process_list_server_removals(c_ws_plugin__s2member_user_access::user_access_role($user), c_ws_plugin__s2member_user_access::user_access_level($user), $user->user_login, FALSE, $user->user_email, $user->first_name, $user->last_name, FALSE, TRUE, $user->ID);
             if ($event_spec === 'modification' && $mod_new_role && ($GLOBALS['WS_PLUGIN__']['s2member']['o']['custom_reg_auto_opt_out_transitions'] === '2' || $GLOBALS['WS_PLUGIN__']['s2member']['o']['custom_reg_auto_opt_out_transitions'] === '1' && $removed)) {
                 $user = $event_spec === 'modification' && $mod_new_user ? $mod_new_user : $_user;
                 // Now, should we switch over to a new/current User object ``$mod_new_user`` here? (which may contain newly updated details). Or, should we simply use the User object pulled by this routine with the User's ID?
                 $transitioned = c_ws_plugin__s2member_list_servers::process_list_servers($mod_new_role, c_ws_plugin__s2member_user_access::user_access_role_to_level($mod_new_role), $user->user_login, FALSE, $user->user_email, $user->first_name, $user->last_name, FALSE, TRUE, $removed ? FALSE : TRUE, $user->ID);
                 foreach (array_keys(get_defined_vars()) as $__v) {
                     $__refs[$__v] =& ${$__v};
                 }
                 do_action('ws_plugin__s2member_during_auto_process_list_server_removal_transitions', get_defined_vars());
                 unset($__refs, $__v);
             }
             foreach (array_keys(get_defined_vars()) as $__v) {
                 $__refs[$__v] =& ${$__v};
             }
             do_action('ws_plugin__s2member_during_auto_process_list_server_removals', get_defined_vars());
             unset($__refs, $__v);
         }
     }
     foreach (array_keys(get_defined_vars()) as $__v) {
         $__refs[$__v] =& ${$__v};
     }
     do_action('ws_plugin__s2member_after_auto_process_list_server_removals', get_defined_vars());
     unset($__refs, $__v);
 }
예제 #2
0
 /**
  * Adds Custom Fields to the admin Profile editing page.
  *
  * @package s2Member\Users_List
  * @since 3.5
  *
  * @attaches-to ``add_action("edit_user_profile");``
  * @attaches-to ``add_action("show_user_profile");``
  *
  * @param obj $user Expects a `WP_User` object passed in by the Action Hook.
  * @return null
  */
 public static function users_list_edit_cols($user = FALSE)
 {
     global $current_site, $current_blog;
     foreach (array_keys(get_defined_vars()) as $__v) {
         $__refs[$__v] =& ${$__v};
     }
     do_action("ws_plugin__s2member_before_users_list_edit_cols", get_defined_vars());
     unset($__refs, $__v);
     $current_user = is_user_logged_in() ? wp_get_current_user() : false;
     // Current User.
     if (is_object($user) && !empty($user->ID) && ($user_id = $user->ID) && is_object($current_user) && !empty($current_user->ID)) {
         $role = c_ws_plugin__s2member_user_access::user_access_role($user);
         // This User's current WordPress Role.
         $level = c_ws_plugin__s2member_user_access::user_access_level($user);
         // User's Access Level for s2Member.
         if (current_user_can("edit_users") && (!is_multisite() || is_super_admin() || is_user_member_of_blog($user_id))) {
             echo '<div style="margin:25px 0 25px 0; height:1px; line-height:1px; background:#CCCCCC;"></div>' . "\n";
             echo '<h3 style="position:relative;"><img src="' . esc_attr($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"]) . '/images/large-icon.png" title="s2Member (a Membership management system for WordPress)" alt="" style="position:absolute; top:-15px; right:0; border:0;" />s2Member Configuration &amp; Profile Fields' . (is_multisite() ? ' (for this Blog)' : '') . '</h3>' . "\n";
             echo '<table class="form-table">' . "\n";
             foreach (array_keys(get_defined_vars()) as $__v) {
                 $__refs[$__v] =& ${$__v};
             }
             do_action("ws_plugin__s2member_during_users_list_edit_cols_before", get_defined_vars());
             unset($__refs, $__v);
             if (is_multisite() && is_super_admin()) {
                 foreach (array_keys(get_defined_vars()) as $__v) {
                     $__refs[$__v] =& ${$__v};
                 }
                 do_action("ws_plugin__s2member_during_users_list_edit_cols_before_originating_blog", get_defined_vars());
                 unset($__refs, $__v);
                 echo '<tr>' . "\n";
                 echo '<th><label for="ws-plugin--s2member-profile-s2member-originating-blog">Originating Blog ID#:</label> <a href="#" onclick="alert(\'On a Multisite Network, this is how s2Member keeps track of which Blog each User/Member originated from. So this ID#, is automatically associated with a Blog in your Network, matching the User\\\'s point of origin. ~ ONLY a Super Admin can modify this.\\n\\nOn a Multisite Blog Farm, the Originating Blog ID# for your own Customers, will ALWAYS be associated with your (Main Site). It is NOT likely that you\\\'ll need to modify this manually, but s2Member makes it available; just in case.\\n\\n*Tip* - If you add Users (and/or Blogs) with the `Super Admin` Network Administration panel inside WordPress, then you WILL need to set everything manually. s2Member does NOT tamper with automation routines whenever YOU (as a Super Administrator) are working in that area.\'); return false;" tabindex="-1">[?]</a></th>' . "\n";
                 echo '<td><input type="text" autocomplete="off" name="ws_plugin__s2member_profile_s2member_originating_blog" id="ws-plugin--s2member-profile-s2member-originating-blog" value="' . format_to_edit(get_user_meta($user_id, "s2member_originating_blog", true)) . '" class="regular-text" /></td>' . "\n";
                 echo '</tr>' . "\n";
                 foreach (array_keys(get_defined_vars()) as $__v) {
                     $__refs[$__v] =& ${$__v};
                 }
                 do_action("ws_plugin__s2member_during_users_list_edit_cols_after_originating_blog", get_defined_vars());
                 unset($__refs, $__v);
             }
             foreach (array_keys(get_defined_vars()) as $__v) {
                 $__refs[$__v] =& ${$__v};
             }
             do_action("ws_plugin__s2member_during_users_list_edit_cols_before_subscr_gateway", get_defined_vars());
             unset($__refs, $__v);
             echo '<tr>' . "\n";
             echo '<th><label for="ws-plugin--s2member-profile-s2member-subscr-gateway">Paid Subscr. Gateway:</label> <a href="#" onclick="alert(\'A Payment Gateway code is associated with the Paid Subscr. ID below. A Paid Subscription ID (or a Buy Now Transaction ID) is only valid for paid Members. Also known as (a Recurring Profile ID, a ClickBank Receipt #, a Google Order ID, an AliPay Trade No.). This will be filled automatically by s2Member.\\n\\nThis field will be empty for Free Subscribers, and/or anyone who is NOT paying you. This field is only editable for Customer Service purposes; just in case you ever need to update the Paid Subscr. Gateway/ID manually.\\n\\nThe value of Paid Subscr. ID, can be a PayPal Standard `Subscription ID`, or a PayPal Pro `Recurring Profile ID`, or a PayPal `Transaction ID`; depending on the type of sale. Your PayPal account will supply this information. If you\\\'re using Google Wallet, use the Google Order ID. ClickBank provides a Receipt #, ccBill provides a Subscription ID, Authorize.Net provides a Subscription ID, and AliPay provides a Transaction ID. The general rule is... IF there\\\'s a Subscription ID, use that! If there\\\'s NOT, use the Transaction ID.\'); return false;" tabindex="-1">[?]</a></th>' . "\n";
             echo '<td><select name="ws_plugin__s2member_profile_s2member_subscr_gateway" id="ws-plugin--s2member-profile-s2member-subscr-gateway" style="width:25em;"><option value=""></option>' . "\n";
             foreach (apply_filters("ws_plugin__s2member_profile_s2member_subscr_gateways", array("paypal" => "PayPal (code: paypal)"), get_defined_vars()) as $gateway => $gateway_name) {
                 echo '<option value="' . esc_attr($gateway) . '"' . ($gateway === get_user_option("s2member_subscr_gateway", $user_id) ? ' selected="selected"' : '') . '>' . esc_html($gateway_name) . '</option>' . "\n";
             }
             echo '</select>' . "\n";
             echo '</td>' . "\n";
             echo '</tr>' . "\n";
             foreach (array_keys(get_defined_vars()) as $__v) {
                 $__refs[$__v] =& ${$__v};
             }
             do_action("ws_plugin__s2member_during_users_list_edit_cols_after_subscr_gateway", get_defined_vars());
             unset($__refs, $__v);
             foreach (array_keys(get_defined_vars()) as $__v) {
                 $__refs[$__v] =& ${$__v};
             }
             do_action("ws_plugin__s2member_during_users_list_edit_cols_before_subscr_id", get_defined_vars());
             unset($__refs, $__v);
             echo '<tr>' . "\n";
             echo '<th><label for="ws-plugin--s2member-profile-s2member-subscr-id">Paid Subscr. ID:</label> <a href="#" onclick="alert(\'A Paid Subscription ID (or a Buy Now Transaction ID) is only valid for paid Members. Also known as (a Recurring Profile ID, a ClickBank Receipt #, a Google Order ID, an AliPay Trade No.). This will be filled automatically by s2Member.\\n\\nThis field will be empty for Free Subscribers, and/or anyone who is NOT paying you. This field is only editable for Customer Service purposes; just in case you ever need to update the Paid Subscr. Gateway/ID manually.\\n\\nThe value of Paid Subscr. ID, can be a PayPal Standard `Subscription ID`, or a PayPal Pro `Recurring Profile ID`, or a PayPal `Transaction ID`; depending on the type of sale. Your PayPal account will supply this information. If you\\\'re using Google Wallet, use the Google Order ID. ClickBank provides a Receipt #, ccBill provides a Subscription ID, Authorize.Net provides a Subscription ID, and AliPay provides a Transaction ID. The general rule is... IF there\\\'s a Subscription ID, use that! If there\\\'s NOT, use the Transaction ID.\'); return false;" tabindex="-1">[?]</a></th>' . "\n";
             echo '<td><input type="text" autocomplete="off" name="ws_plugin__s2member_profile_s2member_subscr_id" id="ws-plugin--s2member-profile-s2member-subscr-id" value="' . format_to_edit(get_user_option("s2member_subscr_id", $user_id)) . '" class="regular-text" /></td>' . "\n";
             echo '</tr>' . "\n";
             foreach (array_keys(get_defined_vars()) as $__v) {
                 $__refs[$__v] =& ${$__v};
             }
             do_action("ws_plugin__s2member_during_users_list_edit_cols_after_subscr_id", get_defined_vars());
             unset($__refs, $__v);
             foreach (array_keys(get_defined_vars()) as $__v) {
                 $__refs[$__v] =& ${$__v};
             }
             do_action("ws_plugin__s2member_during_users_list_edit_cols_before_custom", get_defined_vars());
             unset($__refs, $__v);
             echo '<tr>' . "\n";
             echo '<th><label for="ws-plugin--s2member-profile-s2member-custom">Custom Value:</label> <a href="#" onclick="alert(\'A Paid Subscription is always associated with a Custom String that is passed through the custom=\\\'\\\'' . c_ws_plugin__s2member_utils_strings::esc_js_sq(esc_attr($_SERVER["HTTP_HOST"]), 3) . '\\\'\\\' attribute of your Shortcode. This Custom Value, MUST always start with your domain name. However, you can also pipe delimit additional values after your domain, if you need to.\\n\\nFor example:\\n' . c_ws_plugin__s2member_utils_strings::esc_js_sq(esc_attr($_SERVER["HTTP_HOST"]), 3) . '|cv1|cv2|cv3\'); return false;" tabindex="-1">[?]</a></th>' . "\n";
             echo '<td><input type="text" autocomplete="off" name="ws_plugin__s2member_profile_s2member_custom" id="ws-plugin--s2member-profile-s2member-custom" value="' . format_to_edit(get_user_option("s2member_custom", $user_id)) . '" class="regular-text" /></td>' . "\n";
             echo '</tr>' . "\n";
             foreach (array_keys(get_defined_vars()) as $__v) {
                 $__refs[$__v] =& ${$__v};
             }
             do_action("ws_plugin__s2member_during_users_list_edit_cols_after_custom", get_defined_vars());
             unset($__refs, $__v);
             foreach (array_keys(get_defined_vars()) as $__v) {
                 $__refs[$__v] =& ${$__v};
             }
             do_action("ws_plugin__s2member_during_users_list_edit_cols_before_registration_ip", get_defined_vars());
             unset($__refs, $__v);
             echo '<tr>' . "\n";
             echo '<th><label for="ws-plugin--s2member-profile-s2member-registration-ip">Registration IP:</label> <a href="#" onclick="alert(\'This is the IP Address the User had at the time of registration. If you don\\\'t know the User\\\'s IP Address, just leave this blank. If this is left empty, s2Member will make attempts in the future to grab the User\\\'s IP Address.\'); return false;" tabindex="-1">[?]</a></th>' . "\n";
             echo '<td><input type="text" autocomplete="off" name="ws_plugin__s2member_profile_s2member_registration_ip" id="ws-plugin--s2member-profile-s2member-registration-ip" value="' . format_to_edit(get_user_option("s2member_registration_ip", $user_id)) . '" class="regular-text" /></td>' . "\n";
             echo '</tr>' . "\n";
             foreach (array_keys(get_defined_vars()) as $__v) {
                 $__refs[$__v] =& ${$__v};
             }
             do_action("ws_plugin__s2member_during_users_list_edit_cols_after_registration_ip", get_defined_vars());
             unset($__refs, $__v);
             if (!is_multisite() || !c_ws_plugin__s2member_utils_conds::is_multisite_farm() || is_main_site()) {
                 foreach ($user->allcaps as $cap => $cap_enabled) {
                     if (preg_match("/^access_s2member_ccap_/", $cap)) {
                         $ccaps[] = preg_replace("/^access_s2member_ccap_/", "", $cap);
                     }
                 }
                 foreach (array_keys(get_defined_vars()) as $__v) {
                     $__refs[$__v] =& ${$__v};
                 }
                 do_action("ws_plugin__s2member_during_users_list_edit_cols_before_ccaps", get_defined_vars());
                 unset($__refs, $__v);
                 echo '<tr>' . "\n";
                 echo '<th><label for="ws-plugin--s2member-profile-s2member-ccaps">Custom Capabilities:</label> <a href="#" onclick="alert(\'Optional. This is VERY advanced.\\nSee: s2Member -› API Scripting -› Custom Capabilities.' . (is_multisite() ? '\\n\\nCustom Capabilities are assigned on a per-Blog basis. So having a set of Custom Capabilities for one Blog, and having NO Custom Capabilities on another Blog - is very common. This is how permissions are designed to work.' : '') . '\'); return false;" tabindex="-1">[?]</a>' . (is_multisite() ? '<br /><small>(for this Blog)</small>' : '') . '</th>' . "\n";
                 echo '<td><input type="text" autocomplete="off" name="ws_plugin__s2member_profile_s2member_ccaps" id="ws-plugin--s2member-profile-s2member-ccaps" value="' . format_to_edit(!empty($ccaps) ? implode(",", $ccaps) : "") . '" class="regular-text" onkeyup="if(this.value.match(/[^a-z_0-9,]/)) this.value = jQuery.trim (jQuery.trim (this.value).replace (/[ \\-]/g, \'_\').replace (/[^a-z_0-9,]/gi, \'\').toLowerCase ());" /></td>' . "\n";
                 echo '</tr>' . "\n";
                 foreach (array_keys(get_defined_vars()) as $__v) {
                     $__refs[$__v] =& ${$__v};
                 }
                 do_action("ws_plugin__s2member_during_users_list_edit_cols_after_ccaps", get_defined_vars());
                 unset($__refs, $__v);
             }
             if (!$user->has_cap("administrator")) {
                 foreach (array_keys(get_defined_vars()) as $__v) {
                     $__refs[$__v] =& ${$__v};
                 }
                 do_action("ws_plugin__s2member_during_users_list_edit_cols_before_auto_eot_time", get_defined_vars());
                 unset($__refs, $__v);
                 echo '<tr>' . "\n";
                 $auto_eot_time = get_user_option("s2member_auto_eot_time", $user_id);
                 $auto_eot_time = $auto_eot_time ? date("D M j, Y g:i a T", $auto_eot_time) : "";
                 echo '<th><label for="ws-plugin--s2member-profile-s2member-auto-eot-time">Automatic EOT Time:</label> <a href="#" onclick="alert(\'EOT = End Of Term. ( i.e. Account Expiration / Termination. ).\\n\\nIf you leave this empty, s2Member will configure an EOT Time automatically, based on the paid Subscription associated with this account. In other words, if a paid Subscription expires, is cancelled, terminated, refunded, reversed, or charged back to you; s2Member will deal with the EOT automatically.\\n\\nThat being said, if you would rather take control over this, you can. If you type in a date manually, s2Member will obey the Auto-EOT Time that you\\\'ve given, no matter what. In other words, you can force certain Members to expire automatically, at a time that you specify. s2Member will obey.\\n\\nValid formats for Automatic EOT Time:\\n\\nmm/dd/yyyy\\nyyyy-mm-dd\\n+1 year\\n+2 weeks\\n+2 months\\n+10 minutes\\nnext thursday\\ntomorrow\\ntoday\\n\\n* anything compatible with PHP\\\'s strtotime() function.\'); return false;" tabindex="-1">[?]</a>' . ($auto_eot_time ? '<br /><small>(<a href="http://en.wikipedia.org/wiki/Coordinated_Universal_Time" target="_blank" rel="external">Universal Time / GMT</a>)</small>' : '') . '</th>' . "\n";
                 echo '<td><input type="text" autocomplete="off" name="ws_plugin__s2member_profile_s2member_auto_eot_time" id="ws-plugin--s2member-profile-s2member-auto-eot-time" value="' . format_to_edit($auto_eot_time) . '" class="regular-text" /></td>' . "\n";
                 echo '</tr>' . "\n";
                 foreach (array_keys(get_defined_vars()) as $__v) {
                     $__refs[$__v] =& ${$__v};
                 }
                 do_action("ws_plugin__s2member_during_users_list_edit_cols_after_auto_eot_time", get_defined_vars());
                 unset($__refs, $__v);
                 if (c_ws_plugin__s2member_utils_conds::pro_is_installed()) {
                     foreach (array_keys(get_defined_vars()) as $__v) {
                         $__refs[$__v] =& ${$__v};
                     }
                     do_action("ws_plugin__s2member_during_users_list_edit_cols_before_reset_pass_resend", get_defined_vars());
                     unset($__refs, $__v);
                     echo '<tr>' . "\n";
                     echo '<th><label for="ws-plugin--s2member-profile-reset-pass-resend">Reset Password &amp; Resend Welcome Email Message:</label> <a href="#" onclick="alert(\'Checking this box will tell s2Member to reset this User\\\'s password and then reprocess the New User Email Notification message against this User\\\'s account. This way they\\\'ll get an email message with their Username/Password.\\n\\nThis can be helpful in cases where a User/Member missed the original email message for some reason.\\n\\nThe User\\\'s password is reset to a new auto-generated password by default. However, you can provide a custom password by entering a new password of your choosing in the field above — provided by WordPress itself.\\n\\nIt is also possible to customize the New User Email Notification message with s2Member. Please see: `Dashboard -› s2Member -› General Options -› Email Configuration -› New User Notifications`.\'); return false;" tabindex="-1">[?]</a></th>' . "\n";
                     echo '<td><label><input type="checkbox" name="ws_plugin__s2member_profile_reset_pass_resend" id="ws-plugin--s2member-profile-reset-pass-resend" value="1" /> Yes, reset password &amp; resend welcome email message to this User.</label></td>' . "\n";
                     echo '</tr>' . "\n";
                     foreach (array_keys(get_defined_vars()) as $__v) {
                         $__refs[$__v] =& ${$__v};
                     }
                     do_action("ws_plugin__s2member_during_users_list_edit_cols_after_reset_pass_resend", get_defined_vars());
                     unset($__refs, $__v);
                 }
             }
             if (c_ws_plugin__s2member_list_servers::list_servers_integrated()) {
                 foreach (array_keys(get_defined_vars()) as $__v) {
                     $__refs[$__v] =& ${$__v};
                 }
                 do_action("ws_plugin__s2member_during_users_list_edit_cols_before_opt_in", get_defined_vars());
                 unset($__refs, $__v);
                 echo '<tr>' . "\n";
                 echo '<th><label for="ws-plugin--s2member-profile-opt-in">Re-process List Servers:</label> <a href="#" onclick="alert(\'You have at least one List Server integrated with s2Member. Would you like to re-process a confirmation request for this User? If not, just leave the box un-checked.\'); return false;" tabindex="-1">[?]</a></th>' . "\n";
                 echo '<td><label><input type="checkbox" name="ws_plugin__s2member_profile_opt_in" id="ws-plugin--s2member-profile-opt-in" value="1" /> Yes, send a mailing list confirmation email to this User.</label></td>' . "\n";
                 echo '</tr>' . "\n";
                 foreach (array_keys(get_defined_vars()) as $__v) {
                     $__refs[$__v] =& ${$__v};
                 }
                 do_action("ws_plugin__s2member_during_users_list_edit_cols_after_opt_in", get_defined_vars());
                 unset($__refs, $__v);
                 if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_auto_opt_out_transitions"]) {
                     if ($custom_reg_auto_op_outs = c_ws_plugin__s2member_utils_strings::wrap_deep($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_auto_opt_outs"], "/^", "\$/i")) {
                         if (c_ws_plugin__s2member_utils_arrays::in_regex_array("user-role-change", $custom_reg_auto_op_outs) || c_ws_plugin__s2member_utils_arrays::in_regex_array("modification", $custom_reg_auto_op_outs)) {
                             foreach (array_keys(get_defined_vars()) as $__v) {
                                 $__refs[$__v] =& ${$__v};
                             }
                             do_action("ws_plugin__s2member_during_users_list_edit_cols_before_auto_opt_out_transitions", get_defined_vars());
                             unset($__refs, $__v);
                             echo '<tr>' . "\n";
                             echo '<th><label for="ws-plugin--s2member-custom-reg-auto-opt-out-transitions">Allow List Transitioning:</label> <a href="#" onclick="alert(\'You\\\'ve configured s2Member with List Transitions enabled. By leaving this box checked, s2Member will Transition the User\\\'s mailing list subscription(s) automatically. For example, if a Member is demoted from Level #2, down to Level #1; s2Member will add them to the Level #1 List(s) after it removes them from the Level #2 List(s).\\n\\nDepending on your configuration of s2Member, a transition may ONLY occur if s2Member IS able to successfully remove them from an existing List. In other words, if they are currently NOT subscribed to any List(s), s2Member may NOT transition them to any new Lists (depending on your configuration).\'); return false;" tabindex="-1">[?]</a></th>' . "\n";
                             echo '<td><label><input type="checkbox" name="ws_plugin__s2member_custom_reg_auto_opt_out_transitions" id="ws-plugin--s2member-custom-reg-auto-opt-out-transitions" value="1" checked="checked" /> Yes, automatically transition this User\'s mailing list subscription(s) when/if I change their Role.</label></td>' . "\n";
                             echo '</tr>' . "\n";
                             foreach (array_keys(get_defined_vars()) as $__v) {
                                 $__refs[$__v] =& ${$__v};
                             }
                             do_action("ws_plugin__s2member_during_users_list_edit_cols_after_auto_opt_out_transitions", get_defined_vars());
                             unset($__refs, $__v);
                         }
                     }
                 }
             }
             foreach (array_keys(get_defined_vars()) as $__v) {
                 $__refs[$__v] =& ${$__v};
             }
             do_action("ws_plugin__s2member_during_users_list_edit_cols_before_ip_restrictions", get_defined_vars());
             unset($__refs, $__v);
             echo '<tr>' . "\n";
             echo '<th><label for="ws-plugin--s2member-profile-ip-restrictions">Reset IP Restrictions:</label> <a href="#" onclick="alert(\'A single Username is only valid for a certain number of unique IP addresses (as configured in your s2Member -› General Options). Once that limit is reached, s2Member assumes there has been a security breach. At that time, s2Member will place a temporary ban (preventing access).\\n\\nIf you have spoken to a legitimate Customer that is receiving an error upon logging in (ex: 503 / too many IP addresses), you can remove this temporary ban by checking the box below. If the abusive behavior continues, s2Member will automatically re-instate IP Restrictions in the future. If you would like to gain further control over IP Restrictions, please check your General Options panel for s2Member.\'); return false;" tabindex="-1">[?]</a></th>' . "\n";
             echo '<td><label><input type="checkbox" name="ws_plugin__s2member_profile_ip_restrictions" id="ws-plugin--s2member-profile-ip-restrictions" value="1" /> Yes, delete/reset IP Restrictions associated with this Username.</label>' . (c_ws_plugin__s2member_ip_restrictions::specific_ip_restriction_at_or_above_max(strtolower($user->user_login)) || c_ws_plugin__s2member_ip_restrictions::specific_ip_restriction_breached_security(strtolower($user->user_login)) ? '<br /><em>*WARNING* this User is at (or above) max allowable IP addresses (based on your IP Restrictions).</em>' : '<br /><em>*Note* this User is NOT currently banned by any of your IP Restrictions.</em>') . '</td>' . "\n";
             echo '</tr>' . "\n";
             foreach (array_keys(get_defined_vars()) as $__v) {
                 $__refs[$__v] =& ${$__v};
             }
             do_action("ws_plugin__s2member_during_users_list_edit_cols_after_ip_restrictions", get_defined_vars());
             unset($__refs, $__v);
             if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"]) {
                 // Only if configured.
                 if ($fields_applicable = c_ws_plugin__s2member_custom_reg_fields::custom_fields_configured_at_level($level, "administrative")) {
                     echo '<tr>' . "\n";
                     echo '<td colspan="2">' . "\n";
                     echo '<div style="height:1px; line-height:1px; background:#CCCCCC;"></div>' . "\n";
                     echo '</td>' . "\n";
                     echo '</tr>' . "\n";
                     $fields = get_user_option("s2member_custom_fields", $user_id);
                     // Existing fields.
                     foreach (array_keys(get_defined_vars()) as $__v) {
                         $__refs[$__v] =& ${$__v};
                     }
                     do_action("ws_plugin__s2member_during_users_list_edit_cols_before_custom_fields", get_defined_vars());
                     unset($__refs, $__v);
                     foreach (json_decode($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"], true) as $field) {
                         foreach (array_keys(get_defined_vars()) as $__v) {
                             $__refs[$__v] =& ${$__v};
                         }
                         do_action("ws_plugin__s2member_during_users_list_edit_cols_during_custom_fields_before", get_defined_vars());
                         unset($__refs, $__v);
                         if (in_array($field["id"], $fields_applicable)) {
                             $field_var = preg_replace("/[^a-z0-9]/i", "_", strtolower($field["id"]));
                             $field_id_class = preg_replace("/_/", "-", $field_var);
                             foreach (array_keys(get_defined_vars()) as $__v) {
                                 $__refs[$__v] =& ${$__v};
                             }
                             if (apply_filters("ws_plugin__s2member_during_users_list_edit_cols_during_custom_fields_display", true, get_defined_vars())) {
                                 if (!empty($field["section"]) && $field["section"] === "yes") {
                                     // Starts a new section?
                                     echo '<tr><td colspan="2"><div class="ws-plugin--s2member-profile-divider-section' . (!empty($field["sectitle"]) ? '-title' : '') . '">' . (!empty($field["sectitle"]) ? $field["sectitle"] : '') . '</div></td></tr>';
                                 }
                                 echo '<tr>' . "\n";
                                 echo '<th><label for="ws-plugin--s2member-profile-' . esc_attr($field_id_class) . '">' . (preg_match("/^(checkbox|pre_checkbox)\$/", $field["type"]) ? ucwords(preg_replace("/_/", " ", $field_var)) : $field["label"]) . ':</label></th>' . "\n";
                                 echo '<td>' . c_ws_plugin__s2member_custom_reg_fields::custom_field_gen(__FUNCTION__, $field, "ws_plugin__s2member_profile_", "ws-plugin--s2member-profile-", "", preg_match("/^(text|textarea|select|selects)\$/", $field["type"]) ? "width:99%;" : "", "", "", $fields, $fields[$field_var], "administrative") . '</td>' . "\n";
                                 echo '</tr>' . "\n";
                             }
                             unset($__refs, $__v);
                         }
                         foreach (array_keys(get_defined_vars()) as $__v) {
                             $__refs[$__v] =& ${$__v};
                         }
                         do_action("ws_plugin__s2member_during_users_list_edit_cols_during_custom_fields_after", get_defined_vars());
                         unset($__refs, $__v);
                     }
                     foreach (array_keys(get_defined_vars()) as $__v) {
                         $__refs[$__v] =& ${$__v};
                     }
                     do_action("ws_plugin__s2member_during_users_list_edit_cols_after_custom_fields", get_defined_vars());
                     unset($__refs, $__v);
                     echo '<tr>' . "\n";
                     echo '<td colspan="2">' . "\n";
                     echo '<div style="height:1px; line-height:1px; background:#CCCCCC;"></div>' . "\n";
                     echo '</td>' . "\n";
                     echo '</tr>' . "\n";
                 }
             }
             foreach (array_keys(get_defined_vars()) as $__v) {
                 $__refs[$__v] =& ${$__v};
             }
             do_action("ws_plugin__s2member_during_users_list_edit_cols_before_notes", get_defined_vars());
             unset($__refs, $__v);
             echo '<tr>' . "\n";
             echo '<th><label for="ws-plugin--s2member-profile-s2member-notes">Administrative Notes:</label> <a href="#" onclick="alert(\'This is for Administrative purposes. You can keep a list of Notations about this account. These Notations are private; Users/Members will never see these.\\n\\n*Note* The s2Member software may `append` Notes to this field occasionally, under special circumstances. For example, when/if s2Member demotes a paid Member to a Free Subscriber, s2Member will leave a Note in this field.\'); return false;" tabindex="-1">[?]</a><br /><br /><small>These Notations are private; Users/Members will never see any of these notes.</small></th>' . "\n";
             echo '<td><textarea name="ws_plugin__s2member_profile_s2member_notes" id="ws-plugin--s2member-profile-s2member-notes" rows="5" wrap="off" spellcheck="false" style="width:99%;">' . format_to_edit(get_user_option("s2member_notes", $user_id)) . '</textarea></td>' . "\n";
             echo '</tr>' . "\n";
             foreach (array_keys(get_defined_vars()) as $__v) {
                 $__refs[$__v] =& ${$__v};
             }
             do_action("ws_plugin__s2member_during_users_list_edit_cols_after_notes", get_defined_vars());
             unset($__refs, $__v);
             foreach (array_keys(get_defined_vars()) as $__v) {
                 $__refs[$__v] =& ${$__v};
             }
             do_action("ws_plugin__s2member_during_users_list_edit_cols_after", get_defined_vars());
             unset($__refs, $__v);
             echo '</table>' . "\n";
             echo '<div style="margin:25px 0 25px 0; height:1px; line-height:1px; background:#CCCCCC;"></div>' . "\n";
         } else {
             if ($current_user->ID === $user->ID) {
                 if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"]) {
                     if ($fields_applicable = c_ws_plugin__s2member_custom_reg_fields::custom_fields_configured_at_level($level, "profile")) {
                         echo '<div style="margin:25px 0 25px 0; height:1px; line-height:1px; background:#CCCCCC;"></div>' . "\n";
                         echo '<h3>' . _x("Additional Profile Fields", "s2member-front", "s2member") . (is_multisite() ? ' ' . _x("(for this site)", "s2member-front", "s2member") : "") . '</h3>' . "\n";
                         echo '<table class="form-table">' . "\n";
                         foreach (array_keys(get_defined_vars()) as $__v) {
                             $__refs[$__v] =& ${$__v};
                         }
                         do_action("ws_plugin__s2member_during_users_list_edit_cols_before", get_defined_vars());
                         unset($__refs, $__v);
                         $fields = get_user_option("s2member_custom_fields", $user_id);
                         // Existing fields.
                         foreach (array_keys(get_defined_vars()) as $__v) {
                             $__refs[$__v] =& ${$__v};
                         }
                         do_action("ws_plugin__s2member_during_users_list_edit_cols_before_custom_fields", get_defined_vars());
                         unset($__refs, $__v);
                         foreach (json_decode($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"], true) as $field) {
                             foreach (array_keys(get_defined_vars()) as $__v) {
                                 $__refs[$__v] =& ${$__v};
                             }
                             do_action("ws_plugin__s2member_during_users_list_edit_cols_during_custom_fields_before", get_defined_vars());
                             unset($__refs, $__v);
                             if (in_array($field["id"], $fields_applicable)) {
                                 $field_var = preg_replace("/[^a-z0-9]/i", "_", strtolower($field["id"]));
                                 $field_id_class = preg_replace("/_/", "-", $field_var);
                                 foreach (array_keys(get_defined_vars()) as $__v) {
                                     $__refs[$__v] =& ${$__v};
                                 }
                                 if (apply_filters("ws_plugin__s2member_during_users_list_edit_cols_during_custom_fields_display", true, get_defined_vars())) {
                                     if (!empty($field["section"]) && $field["section"] === "yes") {
                                         // Starts a new section?
                                         echo '<tr><td colspan="2"><div class="ws-plugin--s2member-profile-divider-section' . (!empty($field["sectitle"]) ? '-title' : '') . '">' . (!empty($field["sectitle"]) ? $field["sectitle"] : '') . '</div></td></tr>';
                                     }
                                     echo '<tr>' . "\n";
                                     echo '<th><label for="ws-plugin--s2member-profile-' . esc_attr($field_id_class) . '">' . (preg_match("/^(checkbox|pre_checkbox)\$/", $field["type"]) ? ucwords(preg_replace("/_/", " ", $field_var)) : $field["label"]) . ':</label></th>' . "\n";
                                     echo '<td>' . c_ws_plugin__s2member_custom_reg_fields::custom_field_gen(__FUNCTION__, $field, "ws_plugin__s2member_profile_", "ws-plugin--s2member-profile-", "", preg_match("/^(text|textarea|select|selects)\$/", $field["type"]) ? "width:99%;" : "", "", "", $fields, $fields[$field_var], "profile") . '</td>' . "\n";
                                     echo '</tr>' . "\n";
                                 }
                                 unset($__refs, $__v);
                             }
                             foreach (array_keys(get_defined_vars()) as $__v) {
                                 $__refs[$__v] =& ${$__v};
                             }
                             do_action("ws_plugin__s2member_during_users_list_edit_cols_during_custom_fields_after", get_defined_vars());
                             unset($__refs, $__v);
                         }
                         foreach (array_keys(get_defined_vars()) as $__v) {
                             $__refs[$__v] =& ${$__v};
                         }
                         do_action("ws_plugin__s2member_during_users_list_edit_cols_after_custom_fields", get_defined_vars());
                         unset($__refs, $__v);
                         foreach (array_keys(get_defined_vars()) as $__v) {
                             $__refs[$__v] =& ${$__v};
                         }
                         do_action("ws_plugin__s2member_during_users_list_edit_cols_after", get_defined_vars());
                         unset($__refs, $__v);
                         echo '</table>' . "\n";
                         echo '<div style="margin:25px 0 25px 0; height:1px; line-height:1px; background:#CCCCCC;"></div>' . "\n";
                     }
                 }
             }
         }
     }
     foreach (array_keys(get_defined_vars()) as $__v) {
         $__refs[$__v] =& ${$__v};
     }
     do_action("ws_plugin__s2member_after_users_list_edit_cols", get_defined_vars());
     unset($__refs, $__v);
     return;
 }
예제 #3
0
 /**
  * Listens to Collective EOT/MOD Events processed internally by s2Member.
  *
  * This is only applicable when ``["custom_reg_auto_opt_outs"]`` contains related Event(s).
  *
  * @package s2Member\List_Servers
  * @since 3.5
  *
  * @attaches-to ``add_action("ws_plugin__s2member_during_collective_mods");``
  * @attaches-to ``add_action("ws_plugin__s2member_during_collective_eots");``
  *
  * @param int|str $user_id Required. A WordPress User ID, numeric string or integer.
  * @param array $vars Required. An array of defined variables passed by the calling Hook.
  * @param str $event Required. A specific event that triggered this call from the Action Hook.
  * @param str $event_spec Required. A specific event specification *(a broader classification)*.
  * @param str $mod_new_role Required if ``$event_spec === "modification"`` (but can be empty). Role the User is being modified to.
  * @param str $mod_new_user Optional. If ``$event_spec === "modification"``, the new User object with current details.
  * @param str $mod_old_user Optional. If ``$event_spec === "modification"``, the old/previous User obj with old details.
  * @return null This function does not have a return value.
  */
 public static function auto_process_list_server_removals($user_id = FALSE, $vars = FALSE, $event = FALSE, $event_spec = FALSE, $mod_new_role = FALSE, $mod_new_user = FALSE, $mod_old_user = FALSE)
 {
     global $current_site, $current_blog;
     static $auto_processed = array();
     foreach (array_keys(get_defined_vars()) as $__v) {
         $__refs[$__v] =& ${$__v};
     }
     do_action("ws_plugin__s2member_before_auto_process_list_server_removals", get_defined_vars());
     unset($__refs, $__v);
     $custom_reg_auto_op_outs = c_ws_plugin__s2member_utils_strings::wrap_deep($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_auto_opt_outs"], "/^", "\$/i");
     if (c_ws_plugin__s2member_list_servers::list_servers_integrated() && $user_id && is_numeric($user_id) && !in_array($user_id, $auto_processed) && is_array($vars) && is_string($event = (string) $event) && is_string($event_spec = (string) $event_spec) && (c_ws_plugin__s2member_utils_arrays::in_regex_array($event, $custom_reg_auto_op_outs) || c_ws_plugin__s2member_utils_arrays::in_regex_array($event_spec, $custom_reg_auto_op_outs)) && is_object($user = $_user = new WP_User($user_id)) && !empty($user->ID)) {
         $mod_new_role = $event_spec === "modification" && $mod_new_role && is_string($mod_new_role) ? $mod_new_role : false;
         $mod_new_user = $event_spec === "modification" && $mod_new_user && is_object($mod_new_user) && !empty($mod_new_user->ID) && $mod_new_user->ID === $_user->ID ? $mod_new_user : false;
         $mod_old_user = $event_spec === "modification" && $mod_old_user && is_object($mod_old_user) && !empty($mod_old_user->ID) && $mod_old_user->ID === $_user->ID ? $mod_old_user : false;
         $user = $event_spec === "modification" && $mod_old_user ? $mod_old_user : $_user;
         // Now, should we switch over to the old/previous User object ``$mod_old_user`` here? Or, should we use the one pulled by this routine with the User's ID?
         if (($event_spec !== "modification" || $event_spec === "modification" && (string) $mod_new_role !== c_ws_plugin__s2member_user_access::user_access_role($user) && strtotime($user->user_registered) < strtotime("-10 seconds") && ($event !== "user-role-change" || $event === "user-role-change" && !empty($vars["_p"]["ws_plugin__s2member_custom_reg_auto_opt_out_transitions"]))) && ($auto_processed[$user->ID] = true)) {
             $removed = c_ws_plugin__s2member_list_servers::process_list_server_removals(c_ws_plugin__s2member_user_access::user_access_role($user), c_ws_plugin__s2member_user_access::user_access_level($user), $user->user_login, false, $user->user_email, $user->first_name, $user->last_name, false, true, $user->ID);
             if ($event_spec === "modification" && $mod_new_role && ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_auto_opt_out_transitions"] === "2" || $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_auto_opt_out_transitions"] === "1" && $removed)) {
                 $user = $event_spec === "modification" && $mod_new_user ? $mod_new_user : $_user;
                 // Now, should we switch over to a new/current User object ``$mod_new_user`` here? (which may contain newly updated details). Or, should we simply use the User object pulled by this routine with the User's ID?
                 $transitioned = c_ws_plugin__s2member_list_servers::process_list_servers($mod_new_role, c_ws_plugin__s2member_user_access::user_access_role_to_level($mod_new_role), $user->user_login, false, $user->user_email, $user->first_name, $user->last_name, false, true, $removed ? false : true, $user->ID);
                 foreach (array_keys(get_defined_vars()) as $__v) {
                     $__refs[$__v] =& ${$__v};
                 }
                 do_action("ws_plugin__s2member_during_auto_process_list_server_removal_transitions", get_defined_vars());
                 unset($__refs, $__v);
             }
             foreach (array_keys(get_defined_vars()) as $__v) {
                 $__refs[$__v] =& ${$__v};
             }
             do_action("ws_plugin__s2member_during_auto_process_list_server_removals", get_defined_vars());
             unset($__refs, $__v);
         }
     }
     foreach (array_keys(get_defined_vars()) as $__v) {
         $__refs[$__v] =& ${$__v};
     }
     do_action("ws_plugin__s2member_after_auto_process_list_server_removals", get_defined_vars());
     unset($__refs, $__v);
     return;
 }
 /**
  * Wraps a string with the characters provided.
  *
  * This is useful when preparing an input array for ``c_ws_plugin__s2member_utils_arrays::in_regex_array()``.
  *
  * @package s2Member\Utilities
  * @since 3.5
  *
  * @param str|array $value Either a string, an array, or a multi-dimensional array, filled with integer and/or string values.
  * @param str $beg Optional. A string value to wrap at the beginning of each value.
  * @param str $end Optional. A string value to wrap at the ending of each value.
  * @param bool $wrap_e Optional. Defaults to false. Should empty strings be wrapped too?
  * @return str|array Either the input string, or the input array; after all data is wrapped up.
  */
 public static function wrap_deep($value = FALSE, $beg = FALSE, $end = FALSE, $wrap_e = FALSE)
 {
     if (is_array($value)) {
         foreach ($value as &$r) {
             /* Reference. */
             $r = c_ws_plugin__s2member_utils_strings::wrap_deep($r, $beg, $end, $wrap_e);
         }
         return $value;
         /* Return modified array. */
     }
     return strlen((string) $value) || $wrap_e ? (string) $beg . (string) $value . (string) $end : (string) $value;
 }
예제 #5
0
 /**
  * Listens to Collective EOT/MOD events processed by s2Member.
  *
  * @since 3.5
  * @package s2Member\List_Servers
  *
  * @attaches-to `add_action('ws_plugin__s2member_during_collective_mods');`.
  * @attaches-to `add_action('ws_plugin__s2member_during_collective_eots');`.
  *
  * @param int|string $user_id Required. A WordPress User ID, numeric string or integer.
  * @param array      $vars Required. An array of defined variables passed by the calling hook.
  * @param string     $event Required. A specific event that triggered this call from the action hook.
  * @param string     $event_spec Required. A specific event specification *(a broader classification)*.
  * @param string     $mod_new_role Required if `$event_spec === 'modification'`; but can be empty. User role.
  * @param string     $mod_new_user Optional. If `$event_spec === 'modification'`, the new user object with current details.
  * @param string     $mod_old_user Optional. If `$event_spec === 'modification'`, the old/previous user obj with old details.
  *
  * @note This is only applicable when `['custom_reg_auto_opt_outs']` contains related Event(s).
  */
 public static function auto_process_list_server_removals($user_id, $vars, $event, $event_spec, $mod_new_role = NULL, $mod_new_user = NULL, $mod_old_user = NULL)
 {
     static $auto_processed = array();
     // Static cache.
     foreach (array_keys(get_defined_vars()) as $__v) {
         $__refs[$__v] =& ${$__v};
     }
     do_action('ws_plugin__s2member_before_auto_process_list_server_removals', get_defined_vars());
     unset($__refs, $__v);
     // Allows vars to be modified by reference.
     if (c_ws_plugin__s2member_list_servers::list_servers_integrated()) {
         if ($user_id && is_numeric($user_id) && !isset($auto_processed[$user_id])) {
             if (is_array($vars) && is_string($event = (string) $event) && is_string($event_spec = (string) $event_spec)) {
                 if ($custom_reg_auto_op_outs = c_ws_plugin__s2member_utils_strings::wrap_deep($GLOBALS['WS_PLUGIN__']['s2member']['o']['custom_reg_auto_opt_outs'], '/^', '$/i')) {
                     if (c_ws_plugin__s2member_utils_arrays::in_regex_array($event, $custom_reg_auto_op_outs) || c_ws_plugin__s2member_utils_arrays::in_regex_array($event_spec, $custom_reg_auto_op_outs)) {
                         if (is_object($dynamic_user = $user_now = new WP_User($user_id)) && $dynamic_user->exists() && !empty($dynamic_user->ID)) {
                             $mod_new_role = $event_spec === 'modification' && is_string($mod_new_role) ? $mod_new_role : '';
                             // Might be empty.
                             $mod_new_user = $event_spec === 'modification' && !empty($mod_new_user->ID) && $mod_new_user->ID === $dynamic_user->ID ? $mod_new_user : NULL;
                             $mod_old_user = $event_spec === 'modification' && !empty($mod_old_user->ID) && $mod_old_user->ID === $dynamic_user->ID ? $mod_old_user : NULL;
                             $dynamic_user = $event_spec === 'modification' && $mod_old_user ? $mod_old_user : $user_now;
                             // Use old user when applicable.
                             if ($event_spec !== 'modification' || $event_spec === 'modification' && $mod_new_role !== c_ws_plugin__s2member_user_access::user_access_role($dynamic_user) && strtotime($dynamic_user->user_registered) < strtotime('-10 seconds') && ($event !== 'user-role-change' || $event === 'user-role-change' && !empty($vars['_p']['ws_plugin__s2member_custom_reg_auto_opt_out_transitions']))) {
                                 $auto_processed[$dynamic_user->ID] = -1;
                                 // Flag as auto-processed!
                                 $auto_removal_success = c_ws_plugin__s2member_list_servers::process_list_server_removals(c_ws_plugin__s2member_user_access::user_access_role($dynamic_user), c_ws_plugin__s2member_user_access::user_access_level($dynamic_user), $dynamic_user->user_login, '', $dynamic_user->user_email, $dynamic_user->first_name, $dynamic_user->last_name, '', TRUE, $dynamic_user->ID);
                                 if ($event_spec === 'modification' && $mod_new_role && ($GLOBALS['WS_PLUGIN__']['s2member']['o']['custom_reg_auto_opt_out_transitions'] === '2' || $GLOBALS['WS_PLUGIN__']['s2member']['o']['custom_reg_auto_opt_out_transitions'] === '1' && $auto_removal_success)) {
                                     $dynamic_user = $event_spec === 'modification' && $mod_new_user ? $mod_new_user : $user_now;
                                     // New user; when applicable.
                                     $auto_transition_success = c_ws_plugin__s2member_list_servers::process_list_servers($mod_new_role, c_ws_plugin__s2member_user_access::user_access_role_to_level($mod_new_role), $dynamic_user->user_login, '', $dynamic_user->user_email, $dynamic_user->first_name, $dynamic_user->last_name, '', TRUE, $auto_removal_success ? FALSE : TRUE, $dynamic_user->ID);
                                     do_action('ws_plugin__s2member_during_auto_process_list_server_removal_transitions', get_defined_vars());
                                 }
                                 do_action('ws_plugin__s2member_during_auto_process_list_server_removals', get_defined_vars());
                             }
                         }
                     }
                 }
             }
         }
     }
     do_action('ws_plugin__s2member_after_auto_process_list_server_removals', get_defined_vars());
 }