s2Member Framework (Member Roles, Capabilities, Membership, PayPal Members) - Version 3.5.5

Version Description

  • (s2Member). New feature. It is now possible to configure Custom Registration Fields with s2Member that are NOT actually visible during the registration process. Instead, they will only be visible after registration ( i.e. during a Profile edit ). In order to accomplish this, you will need to choose this option from the dropdown menu for a specific Custom Registration Field that you configure with s2Member. This option is in the dropdown menu entitled: Allow Profile Edits?. You can choose: Yes ( editable after registration / invisible during registration ).
  • (s2Member Pro). Feature Improvement. The display of the Coupon Code field on Pro Forms has been improved ( i.e. enhanced with an icon and the "Apply Coupon" button is now floated to the right to save space ).
  • (s2Member Pro). Compatibility / Bug fix. This is related to some bug reports regarding 500 Internal Server Errors. s2Member is now compatible ( i.e. capable of running in concert with ) other plugins that attempt actions dealing with $current_user on the plugins_loaded Hook for WordPress. In an ideal world, other plugins should NOT be doing this, because the WordPress core framework does not initialize $current_user until just before the init Hook is fired, which comes after the plugins_loaded Hook. However, in an effort to maximize s2Member's compatibility, s2Member has been modified to work around this potential bug, by delaying the initialization of its Filter against user_has_cap just a bit. If you were experiencing 500 Internal Server Errors in previous releases of s2Member, you will want to upgrade to this version for improved compatibility with other plugin combinations.
  • (s2Member Pro). Bug fix. s2Member Pro Forms for Free Registration were not picking up Custom Registration Fields configured at specific Membership Levels; other than Level #0. This has been resolved in s2Member Pro v1.5.5+.
  • (s2Member Pro). Feature Improvement. This change is related to the basic ( default ) CSS rules applied to Pro Forms generated by s2Member Pro. In this release, Pro Forms now utilize the CSS3 box-sizing specification to correct slight imperfections in the width of forms fields ( i.e. the difference between select and input ). This specification is supported by all modern browsers, including IE8. s2Member also degrades with a "best guess" workaround for IE 7 browsers. Reference article here.
  • (s2Member/s2Member Pro). Roadmap. Barring any serious bug reports, this will be the last release in the 3.5.x series of s2Member and the 1.5.x series of s2Member Pro. The next releases will include substantial changes ( internally ) related to the handling of variables; further optimizing the entire codebase. In addition, there are plans to integrate some new functionality for Content Dripping in the next release. The next releases should be ready around the end of April 2011.
Download this release

Release Info

Developer PriMoThemes
Plugin Icon 128x128 s2Member Framework (Member Roles, Capabilities, Membership, PayPal Members)
Version 3.5.5
Comparing to
See all releases

Code changes from version 3.5.4 to 3.5.5

Files changed (59) hide show
  1. includes/classes/admin-lockouts.inc.php +19 -21
  2. includes/classes/admin-notices.inc.php +1 -1
  3. includes/classes/cache.inc.php +3 -3
  4. includes/classes/constants.inc.php +6 -6
  5. includes/classes/custom-reg-fields.inc.php +22 -19
  6. includes/classes/files-in.inc.php +18 -18
  7. includes/classes/files.inc.php +2 -0
  8. includes/classes/installation.inc.php +5 -5
  9. includes/classes/ip-restrictions.inc.php +4 -4
  10. includes/classes/login-redirects-r.inc.php +3 -2
  11. includes/classes/login-redirects.inc.php +6 -6
  12. includes/classes/menu-pages.inc.php +8 -7
  13. includes/classes/meta-box-saves.inc.php +7 -7
  14. includes/classes/mms-patches.inc.php +1 -1
  15. includes/classes/option-forces.inc.php +8 -8
  16. includes/classes/pages-sp.inc.php +2 -2
  17. includes/classes/pages.inc.php +2 -2
  18. includes/classes/paypal-notify-in.inc.php +61 -61
  19. includes/classes/paypal-return-in.inc.php +13 -14
  20. includes/classes/paypal-utilities.inc.php +4 -4
  21. includes/classes/posts-sp.inc.php +2 -2
  22. includes/classes/posts.inc.php +2 -2
  23. includes/classes/profile-mods-in.inc.php +16 -17
  24. includes/classes/ptags-sp.inc.php +2 -2
  25. includes/classes/ptags.inc.php +2 -2
  26. includes/classes/querys.inc.php +11 -11
  27. includes/classes/register-access.inc.php +2 -2
  28. includes/classes/registration-times.inc.php +1 -1
  29. includes/classes/registrations.inc.php +7 -8
  30. includes/classes/ruris-sp.inc.php +2 -2
  31. includes/classes/ruris.inc.php +6 -6
  32. includes/classes/sc-gets-in.inc.php +5 -8
  33. includes/classes/sc-if-conds-in.inc.php +1 -1
  34. includes/classes/sc-paypal-button-e.inc.php +1 -1
  35. includes/classes/sc-profile-in.inc.php +15 -18
  36. includes/classes/sp-access.inc.php +2 -2
  37. includes/classes/tracking-codes.inc.php +4 -4
  38. includes/classes/user-access.inc.php +19 -34
  39. includes/classes/user-new-in.inc.php +11 -11
  40. includes/classes/user-notes.inc.php +1 -1
  41. includes/classes/user-securities.inc.php +12 -2
  42. includes/classes/users-list-in.inc.php +17 -21
  43. includes/classes/users-list.inc.php +4 -4
  44. includes/classes/utils-css.inc.php +1 -1
  45. includes/classes/utils-dirs.inc.php +2 -2
  46. includes/classes/utils-encryption.inc.php +5 -10
  47. includes/classes/utils-gets.inc.php +1 -1
  48. includes/classes/utils-logs.inc.php +3 -3
  49. includes/classes/utils-strings.inc.php +3 -3
  50. includes/classes/utils-time.inc.php +1 -1
  51. includes/classes/utils-users.inc.php +7 -6
  52. includes/dropins/bridges/_s2member-bbpress-bridge.php +1 -1
  53. includes/functions/api-functions.inc.php +2 -2
  54. includes/hooks.inc.php +3 -1
  55. includes/menu-pages/menu-pages-s-min.js +1 -1
  56. includes/menu-pages/menu-pages-s.js +2 -1
  57. includes/profile.inc.php +15 -18
  58. readme.txt +11 -3
  59. s2member.php +8 -8
includes/classes/admin-lockouts.inc.php CHANGED
@@ -26,13 +26,13 @@ if (!class_exists ("c_ws_plugin__s2member_admin_lockouts"))
26
  {
27
  do_action ("ws_plugin__s2member_before_admin_lockouts", get_defined_vars ());
28
  /**/
29
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["force_admin_lockouts"] && /* Now checks for special request methods too. */
30
  (!defined ("XMLRPC_REQUEST") || !XMLRPC_REQUEST) && (!defined ("APP_REQUEST") || !APP_REQUEST) && (!defined ("DOING_AJAX") || !DOING_AJAX)/**/
31
  && !current_user_can ("edit_posts")) /* And only if the current User is unable to edit Posts; otherwise we allow them in. */
32
  if (apply_filters ("ws_plugin__s2member_admin_lockout", true, get_defined_vars ())) /* Give Filters a chance too. */
33
  {
34
  if ($special_redirection_url = c_ws_plugin__s2member_login_redirects::login_redirection_url ())
35
- wp_redirect ($special_redirection_url); /* Special Redirection. */
36
  /**/
37
  else /* Else we use the Login Welcome Page configured for s2Member. */
38
  wp_redirect (get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"]));
@@ -61,26 +61,24 @@ if (!class_exists ("c_ws_plugin__s2member_admin_lockouts"))
61
  else /* Else we use the Login Welcome Page configured for s2Member. */
62
  $lwp = get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"]);
63
  /**/
64
- if (isset ($wp_admin_bar->menu->{"my-account-with-avatar"}) && is_array ($wp_admin_bar->menu->{"my-account-with-avatar"}))
65
- if ($wp_admin_bar->menu->{"my-account-with-avatar"}["href"] && is_object ($wp_admin_bar->menu->{"my-account-with-avatar"}["children"]))
66
- {
67
- $wp_admin_bar->menu->{"my-account-with-avatar"}["href"] = $lwp;
68
- $wp_admin_bar->menu->{"my-account-with-avatar"}["children"]->{"edit-my-profile"}["href"] = $lwp;
69
- unset ($wp_admin_bar->menu->{"my-account-with-avatar"}["children"]->{"dashboard"});
70
- }
71
  /**/
72
- if (isset ($wp_admin_bar->menu->{"my-blogs"}) && is_array ($wp_admin_bar->menu->{"my-blogs"}))
73
- if ($wp_admin_bar->menu->{"my-blogs"}["href"] && is_object ($wp_admin_bar->menu->{"my-blogs"}["children"]))
74
- {
75
- $wp_admin_bar->menu->{"my-blogs"}["href"] = "#"; /* Void this link by converting to #. */
76
- /**/
77
- foreach ($wp_admin_bar->menu->{"my-blogs"}["children"] as &$blog)
78
- if (is_array ($blog) && $blog["href"] && is_object ($blog["children"]))
79
- {
80
- $blog["href"] = preg_replace ("/\/wp-admin/", "", $blog["href"]);
81
- unset ($blog["children"]); /* Cause all we need is the link. */
82
- }
83
- }
84
  }
85
  /**/
86
  do_action ("ws_plugin__s2member_after_filter_admin_menu_bar", get_defined_vars ());
26
  {
27
  do_action ("ws_plugin__s2member_before_admin_lockouts", get_defined_vars ());
28
  /**/
29
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["force_admin_lockouts"] && /* Now check for these WordPress® functionality Constants too. */
30
  (!defined ("XMLRPC_REQUEST") || !XMLRPC_REQUEST) && (!defined ("APP_REQUEST") || !APP_REQUEST) && (!defined ("DOING_AJAX") || !DOING_AJAX)/**/
31
  && !current_user_can ("edit_posts")) /* And only if the current User is unable to edit Posts; otherwise we allow them in. */
32
  if (apply_filters ("ws_plugin__s2member_admin_lockout", true, get_defined_vars ())) /* Give Filters a chance too. */
33
  {
34
  if ($special_redirection_url = c_ws_plugin__s2member_login_redirects::login_redirection_url ())
35
+ wp_redirect($special_redirection_url); /* Special Redirection. */
36
  /**/
37
  else /* Else we use the Login Welcome Page configured for s2Member. */
38
  wp_redirect (get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"]));
61
  else /* Else we use the Login Welcome Page configured for s2Member. */
62
  $lwp = get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"]);
63
  /**/
64
+ if (isset ($wp_admin_bar->menu->{"my-account-with-avatar"}["href"]) && isset ($wp_admin_bar->menu->{"my-account-with-avatar"}["children"]->{"edit-my-profile"}["href"]))
65
+ {
66
+ $wp_admin_bar->menu->{"my-account-with-avatar"}["href"] = $lwp;
67
+ $wp_admin_bar->menu->{"my-account-with-avatar"}["children"]->{"edit-my-profile"}["href"] = $lwp;
68
+ unset ($wp_admin_bar->menu->{"my-account-with-avatar"}["children"]->{"dashboard"});
69
+ }
 
70
  /**/
71
+ if (isset ($wp_admin_bar->menu->{"my-blogs"}["href"]) && isset ($wp_admin_bar->menu->{"my-blogs"}["children"]) && is_object ($wp_admin_bar->menu->{"my-blogs"}["children"]))
72
+ {
73
+ $wp_admin_bar->menu->{"my-blogs"}["href"] = "#"; /* Void this link by converting to #. */
74
+ /**/
75
+ foreach ($wp_admin_bar->menu->{"my-blogs"}["children"] as &$blog)
76
+ if (is_array ($blog) && isset ($blog["href"]) && isset ($blog["children"]) && is_object ($blog["children"]))
77
+ {
78
+ $blog["href"] = preg_replace ("/\/wp-admin/", "", $blog["href"]);
79
+ unset ($blog["children"]); /* Cause all we need is the link. */
80
+ }
81
+ }
 
82
  }
83
  /**/
84
  do_action ("ws_plugin__s2member_after_filter_admin_menu_bar", get_defined_vars ());
includes/classes/admin-notices.inc.php CHANGED
@@ -111,7 +111,7 @@ if (!class_exists ("c_ws_plugin__s2member_admin_notices"))
111
  unset ($notices[$i]); /* Clear this administrative notice now? */
112
  /**/
113
  if (!$notice["dismiss"] || $_GET["ws-plugin--s2member-dismiss-admin-notice"] !== md5 ($notice["notice"]))
114
- c_ws_plugin__s2member_admin_notices::display_admin_notice ($notice["notice"], $notice["error"], $notice["dismiss"]);
115
  /**/
116
  do_action ("ws_plugin__s2member_during_admin_notices_after_display", get_defined_vars ());
117
  }
111
  unset ($notices[$i]); /* Clear this administrative notice now? */
112
  /**/
113
  if (!$notice["dismiss"] || $_GET["ws-plugin--s2member-dismiss-admin-notice"] !== md5 ($notice["notice"]))
114
+ c_ws_plugin__s2member_admin_notices::display_admin_notice ($notice["notice"],$notice["error"],$notice["dismiss"]);
115
  /**/
116
  do_action ("ws_plugin__s2member_during_admin_notices_after_display", get_defined_vars ());
117
  }
includes/classes/cache.inc.php CHANGED
@@ -37,7 +37,7 @@ if (!class_exists ("c_ws_plugin__s2member_cache"))
37
  /**/
38
  $links = array ("login_welcome_page" => "", "membership_options_page" => "", "file_download_limit_exceeded_page" => "");
39
  /**/
40
- if ($login_welcome_page_cache["page"] === $login_welcome_page && $login_welcome_page_cache["time"] >= strtotime ("-15 minutes"))
41
  {
42
  $links["login_welcome_page"] = $login_welcome_page_cache["link"];
43
  }
@@ -50,7 +50,7 @@ if (!class_exists ("c_ws_plugin__s2member_cache"))
50
  $cache_needs_updating = true; /* Flag for cache update. */
51
  }
52
  /**/
53
- if ($membership_options_page_cache["page"] === $membership_options_page && $membership_options_page_cache["time"] >= strtotime ("-15 minutes"))
54
  {
55
  $links["membership_options_page"] = $membership_options_page_cache["link"];
56
  }
@@ -63,7 +63,7 @@ if (!class_exists ("c_ws_plugin__s2member_cache"))
63
  $cache_needs_updating = true; /* Flag for cache update. */
64
  }
65
  /**/
66
- if ($file_download_limit_exceeded_page_cache["page"] === $file_download_limit_exceeded_page && $file_download_limit_exceeded_page_cache["time"] >= strtotime ("-15 minutes"))
67
  {
68
  $links["file_download_limit_exceeded_page"] = $file_download_limit_exceeded_page_cache["link"];
69
  }
37
  /**/
38
  $links = array ("login_welcome_page" => "", "membership_options_page" => "", "file_download_limit_exceeded_page" => "");
39
  /**/
40
+ if ($login_welcome_page_cache["page"] === $login_welcome_page && $login_welcome_page_cache["time"] >= strtotime ("-15 minutes") && $login_welcome_page_cache["link"])
41
  {
42
  $links["login_welcome_page"] = $login_welcome_page_cache["link"];
43
  }
50
  $cache_needs_updating = true; /* Flag for cache update. */
51
  }
52
  /**/
53
+ if ($membership_options_page_cache["page"] === $membership_options_page && $membership_options_page_cache["time"] >= strtotime ("-15 minutes") && $membership_options_page_cache["link"])
54
  {
55
  $links["membership_options_page"] = $membership_options_page_cache["link"];
56
  }
63
  $cache_needs_updating = true; /* Flag for cache update. */
64
  }
65
  /**/
66
+ if ($file_download_limit_exceeded_page_cache["page"] === $file_download_limit_exceeded_page && $file_download_limit_exceeded_page_cache["time"] >= strtotime ("-15 minutes") && $file_download_limit_exceeded_page_cache["link"])
67
  {
68
  $links["file_download_limit_exceeded_page"] = $file_download_limit_exceeded_page_cache["link"];
69
  }
includes/classes/constants.inc.php CHANGED
@@ -29,7 +29,7 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
29
  /**/
30
  $links = c_ws_plugin__s2member_cache::cached_page_links ();
31
  /**/
32
- $user = (is_user_logged_in ()) ? wp_get_current_user () : false;
33
  /**/
34
  $level = c_ws_plugin__s2member_user_access::user_access_level ($user);
35
  $file_downloads = c_ws_plugin__s2member_files::user_downloads ($user);
@@ -45,13 +45,13 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
45
  do_action ("ws_plugin__s2member_during_constants", get_defined_vars ());
46
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
47
  /**/
48
- define ("S2MEMBER_VERSION", ($c[] = WS_PLUGIN__S2MEMBER_VERSION));
49
  /**/
50
  define ("S2MEMBER_CURRENT_USER_IS_LOGGED_IN", ($c[] = (($user) ? true : false)));
51
  define ("S2MEMBER_CURRENT_USER_IS_LOGGED_IN_AS_MEMBER", ($c[] = ( ($user && $level >= 1) ? true : false)));
52
  define ("S2MEMBER_CURRENT_USER_ACCESS_LEVEL", ($c[] = (int)$level)); /* Negative -1 through max Membership Level number. */
53
  define ("S2MEMBER_CURRENT_USER_ACCESS_LABEL", ($c[] = (string)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $level . "_label"]));
54
- define ("S2MEMBER_CURRENT_USER_SUBSCR_ID", ($c[] = ( ($user && $subscr_id) ? (string)$subscr_id : ""))); /* Paid Subscr. ID. */
55
  define ("S2MEMBER_CURRENT_USER_SUBSCR_OR_WP_ID", ($c[] = (($user) ? (($subscr_id) ? (string)$subscr_id : (string)$user->ID) : "")));
56
  define ("S2MEMBER_CURRENT_USER_SUBSCR_GATEWAY", ($c[] = (($user) ? (string)$subscr_gateway : ""))); /* Payment Gateway. */
57
  define ("S2MEMBER_CURRENT_USER_CUSTOM", ($c[] = (($user) ? (string)$custom : ""))); /* Starts w/ domain name. */
@@ -78,7 +78,7 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
78
  define ("S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_ID", ($c[] = (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]));
79
  define ("S2MEMBER_LOGIN_WELCOME_PAGE_ID", ($c[] = (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"]));
80
  /**/
81
- define ("S2MEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL", ($c[] = site_url ("/?s2member_profile=1")));
82
  define ("S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL", ($c[] = (string)$links["file_download_limit_exceeded_page"]));
83
  define ("S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL", ($c[] = (string)$links["membership_options_page"])); /* Signup page. */
84
  define ("S2MEMBER_LOGIN_WELCOME_PAGE_URL", ($c[] = (($login_redirection_url) ? (string)$login_redirection_url : (string)$links["login_welcome_page"])));
@@ -108,8 +108,8 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
108
  define ("S2MEMBER_REG_EMAIL_FROM_NAME", ($c[] = (string)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_name"]));
109
  define ("S2MEMBER_REG_EMAIL_FROM_EMAIL", ($c[] = (string)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_email"]));
110
  /**/
111
- define ("S2MEMBER_PAYPAL_NOTIFY_URL", ($c[] = site_url ("/?s2member_paypal_notify=1")));
112
- define ("S2MEMBER_PAYPAL_RETURN_URL", ($c[] = site_url ("/?s2member_paypal_return=1")));
113
  /**/
114
  define ("S2MEMBER_PAYPAL_BUSINESS", ($c[] = (string)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_business"]));
115
  define ("S2MEMBER_PAYPAL_ENDPOINT", ($c[] = ( ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_sandbox"]) ? "www.sandbox.paypal.com" : "www.paypal.com")));
29
  /**/
30
  $links = c_ws_plugin__s2member_cache::cached_page_links ();
31
  /**/
32
+ $user = (is_user_logged_in () && is_object ($user = wp_get_current_user ()) && $user->ID) ? $user : false;
33
  /**/
34
  $level = c_ws_plugin__s2member_user_access::user_access_level ($user);
35
  $file_downloads = c_ws_plugin__s2member_files::user_downloads ($user);
45
  do_action ("ws_plugin__s2member_during_constants", get_defined_vars ());
46
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
47
  /**/
48
+ define ("S2MEMBER_VERSION", ($c[] = (string)WS_PLUGIN__S2MEMBER_VERSION));
49
  /**/
50
  define ("S2MEMBER_CURRENT_USER_IS_LOGGED_IN", ($c[] = (($user) ? true : false)));
51
  define ("S2MEMBER_CURRENT_USER_IS_LOGGED_IN_AS_MEMBER", ($c[] = ( ($user && $level >= 1) ? true : false)));
52
  define ("S2MEMBER_CURRENT_USER_ACCESS_LEVEL", ($c[] = (int)$level)); /* Negative -1 through max Membership Level number. */
53
  define ("S2MEMBER_CURRENT_USER_ACCESS_LABEL", ($c[] = (string)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $level . "_label"]));
54
+ define ("S2MEMBER_CURRENT_USER_SUBSCR_ID", ($c[] = (($user) ? (string)$subscr_id : ""))); /* A Member's Paid Subscription ID. */
55
  define ("S2MEMBER_CURRENT_USER_SUBSCR_OR_WP_ID", ($c[] = (($user) ? (($subscr_id) ? (string)$subscr_id : (string)$user->ID) : "")));
56
  define ("S2MEMBER_CURRENT_USER_SUBSCR_GATEWAY", ($c[] = (($user) ? (string)$subscr_gateway : ""))); /* Payment Gateway. */
57
  define ("S2MEMBER_CURRENT_USER_CUSTOM", ($c[] = (($user) ? (string)$custom : ""))); /* Starts w/ domain name. */
78
  define ("S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_ID", ($c[] = (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]));
79
  define ("S2MEMBER_LOGIN_WELCOME_PAGE_ID", ($c[] = (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"]));
80
  /**/
81
+ define ("S2MEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL", ($c[] = (string)site_url ("/?s2member_profile=1")));
82
  define ("S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL", ($c[] = (string)$links["file_download_limit_exceeded_page"]));
83
  define ("S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL", ($c[] = (string)$links["membership_options_page"])); /* Signup page. */
84
  define ("S2MEMBER_LOGIN_WELCOME_PAGE_URL", ($c[] = (($login_redirection_url) ? (string)$login_redirection_url : (string)$links["login_welcome_page"])));
108
  define ("S2MEMBER_REG_EMAIL_FROM_NAME", ($c[] = (string)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_name"]));
109
  define ("S2MEMBER_REG_EMAIL_FROM_EMAIL", ($c[] = (string)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_email"]));
110
  /**/
111
+ define ("S2MEMBER_PAYPAL_NOTIFY_URL", ($c[] = (string)site_url ("/?s2member_paypal_notify=1")));
112
+ define ("S2MEMBER_PAYPAL_RETURN_URL", ($c[] = (string)site_url ("/?s2member_paypal_return=1")));
113
  /**/
114
  define ("S2MEMBER_PAYPAL_BUSINESS", ($c[] = (string)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_business"]));
115
  define ("S2MEMBER_PAYPAL_ENDPOINT", ($c[] = ( ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_sandbox"]) ? "www.sandbox.paypal.com" : "www.paypal.com")));
includes/classes/custom-reg-fields.inc.php CHANGED
@@ -159,11 +159,11 @@ if (!class_exists ("c_ws_plugin__s2member_custom_reg_fields"))
159
  return apply_filters ("ws_plugin__s2member_custom_field_gen", $gen, get_defined_vars ());
160
  }
161
  /*
162
- Function determines whether or not Custom Fields apply to a specific Level.
163
  The $level parameter defaults to the current User's Access Level number.
164
  $level MUST be numeric >= 0.
165
  */
166
- public static function custom_fields_configured_at_level ($_level = "auto-detection")
167
  {
168
  eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
169
  do_action ("ws_plugin__s2member_before_custom_fields_configured_at_level", get_defined_vars ());
@@ -179,7 +179,8 @@ if (!class_exists ("c_ws_plugin__s2member_custom_reg_fields"))
179
  {
180
  foreach (json_decode ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"], true) as $field)
181
  if ($field["levels"] === "all" || in_array ($level, preg_split ("/[;,]+/", preg_replace ("/[^0-9,]/", "", $field["levels"]))))
182
- $configured[] = $field["id"]; /* Add this to the array. */
 
183
  }
184
  /**/
185
  return apply_filters ("ws_plugin__s2member_custom_fields_configured_at_level", $configured, get_defined_vars ());
@@ -195,7 +196,7 @@ if (!class_exists ("c_ws_plugin__s2member_custom_reg_fields"))
195
  /**/
196
  if (is_multisite () && is_main_site ()) /* Must be Multisite / Main Site. */
197
  {
198
- $_POST = c_ws_plugin__s2member_utils_strings::trim_deep (stripslashes_deep ($_POST));
199
  /**/
200
  echo '<input type="hidden" name="ws_plugin__s2member_registration" value="' . esc_attr (wp_create_nonce ("ws-plugin--s2member-registration")) . '" />' . "\n";
201
  /**/
@@ -208,7 +209,7 @@ if (!class_exists ("c_ws_plugin__s2member_custom_reg_fields"))
208
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
209
  /**/
210
  echo '<label for="ws-plugin--s2member-custom-reg-field-first-name">First Name *</label>' . "\n";
211
- echo '<input aria-required="true" type="text" maxlength="100" name="ws_plugin__s2member_custom_reg_field_first_name" id="ws-plugin--s2member-custom-reg-field-first-name" class="ws-plugin--s2member-custom-reg-field" value="' . format_to_edit ($_POST["ws_plugin__s2member_custom_reg_field_first_name"]) . '" />' . "\n";
212
  echo '<br />' . "\n";
213
  /**/
214
  eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
@@ -220,7 +221,7 @@ if (!class_exists ("c_ws_plugin__s2member_custom_reg_fields"))
220
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
221
  /**/
222
  echo '<label for="ws-plugin--s2member-custom-reg-field-last-name">Last Name *</label>' . "\n";
223
- echo '<input aria-required="true" type="text" maxlength="100" name="ws_plugin__s2member_custom_reg_field_last_name" id="ws-plugin--s2member-custom-reg-field-last-name" class="ws-plugin--s2member-custom-reg-field" value="' . format_to_edit ($_POST["ws_plugin__s2member_custom_reg_field_last_name"]) . '" />' . "\n";
224
  echo '<br />' . "\n";
225
  /**/
226
  eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
@@ -228,7 +229,7 @@ if (!class_exists ("c_ws_plugin__s2member_custom_reg_fields"))
228
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
229
  /**/
230
  if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"])
231
- if ($fields_applicable = c_ws_plugin__s2member_custom_reg_fields::custom_fields_configured_at_level ("auto-detection"))
232
  foreach (json_decode ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"], true) as $field)
233
  {
234
  eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
@@ -244,7 +245,7 @@ if (!class_exists ("c_ws_plugin__s2member_custom_reg_fields"))
244
  if (apply_filters ("ws_plugin__s2member_during_ms_custom_registration_fields_during_custom_fields_display", true, get_defined_vars ()))
245
  {
246
  echo '<label for="ws-plugin--s2member-custom-reg-field-' . esc_attr ($field_id_class) . '"' . ( (preg_match ("/^(checkbox|pre_checkbox)$/", $field["type"])) ? ' style="display:none;"' : '') . '>' . $field["label"] . ( ($field["required"] === "yes") ? ' *' : '') . '</label>' . "\n";
247
- echo c_ws_plugin__s2member_custom_reg_fields::custom_field_gen (__FUNCTION__, $field, "ws_plugin__s2member_custom_reg_field_", "ws-plugin--s2member-custom-reg-field-", "ws-plugin--s2member-custom-reg-field", "", "", "", $_POST, $_POST["ws_plugin__s2member_custom_reg_field_" . $field_var]);
248
  echo '<br />' . "\n";
249
  }
250
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
@@ -262,7 +263,7 @@ if (!class_exists ("c_ws_plugin__s2member_custom_reg_fields"))
262
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
263
  /**/
264
  echo '<label for="ws-plugin--s2member-custom-reg-field-opt-in">' . "\n";
265
- echo '<input type="checkbox" name="ws_plugin__s2member_custom_reg_field_opt_in" id="ws-plugin--s2member-custom-reg-field-opt-in" class="ws-plugin--s2member-custom-reg-field" value="1"' . ( ( (empty ($_POST) && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in"] == 1) || $_POST["ws_plugin__s2member_custom_reg_field_opt_in"]) ? ' checked="checked"' : '') . ' />' . "\n";
266
  echo $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in_label"] . "\n";
267
  echo '</label>' . "\n";
268
  echo '<br />' . "\n";
@@ -293,7 +294,7 @@ if (!class_exists ("c_ws_plugin__s2member_custom_reg_fields"))
293
  {
294
  do_action ("ws_plugin__s2member_before_custom_registration_fields", get_defined_vars ());
295
  /**/
296
- $_POST = c_ws_plugin__s2member_utils_strings::trim_deep (stripslashes_deep ($_POST));
297
  /**/
298
  echo '<input type="hidden" name="ws_plugin__s2member_registration" value="' . esc_attr (wp_create_nonce ("ws-plugin--s2member-registration")) . '" />' . "\n";
299
  /**/
@@ -312,7 +313,7 @@ if (!class_exists ("c_ws_plugin__s2member_custom_reg_fields"))
312
  echo '<p>' . "\n";
313
  echo '<label>' . "\n";
314
  echo '<span>Password *</span><br />' . "\n";
315
- echo '<input aria-required="true" type="password" maxlength="100" autocomplete="off" name="ws_plugin__s2member_custom_reg_field_user_pass" id="ws-plugin--s2member-custom-reg-field-user-pass" class="ws-plugin--s2member-custom-reg-field" value="' . format_to_edit ($_POST["ws_plugin__s2member_custom_reg_field_user_pass"]) . '" tabindex="' . esc_attr (($tabindex = $tabindex + 10)) . '" />' . "\n";
316
  echo '</label>' . "\n";
317
  echo '</p>';
318
  /**/
@@ -328,7 +329,7 @@ if (!class_exists ("c_ws_plugin__s2member_custom_reg_fields"))
328
  echo '<p>' . "\n";
329
  echo '<label>' . "\n";
330
  echo '<span>First Name *</span><br />' . "\n";
331
- echo '<input aria-required="true" type="text" maxlength="100" name="ws_plugin__s2member_custom_reg_field_first_name" id="ws-plugin--s2member-custom-reg-field-first-name" class="ws-plugin--s2member-custom-reg-field" value="' . format_to_edit ($_POST["ws_plugin__s2member_custom_reg_field_first_name"]) . '" tabindex="' . esc_attr (($tabindex = $tabindex + 10)) . '" />' . "\n";
332
  echo '</label>' . "\n";
333
  echo '</p>';
334
  /**/
@@ -343,7 +344,7 @@ if (!class_exists ("c_ws_plugin__s2member_custom_reg_fields"))
343
  echo '<p>' . "\n";
344
  echo '<label>' . "\n";
345
  echo '<span>Last Name *</span><br />' . "\n";
346
- echo '<input aria-required="true" type="text" maxlength="100" name="ws_plugin__s2member_custom_reg_field_last_name" id="ws-plugin--s2member-custom-reg-field-last-name" class="ws-plugin--s2member-custom-reg-field" value="' . format_to_edit ($_POST["ws_plugin__s2member_custom_reg_field_last_name"]) . '" tabindex="' . esc_attr (($tabindex = $tabindex + 10)) . '" />' . "\n";
347
  echo '</label>' . "\n";
348
  echo '</p>';
349
  /**/
@@ -352,7 +353,7 @@ if (!class_exists ("c_ws_plugin__s2member_custom_reg_fields"))
352
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
353
  /**/
354
  if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"])
355
- if ($fields_applicable = c_ws_plugin__s2member_custom_reg_fields::custom_fields_configured_at_level ("auto-detection"))
356
  foreach (json_decode ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"], true) as $field)
357
  {
358
  eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
@@ -370,7 +371,7 @@ if (!class_exists ("c_ws_plugin__s2member_custom_reg_fields"))
370
  echo '<p>' . "\n";
371
  echo '<label>' . "\n";
372
  echo '<span' . ( (preg_match ("/^(checkbox|pre_checkbox)$/", $field["type"])) ? ' style="display:none;"' : '') . '>' . $field["label"] . ( ($field["required"] === "yes") ? ' *' : '') . '</span>' . ( (preg_match ("/^(checkbox|pre_checkbox)$/", $field["type"])) ? '' : '<br />') . "\n";
373
- echo c_ws_plugin__s2member_custom_reg_fields::custom_field_gen (__FUNCTION__, $field, "ws_plugin__s2member_custom_reg_field_", "ws-plugin--s2member-custom-reg-field-", "ws-plugin--s2member-custom-reg-field", "", ($tabindex = $tabindex + 10), "", $_POST, $_POST["ws_plugin__s2member_custom_reg_field_" . $field_var]);
374
  echo '</label>' . "\n";
375
  echo '</p>';
376
  }
@@ -390,7 +391,7 @@ if (!class_exists ("c_ws_plugin__s2member_custom_reg_fields"))
390
  /**/
391
  echo '<p>' . "\n";
392
  echo '<label>' . "\n";
393
- echo '<input type="checkbox" name="ws_plugin__s2member_custom_reg_field_opt_in" id="ws-plugin--s2member-custom-reg-field-opt-in" class="ws-plugin--s2member-custom-reg-field" value="1"' . ( ( (empty ($_POST) && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in"] == 1) || $_POST["ws_plugin__s2member_custom_reg_field_opt_in"]) ? ' checked="checked"' : '') . ' tabindex="' . esc_attr (($tabindex = $tabindex + 10)) . '" />' . "\n";
394
  echo $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in_label"] . "\n";
395
  echo '</label>' . "\n";
396
  echo '</p>';
@@ -408,7 +409,7 @@ if (!class_exists ("c_ws_plugin__s2member_custom_reg_fields"))
408
  do_action ("ws_plugin__s2member_after_custom_registration_fields", get_defined_vars ());
409
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
410
  /**/
411
- return;
412
  }
413
  /*
414
  This adds an opt-in checkbox to the BuddyPress signup form.
@@ -422,11 +423,13 @@ if (!class_exists ("c_ws_plugin__s2member_custom_reg_fields"))
422
  {
423
  do_action ("ws_plugin__s2member_during_opt_in_4bp_before", get_defined_vars ());
424
  /**/
 
 
425
  echo '<div class="s2member-opt-in-4bp" style="' . apply_filters ("ws_plugin__s2member_opt_in_4bp_styles", "clear:both; padding-top:10px; margin-left:-3px;", get_defined_vars ()) . '">' . "\n";
426
  /**/
427
  echo '<p>' . "\n";
428
  echo '<label>' . "\n";
429
- echo '<input type="checkbox" name="ws_plugin__s2member_custom_reg_field_opt_in" id="ws-plugin--s2member-custom-reg-field-opt-in" class="ws-plugin--s2member-custom-reg-field" value="1"' . ( ( (empty ($_POST) && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in"] == 1) || $_POST["ws_plugin__s2member_custom_reg_field_opt_in"]) ? ' checked="checked"' : '') . ' />' . "\n";
430
  echo $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in_label"] . "\n";
431
  echo '</label>' . "\n";
432
  echo '</p>';
@@ -438,7 +441,7 @@ if (!class_exists ("c_ws_plugin__s2member_custom_reg_fields"))
438
  /**/
439
  do_action ("ws_plugin__s2member_after_opt_in_4bp", get_defined_vars ());
440
  /**/
441
- return;
442
  }
443
  }
444
  }
159
  return apply_filters ("ws_plugin__s2member_custom_field_gen", $gen, get_defined_vars ());
160
  }
161
  /*
162
+ Determines whether or not Custom Fields apply to a specific Level.
163
  The $level parameter defaults to the current User's Access Level number.
164
  $level MUST be numeric >= 0.
165
  */
166
+ public static function custom_fields_configured_at_level ($_level = "auto-detection", $_editable_context = FALSE)
167
  {
168
  eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
169
  do_action ("ws_plugin__s2member_before_custom_fields_configured_at_level", get_defined_vars ());
179
  {
180
  foreach (json_decode ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"], true) as $field)
181
  if ($field["levels"] === "all" || in_array ($level, preg_split ("/[;,]+/", preg_replace ("/[^0-9,]/", "", $field["levels"]))))
182
+ if (!$_editable_context || ($_editable_context === "registration" && $field["editable"] !== "yes-invisible") || ($_editable_context === "profile" && $field["editable"] !== "no-invisible"))
183
+ $configured[] = $field["id"]; /* Add this to the array. */
184
  }
185
  /**/
186
  return apply_filters ("ws_plugin__s2member_custom_fields_configured_at_level", $configured, get_defined_vars ());
196
  /**/
197
  if (is_multisite () && is_main_site ()) /* Must be Multisite / Main Site. */
198
  {
199
+ $_p = c_ws_plugin__s2member_utils_strings::trim_deep (stripslashes_deep ($_POST));
200
  /**/
201
  echo '<input type="hidden" name="ws_plugin__s2member_registration" value="' . esc_attr (wp_create_nonce ("ws-plugin--s2member-registration")) . '" />' . "\n";
202
  /**/
209
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
210
  /**/
211
  echo '<label for="ws-plugin--s2member-custom-reg-field-first-name">First Name *</label>' . "\n";
212
+ echo '<input aria-required="true" type="text" maxlength="100" name="ws_plugin__s2member_custom_reg_field_first_name" id="ws-plugin--s2member-custom-reg-field-first-name" class="ws-plugin--s2member-custom-reg-field" value="' . format_to_edit ($_p["ws_plugin__s2member_custom_reg_field_first_name"]) . '" />' . "\n";
213
  echo '<br />' . "\n";
214
  /**/
215
  eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
221
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
222
  /**/
223
  echo '<label for="ws-plugin--s2member-custom-reg-field-last-name">Last Name *</label>' . "\n";
224
+ echo '<input aria-required="true" type="text" maxlength="100" name="ws_plugin__s2member_custom_reg_field_last_name" id="ws-plugin--s2member-custom-reg-field-last-name" class="ws-plugin--s2member-custom-reg-field" value="' . format_to_edit ($_p["ws_plugin__s2member_custom_reg_field_last_name"]) . '" />' . "\n";
225
  echo '<br />' . "\n";
226
  /**/
227
  eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
229
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
230
  /**/
231
  if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"])
232
+ if ($fields_applicable = c_ws_plugin__s2member_custom_reg_fields::custom_fields_configured_at_level ("auto-detection", "registration"))
233
  foreach (json_decode ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"], true) as $field)
234
  {
235
  eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
245
  if (apply_filters ("ws_plugin__s2member_during_ms_custom_registration_fields_during_custom_fields_display", true, get_defined_vars ()))
246
  {
247
  echo '<label for="ws-plugin--s2member-custom-reg-field-' . esc_attr ($field_id_class) . '"' . ( (preg_match ("/^(checkbox|pre_checkbox)$/", $field["type"])) ? ' style="display:none;"' : '') . '>' . $field["label"] . ( ($field["required"] === "yes") ? ' *' : '') . '</label>' . "\n";
248
+ echo c_ws_plugin__s2member_custom_reg_fields::custom_field_gen (__FUNCTION__, $field, "ws_plugin__s2member_custom_reg_field_", "ws-plugin--s2member-custom-reg-field-", "ws-plugin--s2member-custom-reg-field", "", "", "", $_p,$_p["ws_plugin__s2member_custom_reg_field_" . $field_var]);
249
  echo '<br />' . "\n";
250
  }
251
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
263
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
264
  /**/
265
  echo '<label for="ws-plugin--s2member-custom-reg-field-opt-in">' . "\n";
266
+ echo '<input type="checkbox" name="ws_plugin__s2member_custom_reg_field_opt_in" id="ws-plugin--s2member-custom-reg-field-opt-in" class="ws-plugin--s2member-custom-reg-field" value="1"' . ( ( (empty ($_p) && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in"] == 1) || $_p["ws_plugin__s2member_custom_reg_field_opt_in"]) ? ' checked="checked"' : '') . ' />' . "\n";
267
  echo $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in_label"] . "\n";
268
  echo '</label>' . "\n";
269
  echo '<br />' . "\n";
294
  {
295
  do_action ("ws_plugin__s2member_before_custom_registration_fields", get_defined_vars ());
296
  /**/
297
+ $_p = c_ws_plugin__s2member_utils_strings::trim_deep (stripslashes_deep ($_POST));
298
  /**/
299
  echo '<input type="hidden" name="ws_plugin__s2member_registration" value="' . esc_attr (wp_create_nonce ("ws-plugin--s2member-registration")) . '" />' . "\n";
300
  /**/
313
  echo '<p>' . "\n";
314
  echo '<label>' . "\n";
315
  echo '<span>Password *</span><br />' . "\n";
316
+ echo '<input aria-required="true" type="password" maxlength="100" autocomplete="off" name="ws_plugin__s2member_custom_reg_field_user_pass" id="ws-plugin--s2member-custom-reg-field-user-pass" class="ws-plugin--s2member-custom-reg-field" value="' . format_to_edit ($_p["ws_plugin__s2member_custom_reg_field_user_pass"]) . '" tabindex="' . esc_attr (($tabindex = $tabindex + 10)) . '" />' . "\n";
317
  echo '</label>' . "\n";
318
  echo '</p>';
319
  /**/
329
  echo '<p>' . "\n";
330
  echo '<label>' . "\n";
331
  echo '<span>First Name *</span><br />' . "\n";
332
+ echo '<input aria-required="true" type="text" maxlength="100" name="ws_plugin__s2member_custom_reg_field_first_name" id="ws-plugin--s2member-custom-reg-field-first-name" class="ws-plugin--s2member-custom-reg-field" value="' . format_to_edit ($_p["ws_plugin__s2member_custom_reg_field_first_name"]) . '" tabindex="' . esc_attr (($tabindex = $tabindex + 10)) . '" />' . "\n";
333
  echo '</label>' . "\n";
334
  echo '</p>';
335
  /**/
344
  echo '<p>' . "\n";
345
  echo '<label>' . "\n";
346
  echo '<span>Last Name *</span><br />' . "\n";
347
+ echo '<input aria-required="true" type="text" maxlength="100" name="ws_plugin__s2member_custom_reg_field_last_name" id="ws-plugin--s2member-custom-reg-field-last-name" class="ws-plugin--s2member-custom-reg-field" value="' . format_to_edit ($_p["ws_plugin__s2member_custom_reg_field_last_name"]) . '" tabindex="' . esc_attr (($tabindex = $tabindex + 10)) . '" />' . "\n";
348
  echo '</label>' . "\n";
349
  echo '</p>';
350
  /**/
353
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
354
  /**/
355
  if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"])
356
+ if ($fields_applicable = c_ws_plugin__s2member_custom_reg_fields::custom_fields_configured_at_level ("auto-detection", "registration"))
357
  foreach (json_decode ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"], true) as $field)
358
  {
359
  eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
371
  echo '<p>' . "\n";
372
  echo '<label>' . "\n";
373
  echo '<span' . ( (preg_match ("/^(checkbox|pre_checkbox)$/", $field["type"])) ? ' style="display:none;"' : '') . '>' . $field["label"] . ( ($field["required"] === "yes") ? ' *' : '') . '</span>' . ( (preg_match ("/^(checkbox|pre_checkbox)$/", $field["type"])) ? '' : '<br />') . "\n";
374
+ echo c_ws_plugin__s2member_custom_reg_fields::custom_field_gen (__FUNCTION__, $field, "ws_plugin__s2member_custom_reg_field_", "ws-plugin--s2member-custom-reg-field-", "ws-plugin--s2member-custom-reg-field", "", ($tabindex = $tabindex + 10), "", $_p,$_p["ws_plugin__s2member_custom_reg_field_" . $field_var]);
375
  echo '</label>' . "\n";
376
  echo '</p>';
377
  }
391
  /**/
392
  echo '<p>' . "\n";
393
  echo '<label>' . "\n";
394
+ echo '<input type="checkbox" name="ws_plugin__s2member_custom_reg_field_opt_in" id="ws-plugin--s2member-custom-reg-field-opt-in" class="ws-plugin--s2member-custom-reg-field" value="1"' . ( ( (empty ($_p) && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in"] == 1) || $_p["ws_plugin__s2member_custom_reg_field_opt_in"]) ? ' checked="checked"' : '') . ' tabindex="' . esc_attr (($tabindex = $tabindex + 10)) . '" />' . "\n";
395
  echo $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in_label"] . "\n";
396
  echo '</label>' . "\n";
397
  echo '</p>';
409
  do_action ("ws_plugin__s2member_after_custom_registration_fields", get_defined_vars ());
410
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
411
  /**/
412
+ return; /* Return for uniformity. */
413
  }
414
  /*
415
  This adds an opt-in checkbox to the BuddyPress signup form.
423
  {
424
  do_action ("ws_plugin__s2member_during_opt_in_4bp_before", get_defined_vars ());
425
  /**/
426
+ $_p = c_ws_plugin__s2member_utils_strings::trim_deep (stripslashes_deep ($_POST));
427
+ /**/
428
  echo '<div class="s2member-opt-in-4bp" style="' . apply_filters ("ws_plugin__s2member_opt_in_4bp_styles", "clear:both; padding-top:10px; margin-left:-3px;", get_defined_vars ()) . '">' . "\n";
429
  /**/
430
  echo '<p>' . "\n";
431
  echo '<label>' . "\n";
432
+ echo '<input type="checkbox" name="ws_plugin__s2member_custom_reg_field_opt_in" id="ws-plugin--s2member-custom-reg-field-opt-in" class="ws-plugin--s2member-custom-reg-field" value="1"' . ( ( (empty ($_p) && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in"] == 1) || $_p["ws_plugin__s2member_custom_reg_field_opt_in"]) ? ' checked="checked"' : '') . ' />' . "\n";
433
  echo $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in_label"] . "\n";
434
  echo '</label>' . "\n";
435
  echo '</p>';
441
  /**/
442
  do_action ("ws_plugin__s2member_after_opt_in_4bp", get_defined_vars ());
443
  /**/
444
+ return; /* Return for uniformity. */
445
  }
446
  }
447
  }
includes/classes/files-in.inc.php CHANGED
@@ -47,8 +47,8 @@ if (!class_exists ("c_ws_plugin__s2member_files_in"))
47
  else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]) /* Is a Membership Options Page configured? */
48
  /* This file will be processed WITHOUT a Download Key, using Membership Level Access ( w/ possible Custom Capabilities ). */
49
  {
50
- if (!has_filter ("ws_plugin__s2member_check_file_download_access_current_user", "c_ws_plugin__s2member_files_in::_file_remote_authorization"))
51
- add_filter ("ws_plugin__s2member_check_file_download_access_current_user", "c_ws_plugin__s2member_files_in::_file_remote_authorization", 10, 2);
52
  /**/
53
  if (($file_download_access_is_allowed = $min_level_4_downloads = c_ws_plugin__s2member_files::min_level_4_downloads ()) === false)
54
  {
@@ -56,18 +56,18 @@ if (!class_exists ("c_ws_plugin__s2member_files_in"))
56
  exit ("503: Sorry, file downloads are NOT enabled yet. Please contact Support for assistance. If you are the site owner, please configure `s2Member -> Download Options`.");
57
  }
58
  /**/
59
- else if (! ($current_user = apply_filters ("ws_plugin__s2member_check_file_download_access_current_user", ( (is_user_logged_in ()) ? wp_get_current_user () : false), get_defined_vars ()))/**/
60
  && wp_redirect (add_query_arg (urlencode_deep (array ("s2member_seeking" => "file-" . $_GET["s2member_file_download"], "s2member_level_req" => (string)$min_level_4_downloads)), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])), apply_filters ("ws_plugin__s2member_content_redirect_status", 301, get_defined_vars ())) !== "nill")
61
  exit ();
62
  /**/
63
- else if ((!is_array ($file_downloads = c_ws_plugin__s2member_files::user_downloads ($current_user)) || !$file_downloads["allowed"] || !$file_downloads["allowed_days"])/**/
64
  && wp_redirect (add_query_arg (urlencode_deep (array ("s2member_seeking" => "file-" . $_GET["s2member_file_download"])), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"])), apply_filters ("ws_plugin__s2member_content_redirect_status", 301, get_defined_vars ())) !== "nill")
65
  exit ();
66
  /**/
67
  else if (preg_match ("/^access[_\-]s2member[_\-]level([0-4])\//", $_GET["s2member_file_download"], $m))
68
  {
69
  $level_req = $m[1]; /* Which Level does this require? */
70
- if (!$current_user->has_cap ("access_s2member_level" . $level_req) /* Does the User have access to this Level? */
71
  && wp_redirect (add_query_arg (urlencode_deep (array ("s2member_seeking" => "file-" . $_GET["s2member_file_download"], "s2member_level_req" => $level_req)), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])), apply_filters ("ws_plugin__s2member_content_redirect_status", 301, get_defined_vars ())) !== "nill")
72
  exit ();
73
  }
@@ -75,15 +75,15 @@ if (!class_exists ("c_ws_plugin__s2member_files_in"))
75
  else if (preg_match ("/^access[_\-]s2member[_\-]ccap[_\-](.+?)\//", $_GET["s2member_file_download"], $m))
76
  {
77
  $ccap_req = preg_replace ("/-/", "_", $m[1]); /* Which Capability does this require? */
78
- if (!$current_user->has_cap ("access_s2member_ccap_" . $ccap_req) /* Does the User have access to this Custom Capability? */
79
  && wp_redirect (add_query_arg (urlencode_deep (array ("s2member_seeking" => "file-" . $_GET["s2member_file_download"], "s2member_ccap_req" => $ccap_req)), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])), apply_filters ("ws_plugin__s2member_content_redirect_status", 301, get_defined_vars ())) !== "nill")
80
  exit ();
81
  }
82
  /**/
83
  $previous_file_downloads = 0; /* Here we're going to count how many downloads they've performed. */
84
  $max_days_logged = c_ws_plugin__s2member_files::max_download_period (); /* The longest period in days. */
85
- $file_download_access_log = (array)get_user_option ("s2member_file_download_access_log", $current_user->ID);
86
- $file_download_access_arc = (array)get_user_option ("s2member_file_download_access_arc", $current_user->ID);
87
  /**/
88
  foreach ($file_download_access_log as $file_download_access_log_entry_key => $file_download_access_log_entry)
89
  {
@@ -108,8 +108,8 @@ if (!class_exists ("c_ws_plugin__s2member_files_in"))
108
  if (!$already_downloaded) /* Only add this file to the log if they have not already downloaded it. */
109
  $file_download_access_log[] = array ("date" => date ("Y-m-d"), "file" => $_GET["s2member_file_download"]);
110
  /**/
111
- update_user_option ($current_user->ID, "s2member_file_download_access_arc", c_ws_plugin__s2member_utils_arrays::array_unique ($file_download_access_arc));
112
- update_user_option ($current_user->ID, "s2member_file_download_access_log", c_ws_plugin__s2member_utils_arrays::array_unique ($file_download_access_log));
113
  }
114
  }
115
  else /* Otherwise... it's either $excluded; or permission was granted with a valid Download Key. */
@@ -164,7 +164,7 @@ if (!class_exists ("c_ws_plugin__s2member_files_in"))
164
  while (!feof ($stream) && ($chunk_size = strlen ($data = fread ($stream, 2097152))))
165
  eval ('echo dechex ($chunk_size) . "\r\n". $data . "\r\n"; @flush ();');
166
  /**/
167
- fclose ($stream);
168
  /**/
169
  exit ("0\r\n\r\n");
170
  }
@@ -178,33 +178,33 @@ if (!class_exists ("c_ws_plugin__s2member_files_in"))
178
  }
179
  /*
180
  A sort of callback function that handles header authorization for File Downloads.
181
- Attach to: add_filter("ws_plugin__s2member_check_file_download_access_current_user");
182
  */
183
- public static function _file_remote_authorization ($current_user = FALSE)
184
  {
185
  eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
186
  do_action ("_ws_plugin__s2member_before_file_remote_authorization", get_defined_vars ());
187
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
188
  /**/
189
- if (!$current_user && $_GET["s2member_file_remote"]) /* Use remote header authorization? */
190
  {
191
  do_action ("_ws_plugin__s2member_during_file_remote_authorization_before", get_defined_vars ());
192
  /**/
193
- if (!$_SERVER["PHP_AUTH_USER"] || !user_pass_ok ($_SERVER["PHP_AUTH_USER"], $_SERVER["PHP_AUTH_PW"]))
194
  {
195
  header ('WWW-Authenticate: Basic realm="Members Only"');
196
  header ("HTTP/1.0 401 Unauthorized");
197
  exit ("Access Denied");
198
  }
199
- else /* If authenticated, we can now assign $current_user. */
200
  {
201
- $current_user = new WP_User ($_SERVER["PHP_AUTH_USER"]);
202
  }
203
  /**/
204
  do_action ("_ws_plugin__s2member_during_file_remote_authorization_after", get_defined_vars ());
205
  }
206
  /**/
207
- return apply_filters ("_ws_plugin__s2member_file_remote_authorization", $current_user, get_defined_vars ());
208
  }
209
  }
210
  }
47
  else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]) /* Is a Membership Options Page configured? */
48
  /* This file will be processed WITHOUT a Download Key, using Membership Level Access ( w/ possible Custom Capabilities ). */
49
  {
50
+ if (!has_filter ("ws_plugin__s2member_check_file_download_access_user", "c_ws_plugin__s2member_files_in::_file_remote_authorization"))
51
+ add_filter ("ws_plugin__s2member_check_file_download_access_user", "c_ws_plugin__s2member_files_in::_file_remote_authorization", 10, 2);
52
  /**/
53
  if (($file_download_access_is_allowed = $min_level_4_downloads = c_ws_plugin__s2member_files::min_level_4_downloads ()) === false)
54
  {
56
  exit ("503: Sorry, file downloads are NOT enabled yet. Please contact Support for assistance. If you are the site owner, please configure `s2Member -> Download Options`.");
57
  }
58
  /**/
59
+ else if ((!is_object ($user = apply_filters ("ws_plugin__s2member_check_file_download_access_user", ( (is_user_logged_in ()) ? wp_get_current_user () : false), get_defined_vars ())) || !$user->ID)/**/
60
  && wp_redirect (add_query_arg (urlencode_deep (array ("s2member_seeking" => "file-" . $_GET["s2member_file_download"], "s2member_level_req" => (string)$min_level_4_downloads)), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])), apply_filters ("ws_plugin__s2member_content_redirect_status", 301, get_defined_vars ())) !== "nill")
61
  exit ();
62
  /**/
63
+ else if ((!is_array ($file_downloads = c_ws_plugin__s2member_files::user_downloads ($user)) || !$file_downloads["allowed"] || !$file_downloads["allowed_days"])/**/
64
  && wp_redirect (add_query_arg (urlencode_deep (array ("s2member_seeking" => "file-" . $_GET["s2member_file_download"])), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"])), apply_filters ("ws_plugin__s2member_content_redirect_status", 301, get_defined_vars ())) !== "nill")
65
  exit ();
66
  /**/
67
  else if (preg_match ("/^access[_\-]s2member[_\-]level([0-4])\//", $_GET["s2member_file_download"], $m))
68
  {
69
  $level_req = $m[1]; /* Which Level does this require? */
70
+ if (!$user->has_cap ("access_s2member_level" . $level_req) /* Does the User have access to this Level? */
71
  && wp_redirect (add_query_arg (urlencode_deep (array ("s2member_seeking" => "file-" . $_GET["s2member_file_download"], "s2member_level_req" => $level_req)), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])), apply_filters ("ws_plugin__s2member_content_redirect_status", 301, get_defined_vars ())) !== "nill")
72
  exit ();
73
  }
75
  else if (preg_match ("/^access[_\-]s2member[_\-]ccap[_\-](.+?)\//", $_GET["s2member_file_download"], $m))
76
  {
77
  $ccap_req = preg_replace ("/-/", "_", $m[1]); /* Which Capability does this require? */
78
+ if (!$user->has_cap ("access_s2member_ccap_" . $ccap_req) /* Does the User have access to this Custom Capability? */
79
  && wp_redirect (add_query_arg (urlencode_deep (array ("s2member_seeking" => "file-" . $_GET["s2member_file_download"], "s2member_ccap_req" => $ccap_req)), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])), apply_filters ("ws_plugin__s2member_content_redirect_status", 301, get_defined_vars ())) !== "nill")
80
  exit ();
81
  }
82
  /**/
83
  $previous_file_downloads = 0; /* Here we're going to count how many downloads they've performed. */
84
  $max_days_logged = c_ws_plugin__s2member_files::max_download_period (); /* The longest period in days. */
85
+ $file_download_access_log = (array)get_user_option ("s2member_file_download_access_log", $user->ID);
86
+ $file_download_access_arc = (array)get_user_option ("s2member_file_download_access_arc", $user->ID);
87
  /**/
88
  foreach ($file_download_access_log as $file_download_access_log_entry_key => $file_download_access_log_entry)
89
  {
108
  if (!$already_downloaded) /* Only add this file to the log if they have not already downloaded it. */
109
  $file_download_access_log[] = array ("date" => date ("Y-m-d"), "file" => $_GET["s2member_file_download"]);
110
  /**/
111
+ update_user_option ($user->ID, "s2member_file_download_access_arc", c_ws_plugin__s2member_utils_arrays::array_unique ($file_download_access_arc));
112
+ update_user_option ($user->ID, "s2member_file_download_access_log", c_ws_plugin__s2member_utils_arrays::array_unique ($file_download_access_log));
113
  }
114
  }
115
  else /* Otherwise... it's either $excluded; or permission was granted with a valid Download Key. */
164
  while (!feof ($stream) && ($chunk_size = strlen ($data = fread ($stream, 2097152))))
165
  eval ('echo dechex ($chunk_size) . "\r\n". $data . "\r\n"; @flush ();');
166
  /**/
167
+ fclose($stream);
168
  /**/
169
  exit ("0\r\n\r\n");
170
  }
178
  }
179
  /*
180
  A sort of callback function that handles header authorization for File Downloads.
181
+ Attach to: add_filter("ws_plugin__s2member_check_file_download_access_user");
182
  */
183
+ public static function _file_remote_authorization ($user = FALSE)
184
  {
185
  eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
186
  do_action ("_ws_plugin__s2member_before_file_remote_authorization", get_defined_vars ());
187
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
188
  /**/
189
+ if (!$user && $_GET["s2member_file_remote"]) /* Use remote header authorization? */
190
  {
191
  do_action ("_ws_plugin__s2member_during_file_remote_authorization_before", get_defined_vars ());
192
  /**/
193
+ if (!$_SERVER["PHP_AUTH_USER"] || !$_SERVER["PHP_AUTH_PW"] || !user_pass_ok ($_SERVER["PHP_AUTH_USER"], $_SERVER["PHP_AUTH_PW"]))
194
  {
195
  header ('WWW-Authenticate: Basic realm="Members Only"');
196
  header ("HTTP/1.0 401 Unauthorized");
197
  exit ("Access Denied");
198
  }
199
+ else if (is_object ($_user = new WP_User ($_SERVER["PHP_AUTH_USER"])) && $_user->ID)
200
  {
201
+ $user = $_user; /* Now assign $user. */
202
  }
203
  /**/
204
  do_action ("_ws_plugin__s2member_during_file_remote_authorization_after", get_defined_vars ());
205
  }
206
  /**/
207
+ return apply_filters ("_ws_plugin__s2member_file_remote_authorization", $user, get_defined_vars ());
208
  }
209
  }
210
  }
includes/classes/files.inc.php CHANGED
@@ -50,6 +50,8 @@ if (!class_exists ("c_ws_plugin__s2member_files"))
50
  {
51
  do_action ("ws_plugin__s2member_before_max_download_period", get_defined_vars ());
52
  /**/
 
 
53
  if ($days = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_file_downloads_allowed_days"])
54
  $max = ($max < $days) ? $days : $max;
55
  /**/
50
  {
51
  do_action ("ws_plugin__s2member_before_max_download_period", get_defined_vars ());
52
  /**/
53
+ $max = 0; /* This initializes the default value for $max file download allowed days. */
54
+ /**/
55
  if ($days = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_file_downloads_allowed_days"])
56
  $max = ($max < $days) ? $days : $max;
57
  /**/
includes/classes/installation.inc.php CHANGED
@@ -301,11 +301,11 @@ if (!class_exists ("c_ws_plugin__s2member_installation"))
301
  delete_option ("ws_plugin__s2member_activated_version");
302
  delete_option ("ws_plugin__s2member_activated_mms_version");
303
  /**/
304
- $wpdb->query ("DELETE FROM `" . $wpdb->options . "` WHERE `option_name` LIKE '%s2member\_%'");
305
- $wpdb->query ("DELETE FROM `" . $wpdb->options . "` WHERE `option_name` LIKE '\_transient\_s2m\_%'");
306
- $wpdb->query ("DELETE FROM `" . $wpdb->options . "` WHERE `option_name` LIKE '\_transient\_timeout\_s2m\_%'");
307
- $wpdb->query ("DELETE FROM `" . $wpdb->postmeta . "` WHERE `meta_key` LIKE '%s2member\_%'");
308
- $wpdb->query ("DELETE FROM `" . $wpdb->usermeta . "` WHERE `meta_key` LIKE '%s2member\_%'");
309
  /**/
310
  do_action ("ws_plugin__s2member_during_deactivation", get_defined_vars ());
311
  }
301
  delete_option ("ws_plugin__s2member_activated_version");
302
  delete_option ("ws_plugin__s2member_activated_mms_version");
303
  /**/
304
+ $wpdb->query ("DELETE FROM `" . $wpdb->options . "` WHERE `option_name` LIKE '%" . esc_sql (like_escape ("s2member_")) . "%'");
305
+ $wpdb->query ("DELETE FROM `" . $wpdb->options . "` WHERE `option_name` LIKE '" . esc_sql (like_escape ("_transient_s2m_")) . "%'");
306
+ $wpdb->query ("DELETE FROM `" . $wpdb->options . "` WHERE `option_name` LIKE '" . esc_sql (like_escape ("_transient_timeout_s2m_")) . "%'");
307
+ $wpdb->query ("DELETE FROM `" . $wpdb->postmeta . "` WHERE `meta_key` LIKE '%" . esc_sql (like_escape ("s2member_")) . "%'");
308
+ $wpdb->query ("DELETE FROM `" . $wpdb->usermeta . "` WHERE `meta_key` LIKE '%" . esc_sql (like_escape ("s2member_")) . "%'");
309
  /**/
310
  do_action ("ws_plugin__s2member_during_deactivation", get_defined_vars ());
311
  }
includes/classes/ip-restrictions.inc.php CHANGED
@@ -116,8 +116,8 @@ if (!class_exists ("c_ws_plugin__s2member_ip_restrictions"))
116
  $transient_entries = $prefix . md5 ("s2member_ip_restrictions_" . $restriction . "_entries");
117
  $transient_security_breach = $prefix . md5 ("s2member_ip_restrictions_" . $restriction . "_security_breach");
118
  /**/
119
- $wpdb->query ("DELETE FROM `" . $wpdb->options . "` WHERE `option_name` = '" . esc_sql ($transient_entries) . "'");
120
- $wpdb->query ("DELETE FROM `" . $wpdb->options . "` WHERE `option_name` = '" . esc_sql ($transient_security_breach) . "'");
121
  /**/
122
  do_action ("ws_plugin__s2member_after_delete_reset_specific_ip_restrictions", get_defined_vars ());
123
  /**/
@@ -148,8 +148,8 @@ if (!class_exists ("c_ws_plugin__s2member_ip_restrictions"))
148
  /**/
149
  do_action ("ws_plugin__s2member_before_delete_reset_all_ip_restrictions", get_defined_vars ());
150
  /**/
151
- $wpdb->query ("DELETE FROM `" . $wpdb->options . "` WHERE `option_name` LIKE '\_transient\_s2m\_ipr\_%'");
152
- $wpdb->query ("DELETE FROM `" . $wpdb->options . "` WHERE `option_name` LIKE '\_transient\_timeout\_s2m\_ipr\_%'");
153
  /**/
154
  do_action ("ws_plugin__s2member_after_delete_reset_all_ip_restrictions", get_defined_vars ());
155
  /**/
116
  $transient_entries = $prefix . md5 ("s2member_ip_restrictions_" . $restriction . "_entries");
117
  $transient_security_breach = $prefix . md5 ("s2member_ip_restrictions_" . $restriction . "_security_breach");
118
  /**/
119
+ $wpdb->query ("DELETE FROM `" . $wpdb->options . "` WHERE `option_name` LIKE '%" . esc_sql (like_escape ($transient_entries)) . "'");
120
+ $wpdb->query ("DELETE FROM `" . $wpdb->options . "` WHERE `option_name` LIKE '%" . esc_sql (like_escape ($transient_security_breach)) . "'");
121
  /**/
122
  do_action ("ws_plugin__s2member_after_delete_reset_specific_ip_restrictions", get_defined_vars ());
123
  /**/
148
  /**/
149
  do_action ("ws_plugin__s2member_before_delete_reset_all_ip_restrictions", get_defined_vars ());
150
  /**/
151
+ $wpdb->query ("DELETE FROM `" . $wpdb->options . "` WHERE `option_name` LIKE '" . esc_sql (like_escape ("_transient_s2m_ipr_")) . "%'");
152
+ $wpdb->query ("DELETE FROM `" . $wpdb->options . "` WHERE `option_name` LIKE '" . esc_sql (like_escape ("_transient_timeout_s2m_ipr_")) . "%'");
153
  /**/
154
  do_action ("ws_plugin__s2member_after_delete_reset_all_ip_restrictions", get_defined_vars ());
155
  /**/
includes/classes/login-redirects-r.inc.php CHANGED
@@ -19,14 +19,15 @@ if (!class_exists ("c_ws_plugin__s2member_login_redirects_r"))
19
  class c_ws_plugin__s2member_login_redirects_r
20
  {
21
  /*
22
- This function removes login_redirect Filters to prevent conflicts with s2Member.
23
  Attach to: add_action("init");
24
  */
25
  public static function remove_login_redirect_filters () /* For compatibility. */
26
  {
27
  do_action ("ws_plugin__s2member_before_remove_login_redirect_filters", get_defined_vars ());
28
  /**/
29
- remove_all_filters ("login_redirect"); /* Removes ALL `login_redirect` Filters. */
 
30
  /**/
31
  do_action ("ws_plugin__s2member_after_remove_login_redirect_filters", get_defined_vars ());
32
  }
19
  class c_ws_plugin__s2member_login_redirects_r
20
  {
21
  /*
22
+ Removes login_redirect Filters to prevent conflicts with s2Member.
23
  Attach to: add_action("init");
24
  */
25
  public static function remove_login_redirect_filters () /* For compatibility. */
26
  {
27
  do_action ("ws_plugin__s2member_before_remove_login_redirect_filters", get_defined_vars ());
28
  /**/
29
+ if (!apply_filters ("ws_plugin__s2member_allow_other_login_redirect_filters", false, get_defined_vars ()))
30
+ remove_all_filters ("login_redirect"); /* Removes ALL `login_redirect` Filters. */
31
  /**/
32
  do_action ("ws_plugin__s2member_after_remove_login_redirect_filters", get_defined_vars ());
33
  }
includes/classes/login-redirects.inc.php CHANGED
@@ -19,7 +19,7 @@ if (!class_exists ("c_ws_plugin__s2member_login_redirects"))
19
  class c_ws_plugin__s2member_login_redirects
20
  {
21
  /*
22
- Function for handling login redirections.
23
  Attach to: add_action("wp_login");
24
  */
25
  public static function login_redirect ($username = FALSE)
@@ -85,7 +85,7 @@ if (!class_exists ("c_ws_plugin__s2member_login_redirects"))
85
  do_action ("ws_plugin__s2member_before_login_redirection_uri", get_defined_vars ());
86
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
87
  /**/
88
- if ($url = c_ws_plugin__s2member_login_redirects::login_redirection_url ($user))
89
  {
90
  $path = parse_url ($url, PHP_URL_PATH);
91
  $query = parse_url ($url, PHP_URL_QUERY);
@@ -95,7 +95,7 @@ if (!class_exists ("c_ws_plugin__s2member_login_redirects"))
95
  return apply_filters ("ws_plugin__s2member_login_redirection_uri", $uri, get_defined_vars ());
96
  }
97
  /*
98
- Function that fills replacement code variables in special redirection URLs.
99
  */
100
  public static function fill_login_redirect_rc_vars ($url = FALSE, $user = FALSE)
101
  {
@@ -103,9 +103,9 @@ if (!class_exists ("c_ws_plugin__s2member_login_redirects"))
103
  do_action ("ws_plugin__s2member_before_fill_login_redirect_rc_vars", get_defined_vars ());
104
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
105
  /**/
106
- $user = (is_object ($user)) ? $user : wp_get_current_user ();
107
- $user_login = (is_object ($user)) ? strtolower ($user->user_login) : "";
108
- $user_id = (is_object ($user)) ? (string)$user->ID : "";
109
  $user_level = (string)c_ws_plugin__s2member_user_access::user_access_level ($user);
110
  $user_role = (string)c_ws_plugin__s2member_user_access::user_access_role ($user);
111
  $user_ccaps = implode ("-", c_ws_plugin__s2member_user_access::user_access_ccaps ($user));
19
  class c_ws_plugin__s2member_login_redirects
20
  {
21
  /*
22
+ Handles login redirections.
23
  Attach to: add_action("wp_login");
24
  */
25
  public static function login_redirect ($username = FALSE)
85
  do_action ("ws_plugin__s2member_before_login_redirection_uri", get_defined_vars ());
86
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
87
  /**/
88
+ if (! ($uri = false) && $url = c_ws_plugin__s2member_login_redirects::login_redirection_url ($user))
89
  {
90
  $path = parse_url ($url, PHP_URL_PATH);
91
  $query = parse_url ($url, PHP_URL_QUERY);
95
  return apply_filters ("ws_plugin__s2member_login_redirection_uri", $uri, get_defined_vars ());
96
  }
97
  /*
98
+ Fills Replacement Code variables in Special Redirection URLs.
99
  */
100
  public static function fill_login_redirect_rc_vars ($url = FALSE, $user = FALSE)
101
  {
103
  do_action ("ws_plugin__s2member_before_fill_login_redirect_rc_vars", get_defined_vars ());
104
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
105
  /**/
106
+ $user = (is_object ($user) && $user->ID) ? $user : wp_get_current_user ();
107
+ $user_login = (is_object ($user) && $user->ID) ? strtolower ($user->user_login) : "";
108
+ $user_id = (is_object ($user) && $user->ID) ? (string)$user->ID : "";
109
  $user_level = (string)c_ws_plugin__s2member_user_access::user_access_level ($user);
110
  $user_role = (string)c_ws_plugin__s2member_user_access::user_access_role ($user);
111
  $user_ccaps = implode ("-", c_ws_plugin__s2member_user_access::user_access_ccaps ($user));
includes/classes/menu-pages.inc.php CHANGED
@@ -107,7 +107,8 @@ if (!class_exists ("c_ws_plugin__s2member_menu_pages"))
107
  if (apply_filters ("ws_plugin__s2member_during_add_admin_options_create_menu_items", true, get_defined_vars ()))
108
  {
109
  if (is_multisite () && c_ws_plugin__s2member_utils_conds::is_multisite_farm () && !is_main_site ())
110
- $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["menu_pages"] = array (); /* Clear right side. */
 
111
  /**/
112
  if (is_multisite () && is_main_site ()) /* Re-organize menu whenever Multisite Networking is enabled; and we're on the Main Site. */
113
  {
@@ -467,16 +468,16 @@ if (!class_exists ("c_ws_plugin__s2member_menu_pages"))
467
  /**/
468
  if (($nonce = $_POST["ws_plugin__s2member_bridge_bbpress"]) && wp_verify_nonce ($nonce, "ws-plugin--s2member-bridge-bbpress"))
469
  {
470
- $post = c_ws_plugin__s2member_utils_strings::trim_deep (stripslashes_deep ($_POST)); /* Trim/strip all _POST vars. */
471
  /**/
472
- if (($plugins_dir = rtrim ($post["ws_plugin__s2member_bridge_bbpress_plugins_dir"], "/")) && is_dir ($plugins_dir))
473
  {
474
  if (is_writable ($plugins_dir)) /* This directory MUST be writable. Otherwise, we cannot continue. */
475
  {
476
- if (preg_match ("/^Install/i", $post["ws_plugin__s2member_bridge_bbpress_action"]))
477
  {
478
- $min = (string)$post["ws_plugin__s2member_bridge_bbpress_min_level"];
479
- $ovg = (string)$post["ws_plugin__s2member_bridge_bbpress_ovg"];
480
  /**/
481
  if (($file = file_get_contents (dirname (dirname (__FILE__)) . "/dropins/bridges/_s2member-bbpress-bridge.php")) && ($file = preg_replace ("/%%min%%/i", c_ws_plugin__s2member_utils_strings::esc_dq ($min), preg_replace ("/%%ovg%%/i", c_ws_plugin__s2member_utils_strings::esc_dq ($ovg), $file))) && file_put_contents ($plugins_dir . "/_s2member-bbpress-bridge.php", $file))
482
  c_ws_plugin__s2member_admin_notices::display_admin_notice ("The bbPress® Bridge/plugin has been <strong>installed successfully</strong>.");
@@ -485,7 +486,7 @@ if (!class_exists ("c_ws_plugin__s2member_menu_pages"))
485
  c_ws_plugin__s2member_admin_notices::display_admin_notice ("Unknown error. Please try again, or install manually.", true);
486
  }
487
  /**/
488
- else if (preg_match ("/^Un-Install/i", $post["ws_plugin__s2member_bridge_bbpress_action"]))
489
  {
490
  if (file_exists ($plugins_dir . "/_s2member-bbpress-bridge.php"))
491
  {
107
  if (apply_filters ("ws_plugin__s2member_during_add_admin_options_create_menu_items", true, get_defined_vars ()))
108
  {
109
  if (is_multisite () && c_ws_plugin__s2member_utils_conds::is_multisite_farm () && !is_main_site ())
110
+ foreach ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["menu_pages"] as &$right_side)
111
+ $right_side = false; /* Clear right side. */
112
  /**/
113
  if (is_multisite () && is_main_site ()) /* Re-organize menu whenever Multisite Networking is enabled; and we're on the Main Site. */
114
  {
468
  /**/
469
  if (($nonce = $_POST["ws_plugin__s2member_bridge_bbpress"]) && wp_verify_nonce ($nonce, "ws-plugin--s2member-bridge-bbpress"))
470
  {
471
+ $_p = c_ws_plugin__s2member_utils_strings::trim_deep (stripslashes_deep ($_POST)); /* Trim/strip all _POST vars. */
472
  /**/
473
+ if (($plugins_dir = untrailingslashit ($_p["ws_plugin__s2member_bridge_bbpress_plugins_dir"])) && is_dir ($plugins_dir))
474
  {
475
  if (is_writable ($plugins_dir)) /* This directory MUST be writable. Otherwise, we cannot continue. */
476
  {
477
+ if (preg_match ("/^Install/i",$_p["ws_plugin__s2member_bridge_bbpress_action"]))
478
  {
479
+ $min = (string)$_p["ws_plugin__s2member_bridge_bbpress_min_level"];
480
+ $ovg = (string)$_p["ws_plugin__s2member_bridge_bbpress_ovg"];
481
  /**/
482
  if (($file = file_get_contents (dirname (dirname (__FILE__)) . "/dropins/bridges/_s2member-bbpress-bridge.php")) && ($file = preg_replace ("/%%min%%/i", c_ws_plugin__s2member_utils_strings::esc_dq ($min), preg_replace ("/%%ovg%%/i", c_ws_plugin__s2member_utils_strings::esc_dq ($ovg), $file))) && file_put_contents ($plugins_dir . "/_s2member-bbpress-bridge.php", $file))
483
  c_ws_plugin__s2member_admin_notices::display_admin_notice ("The bbPress® Bridge/plugin has been <strong>installed successfully</strong>.");
486
  c_ws_plugin__s2member_admin_notices::display_admin_notice ("Unknown error. Please try again, or install manually.", true);
487
  }
488
  /**/
489
+ else if (preg_match ("/^Un-Install/i",$_p["ws_plugin__s2member_bridge_bbpress_action"]))
490
  {
491
  if (file_exists ($plugins_dir . "/_s2member-bbpress-bridge.php"))
492
  {
includes/classes/meta-box-saves.inc.php CHANGED
@@ -39,7 +39,7 @@ if (!class_exists ("c_ws_plugin__s2member_meta_box_saves"))
39
  {
40
  if ($_p["post_type"] === "page" && ($page_id = $post_id)) /* OK. So we're dealing with a Page classification. */
41
  {
42
- if (isset ($_p["ws_plugin__s2member_security_meta_box_level"])) /* Just needs to be set. It CAN be empty. */
43
  {
44
  $pages["0"] = array_unique (preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level0_pages"]));
45
  $pages["1"] = array_unique (preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_pages"]));
@@ -47,7 +47,7 @@ if (!class_exists ("c_ws_plugin__s2member_meta_box_saves"))
47
  $pages["3"] = array_unique (preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_pages"]));
48
  $pages["4"] = array_unique (preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_pages"]));
49
  /**/
50
- if (($i = array_search ($page_id, $pages["0"])) !== false) /* Remove $page_id from existing options. */
51
  unset ($pages["0"][$i]);
52
  else if (($i = array_search ($page_id, $pages["1"])) !== false)
53
  unset ($pages["1"][$i]);
@@ -59,7 +59,7 @@ if (!class_exists ("c_ws_plugin__s2member_meta_box_saves"))
59
  unset ($pages["4"][$i]);
60
  /**/
61
  if (strlen ($_p["ws_plugin__s2member_security_meta_box_level"]) && is_array ($pages[$_p["ws_plugin__s2member_security_meta_box_level"]]))
62
- if (!$pages[$_p["ws_plugin__s2member_security_meta_box_level"]] !== array ("all"))
63
  array_push ($pages[$_p["ws_plugin__s2member_security_meta_box_level"]], $page_id);
64
  /**/
65
  $new_options = array_merge ((array)$new_options, array ("ws_plugin__s2member_level0_pages" => implode (",", $pages["0"]), "ws_plugin__s2member_level1_pages" => implode (",", $pages["1"]), "ws_plugin__s2member_level2_pages" => implode (",", $pages["2"]), "ws_plugin__s2member_level3_pages" => implode (",", $pages["3"]), "ws_plugin__s2member_level4_pages" => implode (",", $pages["4"])));
@@ -74,7 +74,7 @@ if (!class_exists ("c_ws_plugin__s2member_meta_box_saves"))
74
  /**/
75
  else /* Otherwise, we assume this is a Post, or possibly a Custom Post Type. It's NOT a Page. */
76
  {
77
- if (isset ($_p["ws_plugin__s2member_security_meta_box_level"])) /* Just needs to be set. It CAN be empty. */
78
  {
79
  $posts["0"] = array_unique (preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level0_posts"]));
80
  $posts["1"] = array_unique (preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_posts"]));
@@ -82,7 +82,7 @@ if (!class_exists ("c_ws_plugin__s2member_meta_box_saves"))
82
  $posts["3"] = array_unique (preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_posts"]));
83
  $posts["4"] = array_unique (preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_posts"]));
84
  /**/
85
- if (($i = array_search ($post_id, $posts["0"])) !== false) /* Remove $post_id from existing options. */
86
  unset ($posts["0"][$i]);
87
  else if (($i = array_search ($post_id, $posts["1"])) !== false)
88
  unset ($posts["1"][$i]);
@@ -94,7 +94,7 @@ if (!class_exists ("c_ws_plugin__s2member_meta_box_saves"))
94
  unset ($posts["4"][$i]);
95
  /**/
96
  if (strlen ($_p["ws_plugin__s2member_security_meta_box_level"]) && is_array ($posts[$_p["ws_plugin__s2member_security_meta_box_level"]]))
97
- if (!$posts[$_p["ws_plugin__s2member_security_meta_box_level"]] !== array ("all"))
98
  array_push ($posts[$_p["ws_plugin__s2member_security_meta_box_level"]], $post_id);
99
  /**/
100
  $new_options = array_merge ((array)$new_options, array ("ws_plugin__s2member_level0_posts" => implode (",", $posts["0"]), "ws_plugin__s2member_level1_posts" => implode (",", $posts["1"]), "ws_plugin__s2member_level2_posts" => implode (",", $posts["2"]), "ws_plugin__s2member_level3_posts" => implode (",", $posts["3"]), "ws_plugin__s2member_level4_posts" => implode (",", $posts["4"])));
@@ -109,7 +109,7 @@ if (!class_exists ("c_ws_plugin__s2member_meta_box_saves"))
109
  /**/
110
  if ($_p["post_type"] === "page" && ($page_id = $post_id)) /* OK. So we're dealing with a Page classification. */
111
  {
112
- if (isset ($_p["ws_plugin__s2member_security_meta_box_ccaps"])) /* Just needs to be set. It CAN be empty. */
113
  {
114
  $ccaps_req = trim (strtolower ($_p["ws_plugin__s2member_security_meta_box_ccaps"]), ",");
115
  $ccaps_req = trim (preg_replace ("/[^a-z_0-9,]/", "", $ccaps_req), ","); /* Now clean up. */
39
  {
40
  if ($_p["post_type"] === "page" && ($page_id = $post_id)) /* OK. So we're dealing with a Page classification. */
41
  {
42
+ if (isset ($_p["ws_plugin__s2member_security_meta_box_level"])) /* Just needs to be set. CAN be empty. */
43
  {
44
  $pages["0"] = array_unique (preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level0_pages"]));
45
  $pages["1"] = array_unique (preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_pages"]));
47
  $pages["3"] = array_unique (preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_pages"]));
48
  $pages["4"] = array_unique (preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_pages"]));
49
  /**/
50
+ if (($i = array_search ($page_id, $pages["0"])) !== false) /* Remove $page_id. */
51
  unset ($pages["0"][$i]);
52
  else if (($i = array_search ($page_id, $pages["1"])) !== false)
53
  unset ($pages["1"][$i]);
59
  unset ($pages["4"][$i]);
60
  /**/
61
  if (strlen ($_p["ws_plugin__s2member_security_meta_box_level"]) && is_array ($pages[$_p["ws_plugin__s2member_security_meta_box_level"]]))
62
+ if ($pages[$_p["ws_plugin__s2member_security_meta_box_level"]] !== array ("all"))
63
  array_push ($pages[$_p["ws_plugin__s2member_security_meta_box_level"]], $page_id);
64
  /**/
65
  $new_options = array_merge ((array)$new_options, array ("ws_plugin__s2member_level0_pages" => implode (",", $pages["0"]), "ws_plugin__s2member_level1_pages" => implode (",", $pages["1"]), "ws_plugin__s2member_level2_pages" => implode (",", $pages["2"]), "ws_plugin__s2member_level3_pages" => implode (",", $pages["3"]), "ws_plugin__s2member_level4_pages" => implode (",", $pages["4"])));
74
  /**/
75
  else /* Otherwise, we assume this is a Post, or possibly a Custom Post Type. It's NOT a Page. */
76
  {
77
+ if (isset ($_p["ws_plugin__s2member_security_meta_box_level"])) /* Just needs to be set. CAN be empty. */
78
  {
79
  $posts["0"] = array_unique (preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level0_posts"]));
80
  $posts["1"] = array_unique (preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_posts"]));
82
  $posts["3"] = array_unique (preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_posts"]));
83
  $posts["4"] = array_unique (preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_posts"]));
84
  /**/
85
+ if (($i = array_search ($post_id, $posts["0"])) !== false) /* Remove $post_id. */
86
  unset ($posts["0"][$i]);
87
  else if (($i = array_search ($post_id, $posts["1"])) !== false)
88
  unset ($posts["1"][$i]);
94
  unset ($posts["4"][$i]);
95
  /**/
96
  if (strlen ($_p["ws_plugin__s2member_security_meta_box_level"]) && is_array ($posts[$_p["ws_plugin__s2member_security_meta_box_level"]]))
97
+ if ($posts[$_p["ws_plugin__s2member_security_meta_box_level"]] !== array ("all"))
98
  array_push ($posts[$_p["ws_plugin__s2member_security_meta_box_level"]], $post_id);
99
  /**/
100
  $new_options = array_merge ((array)$new_options, array ("ws_plugin__s2member_level0_posts" => implode (",", $posts["0"]), "ws_plugin__s2member_level1_posts" => implode (",", $posts["1"]), "ws_plugin__s2member_level2_posts" => implode (",", $posts["2"]), "ws_plugin__s2member_level3_posts" => implode (",", $posts["3"]), "ws_plugin__s2member_level4_posts" => implode (",", $posts["4"])));
109
  /**/
110
  if ($_p["post_type"] === "page" && ($page_id = $post_id)) /* OK. So we're dealing with a Page classification. */
111
  {
112
+ if (isset ($_p["ws_plugin__s2member_security_meta_box_ccaps"])) /* Just needs to be set. CAN be empty. */
113
  {
114
  $ccaps_req = trim (strtolower ($_p["ws_plugin__s2member_security_meta_box_ccaps"]), ",");
115
  $ccaps_req = trim (preg_replace ("/[^a-z_0-9,]/", "", $ccaps_req), ","); /* Now clean up. */
includes/classes/mms-patches.inc.php CHANGED
@@ -121,7 +121,7 @@ if (!class_exists ("c_ws_plugin__s2member_mms_patches"))
121
  /**/
122
  do_action ("ws_plugin__s2member_after_mms_patches", get_defined_vars ());
123
  /**/
124
- return $ran_mms_patches; /* Return status update. */
125
  }
126
  }
127
  }
121
  /**/
122
  do_action ("ws_plugin__s2member_after_mms_patches", get_defined_vars ());
123
  /**/
124
+ return$ran_mms_patches; /* Return status update. */
125
  }
126
  }
127
  }
includes/classes/option-forces.inc.php CHANGED
@@ -146,14 +146,14 @@ if (!class_exists ("c_ws_plugin__s2member_option_forces"))
146
  }
147
  }
148
  /* --------------------> $users_can_register !== "all", so exclude Level #0. */
149
- else if (is_user_logged_in () && current_user_can ("access_s2member_level1") && is_object ($current_user = wp_get_current_user ()))
150
  {
151
  $blogs_allowed = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["mms_registration_blogs_level" . c_ws_plugin__s2member_user_access::user_access_level ()];
152
- $current_user_blogs = (is_array ($blogs = get_blogs_of_user ($current_user->ID))) ? count ($blogs) - 1 : 0;
153
- $current_user_blogs = ($current_user_blogs >= 0) ? $current_user_blogs : 0;
154
  $blogs_allowed = ($blogs_allowed >= 0) ? $blogs_allowed : 0;
155
  /**/
156
- if ($current_user_blogs < $blogs_allowed) /* Are they within their limit? */
157
  {
158
  return apply_filters ("ws_plugin__s2member_check_mms_register_access", ($users_can_register = "all"), get_defined_vars ());
159
  }
@@ -162,14 +162,14 @@ if (!class_exists ("c_ws_plugin__s2member_option_forces"))
162
  /**/
163
  else if (!is_admin () && $users_can_register === "all") /* Do NOT run these security checks on option pages; it's confusing to a site owner. */
164
  {
165
- if (is_user_logged_in () && is_object ($current_user = wp_get_current_user ()))
166
  {
167
  $blogs_allowed = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["mms_registration_blogs_level" . c_ws_plugin__s2member_user_access::user_access_level ()];
168
- $current_user_blogs = (is_array ($blogs = get_blogs_of_user ($current_user->ID))) ? count ($blogs) - 1 : 0;
169
- $current_user_blogs = ($current_user_blogs >= 0) ? $current_user_blogs : 0;
170
  $blogs_allowed = ($blogs_allowed >= 0) ? $blogs_allowed : 0;
171
  /**/
172
- if ($current_user_blogs >= $blogs_allowed) /* Are they at their limit? */
173
  {
174
  return apply_filters ("ws_plugin__s2member_check_mms_register_access", ($users_can_register = "none"), get_defined_vars ());
175
  }
146
  }
147
  }
148
  /* --------------------> $users_can_register !== "all", so exclude Level #0. */
149
+ else if (is_user_logged_in () && current_user_can ("access_s2member_level1") && is_object ($user = wp_get_current_user ()) && $user->ID)
150
  {
151
  $blogs_allowed = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["mms_registration_blogs_level" . c_ws_plugin__s2member_user_access::user_access_level ()];
152
+ $user_blogs = (is_array ($blogs = get_blogs_of_user ($user->ID))) ? count ($blogs) - 1 : 0;
153
+ $user_blogs = ($user_blogs >= 0) ? $user_blogs : 0; /* NOT less than zero. */
154
  $blogs_allowed = ($blogs_allowed >= 0) ? $blogs_allowed : 0;
155
  /**/
156
+ if ($user_blogs < $blogs_allowed) /* Are they within their limit? */
157
  {
158
  return apply_filters ("ws_plugin__s2member_check_mms_register_access", ($users_can_register = "all"), get_defined_vars ());
159
  }
162
  /**/
163
  else if (!is_admin () && $users_can_register === "all") /* Do NOT run these security checks on option pages; it's confusing to a site owner. */
164
  {
165
+ if (is_user_logged_in () && is_object ($user = wp_get_current_user ()) && $user->ID)
166
  {
167
  $blogs_allowed = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["mms_registration_blogs_level" . c_ws_plugin__s2member_user_access::user_access_level ()];
168
+ $user_blogs = (is_array ($blogs = get_blogs_of_user ($user->ID))) ? count ($blogs) - 1 : 0;
169
+ $user_blogs = ($user_blogs >= 0) ? $user_blogs : 0; /* NOT less than zero. */
170
  $blogs_allowed = ($blogs_allowed >= 0) ? $blogs_allowed : 0;
171
  /**/
172
+ if ($user_blogs >= $blogs_allowed) /* Are they at their limit? */
173
  {
174
  return apply_filters ("ws_plugin__s2member_check_mms_register_access", ($users_can_register = "none"), get_defined_vars ());
175
  }
includes/classes/pages-sp.inc.php CHANGED
@@ -19,7 +19,7 @@ if (!class_exists ("c_ws_plugin__s2member_pages_sp"))
19
  class c_ws_plugin__s2member_pages_sp
20
  {
21
  /*
22
- Function checks Page Level Access permissions - for a specific Page.
23
 
24
  Don't call this function directly, use one of these API functions:
25
 
@@ -31,7 +31,7 @@ if (!class_exists ("c_ws_plugin__s2member_pages_sp"))
31
  - is_page_permitted_by_s2member($page_id);
32
  - is_permitted_by_s2member($page_id, "page");
33
 
34
- see: `/s2member/includes/functions/api-functions.inc.php`.
35
  */
36
  public static function check_specific_page_level_access ($page_id = FALSE, $check_user = TRUE)
37
  {
19
  class c_ws_plugin__s2member_pages_sp
20
  {
21
  /*
22
+ Checks Page Level Access permissions - for a specific Page.
23
 
24
  Don't call this function directly, use one of these API functions:
25
 
31
  - is_page_permitted_by_s2member($page_id);
32
  - is_permitted_by_s2member($page_id, "page");
33
 
34
+ See: `/s2member/includes/functions/api-functions.inc.php`.
35
  */
36
  public static function check_specific_page_level_access ($page_id = FALSE, $check_user = TRUE)
37
  {
includes/classes/pages.inc.php CHANGED
@@ -19,7 +19,7 @@ if (!class_exists ("c_ws_plugin__s2member_pages"))
19
  class c_ws_plugin__s2member_pages
20
  {
21
  /*
22
- Function for handling Page Level Access permissions.
23
 
24
  Don't call this function directly, use one of these API functions:
25
 
@@ -31,7 +31,7 @@ if (!class_exists ("c_ws_plugin__s2member_pages"))
31
  - is_page_permitted_by_s2member($page_id);
32
  - is_permitted_by_s2member($page_id, "page");
33
 
34
- see: `/s2member/includes/functions/api-functions.inc.php`.
35
  */
36
  public static function check_page_level_access ()
37
  {
19
  class c_ws_plugin__s2member_pages
20
  {
21
  /*
22
+ Handles Page Level Access permissions.
23
 
24
  Don't call this function directly, use one of these API functions:
25
 
31
  - is_page_permitted_by_s2member($page_id);
32
  - is_permitted_by_s2member($page_id, "page");
33
 
34
+ See: `/s2member/includes/functions/api-functions.inc.php`.
35
  */
36
  public static function check_page_level_access ()
37
  {
includes/classes/paypal-notify-in.inc.php CHANGED
@@ -40,7 +40,7 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in"))
40
  /**/
41
  if ($_GET["s2member_paypal_notify"] && ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_business"] || $_GET["s2member_paypal_proxy"]))
42
  {
43
- @ignore_user_abort (true); /* Important. Continue processing even if/when the connection is broken by the sending party. */
44
  /**/
45
  include_once ABSPATH . "wp-admin/includes/admin.php"; /* Get administrative functions. Needed for `wp_delete_user()`. */
46
  /**/
@@ -49,8 +49,7 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in"))
49
  if (is_array ($paypal = c_ws_plugin__s2member_paypal_utilities::paypal_postvars ()) && ($_paypal = $paypal))
50
  {
51
  $paypal["s2member_log"][] = "IPN received on: " . date ("D M j, Y g:i:s a T");
52
- $paypal["s2member_log"][] = "s2Member POST vars verified " . /* Indicate Proxy Key. */
53
- ( ($postvars["proxy_verified"]) ? "with a Proxy Key" : "through a POST back to PayPal®.");
54
  /**/
55
  $payment_status_issues = "/^(failed|denied|expired|refunded|partially_refunded|reversed|reversal|canceled_reversal|voided)$/i";
56
  /**/
@@ -78,8 +77,8 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in"))
78
  be necessary in a future release of s2Member. For now, it's just a fill-in.
79
  These Hooks/Filters will remain, so you can use them now; if you need to.
80
  */
81
- if (/**/(preg_match ("/^virtual_terminal$/i", $paypal["txn_type"]))/**/
82
- && (!preg_match ($payment_status_issues, $paypal["payment_status"]))/**/
83
  && ($paypal["txn_id"])/**/)
84
  {
85
  eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
@@ -106,8 +105,8 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in"))
106
  be necessary in a future release of s2Member. For now, it's just a fill-in.
107
  These Hooks/Filters will remain, so you can use them now; if you need to.
108
  */
109
- else if (/**/(preg_match ("/^express_checkout$/i", $paypal["txn_type"]))/**/
110
- && (!preg_match ($payment_status_issues, $paypal["payment_status"]))/**/
111
  && ($paypal["txn_id"])/**/)
112
  {
113
  eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
@@ -135,8 +134,8 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in"))
135
  be necessary in a future release of s2Member. For now, it's just a fill-in.
136
  These Hooks/Filters will remain, so you can use them now; if you need to.
137
  */
138
- else if (/**/(preg_match ("/^cart$/i", $paypal["txn_type"]))/**/
139
- && (!preg_match ($payment_status_issues, $paypal["payment_status"]))/**/
140
  && ($paypal["txn_id"])/**/)
141
  {
142
  eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
@@ -164,8 +163,8 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in"))
164
  be necessary in a future release of s2Member. For now, it's just a fill-in.
165
  These Hooks/Filters will remain, so you can use them now; if you need to.
166
  */
167
- else if (/**/(preg_match ("/^send_money$/i", $paypal["txn_type"]))/**/
168
- && (!preg_match ($payment_status_issues, $paypal["payment_status"]))/**/
169
  && ($paypal["txn_id"])/**/)
170
  {
171
  eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
@@ -189,9 +188,9 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in"))
189
  /*
190
  Specific Post/Page Access ~ Sales.
191
  */
192
- else if (/**/(preg_match ("/^web_accept$/i", $paypal["txn_type"]))/**/
193
- && (preg_match ("/^sp\:[0-9,]+\:[0-9]+$/", $paypal["item_number"]))/**/
194
- && (!preg_match ($payment_status_issues, $paypal["payment_status"]))/**/
195
  && ($paypal["payer_email"] && $paypal["txn_id"])/**/)
196
  {
197
  eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
@@ -206,13 +205,13 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in"))
206
  {
207
  $processing = $during = true; /* Yes, we ARE processing this. */
208
  /**/
209
- $sbj = preg_replace ("/%%sp_access_url%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($sp_access_url), $GLOBALS["WS_PLUGIN__"]["s2member"]["o"][ ( ($_GET["s2member_paypal_proxy"] && preg_match ("/pro-emails/", $_GET["s2member_paypal_proxy_use"])) ? "pro_" : "") . "sp_email_subject"]);
210
  $sbj = preg_replace ("/%%sp_access_exp%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (c_ws_plugin__s2member_utils_time::approx_time_difference (time (), strtotime ("+" . $paypal["hours"] . " hours"))), $sbj);
211
  /**/
212
- $msg = preg_replace ("/%%sp_access_url%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($sp_access_url), $GLOBALS["WS_PLUGIN__"]["s2member"]["o"][ ( ($_GET["s2member_paypal_proxy"] && preg_match ("/pro-emails/", $_GET["s2member_paypal_proxy_use"])) ? "pro_" : "") . "sp_email_message"]);
213
  $msg = preg_replace ("/%%sp_access_exp%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (c_ws_plugin__s2member_utils_time::approx_time_difference (time (), strtotime ("+" . $paypal["hours"] . " hours"))), $msg);
214
  /**/
215
- $rec = preg_replace ("/%%sp_access_url%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($sp_access_url), $GLOBALS["WS_PLUGIN__"]["s2member"]["o"][ ( ($_GET["s2member_paypal_proxy"] && preg_match ("/pro-emails/", $_GET["s2member_paypal_proxy_use"])) ? "pro_" : "") . "sp_email_recipients"]);
216
  $rec = preg_replace ("/%%sp_access_exp%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (c_ws_plugin__s2member_utils_time::approx_time_difference (time (), strtotime ("+" . $paypal["hours"] . " hours"))), $rec);
217
  /**/
218
  if (($rec = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim($cv[$1])', $rec)) && ($rec = preg_replace ("/%%txn_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["txn_id"]), $rec)))
@@ -351,10 +350,10 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in"))
351
  Possibly containing advanced update vars
352
  ( option_name1, option_selection1 ); which allow account modifications.
353
  */
354
- else if (/**/(preg_match ("/^(web_accept|subscr_signup)$/i", $paypal["txn_type"]))/**/
355
- && (preg_match ("/^[1-4](\:|$)([\+a-z_0-9,]+)?(\:)?([0-9]+ [A-Z])?$/", $paypal["item_number"]))/**/
356
  && ($paypal["subscr_id"] || ($paypal["subscr_id"] = $paypal["txn_id"]))/**/
357
- && (!preg_match ($payment_status_issues, $paypal["payment_status"]))/**/
358
  && ($paypal["payer_email"])/**/)
359
  {
360
  eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
@@ -365,7 +364,7 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in"))
365
  /**/
366
  list ($paypal["level"], $paypal["ccaps"], $paypal["eotper"]) = preg_split ("/\:/", $paypal["item_number"], 3);
367
  /**/
368
- $paypal["period1"] = (preg_match ("/^[1-9]/", $paypal["period1"])) ? $paypal["period1"] : "0 D"; /* Defaults to "0 D" ( zero days ). */
369
  $paypal["mc_amount1"] = (strlen ($paypal["mc_amount1"]) && $paypal["mc_amount1"] > 0) ? $paypal["mc_amount1"] : "0.00"; /* "0.00". */
370
  /**/
371
  if (preg_match ("/^web_accept$/i", $paypal["txn_type"])) /* Conversions for Lifetime & Fixed-Term sales. */
@@ -384,7 +383,7 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in"))
384
  /*
385
  New Subscription with advanced update vars ( option_name1, option_selection1 )? These variables are used in Subscr. Modifications.
386
  */
387
- if (preg_match ("/(updat|upgrad)/i", $paypal["option_name1"]) && $paypal["option_selection1"]) /* This is an advanced way to handle Subscription update modifications. */
388
  /* This advanced method is required whenever a Subscription that is already completed, or was never setup to recur in the first place needs to be modified. PayPal® will not allow the
389
  modify=1|2 parameter to be used in those scenarios, because technically there is nothing to update. The only thing that actually needs to be updated is the account. */
390
  {
@@ -484,9 +483,9 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in"))
484
  {
485
  $processing = $during = true; /* Yes, we ARE processing this. */
486
  /**/
487
- $sbj = preg_replace ("/%%registration_url%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($registration_url), $GLOBALS["WS_PLUGIN__"]["s2member"]["o"][ ( ($_GET["s2member_paypal_proxy"] && preg_match ("/pro-emails/", $_GET["s2member_paypal_proxy_use"])) ? "pro_" : "") . "signup_email_subject"]);
488
- $msg = preg_replace ("/%%registration_url%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($registration_url), $GLOBALS["WS_PLUGIN__"]["s2member"]["o"][ ( ($_GET["s2member_paypal_proxy"] && preg_match ("/pro-emails/", $_GET["s2member_paypal_proxy_use"])) ? "pro_" : "") . "signup_email_message"]);
489
- $rec = preg_replace ("/%%registration_url%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($registration_url), $GLOBALS["WS_PLUGIN__"]["s2member"]["o"][ ( ($_GET["s2member_paypal_proxy"] && preg_match ("/pro-emails/", $_GET["s2member_paypal_proxy_use"])) ? "pro_" : "") . "signup_email_recipients"]);
490
  /**/
491
  if (($rec = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim($cv[$1])', $rec)) && ($rec = preg_replace ("/%%subscr_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["subscr_id"]), $rec)))
492
  if (($rec = preg_replace ("/%%initial%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["initial"]), $rec)) && ($rec = preg_replace ("/%%regular%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["regular"]), $rec)))
@@ -618,7 +617,7 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in"))
618
  /**/
619
  if ($processing && $_GET["s2member_paypal_proxy"] && ($url = $_GET["s2member_paypal_proxy_return_url"]) && is_array ($cv = preg_split ("/\|/", $paypal["custom"]))) /* A Proxy is requesting a Return URL? */
620
  {
621
- if (($user_id && is_object ($user) && $user->ID) || ( ($user_id = c_ws_plugin__s2member_utils_users::get_user_id_with ($paypal["subscr_id"], $paypal["option_selection1"])) && is_object ($user = new WP_User ($user_id)) && $user->ID))
622
  {
623
  $fields = get_user_option ("s2member_custom_fields", $user_id); /* These will be needed below. */
624
  /**/
@@ -653,8 +652,8 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in"))
653
  }
654
  /**/
655
  if ($processing /* Process a payment now? Special cases for web_accept and/or Proxy requests with `subscr-signup-as-subscr-payment`. */
656
- && (preg_match ("/^web_accept$/i", $paypal["txn_type"]) || ($_GET["s2member_paypal_proxy"] && preg_match ("/subscr-signup-as-subscr-payment/", $_GET["s2member_paypal_proxy_use"]) && $paypal["txn_id"] && $paypal["mc_gross"] > 0))/**/
657
- && ( ($user_id && is_object ($user) && $user->ID) || ( ($user_id = c_ws_plugin__s2member_utils_users::get_user_id_with ($paypal["subscr_id"], $paypal["option_selection1"])) && is_object ($user = new WP_User ($user_id)) && $user->ID)))
658
  {
659
  $paypal["s2member_log"][] = "User exists. Handling `payment` for Subscription via (" . ( (preg_match ("/^web_accept$/i", $paypal["txn_type"])) ? "web_accept" : "subscr-signup-as-subscr-payment") . ").";
660
  /**/
@@ -762,7 +761,7 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in"))
762
  }
763
  }
764
  else if ($processing /* Process a payment now? Special cases for web_accept and/or Proxy requests with `subscr-signup-as-subscr-payment`. */
765
- && (preg_match ("/^web_accept$/i", $paypal["txn_type"]) || ($_GET["s2member_paypal_proxy"] && preg_match ("/subscr-signup-as-subscr-payment/", $_GET["s2member_paypal_proxy_use"]) && $paypal["txn_id"] && $paypal["mc_gross"] > 0)))
766
  {
767
  $paypal["s2member_log"][] = "Storing `payment` for Subscription via (" . ( (preg_match ("/^web_accept$/i", $paypal["txn_type"])) ? "web_accept" : "subscr-signup-as-subscr-payment") . ").";
768
  /**/
@@ -778,7 +777,7 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in"))
778
  }
779
  /**/
780
  if ($processing /* Store signup vars now? If the User already exists in the database, we can go ahead and store these right now. */
781
- && ( ($user_id && is_object ($user) && $user->ID) || ( ($user_id = c_ws_plugin__s2member_utils_users::get_user_id_with ($paypal["subscr_id"], $paypal["option_selection1"])) && is_object ($user = new WP_User ($user_id)) && $user->ID)))
782
  {
783
  $paypal["s2member_log"][] = "Storing IPN signup vars now. These are associated with a User's account record; for future reference.";
784
  /**/
@@ -801,7 +800,7 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in"))
801
  be necessary in a future release of s2Member. For now, it's just a fill-in.
802
  These Hooks/Filters will remain, so you can use them now; if you need to.
803
  */
804
- else if (/**/(preg_match ("/^recurring_payment_profile_created$/i", $paypal["txn_type"]))/**/
805
  && ($paypal["item_number"] || ($paypal["item_number"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_item_number ($paypal)))/**/
806
  && (preg_match ("/^[1-4](\:|$)([\+a-z_0-9,]+)?(\:)?([0-9]+ [A-Z])?$/", $paypal["item_number"])) /* This must match a Subscription. */
807
  && ($paypal["subscr_id"] || ($paypal["subscr_id"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_subscr_id ($paypal)))/**/
@@ -830,8 +829,8 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in"))
830
  /*
831
  Subscription modifications.
832
  */
833
- else if (/**/(preg_match ("/^subscr_modify$/i", $paypal["txn_type"]))/**/
834
- && (preg_match ("/^[1-4](\:|$)([\+a-z_0-9,]+)?(\:)?([0-9]+ [A-Z])?$/", $paypal["item_number"]))/**/
835
  && ($paypal["subscr_id"] && $paypal["payer_email"])/**/)
836
  {
837
  eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
@@ -842,7 +841,7 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in"))
842
  /**/
843
  list ($paypal["level"], $paypal["ccaps"]) = preg_split ("/\:/", $paypal["item_number"], 2);
844
  /**/
845
- $paypal["period1"] = (preg_match ("/^[1-9]/", $paypal["period1"])) ? $paypal["period1"] : "0 D"; /* Defaults to "0 D" ( zero days ). */
846
  $paypal["mc_amount1"] = (strlen ($paypal["mc_amount1"]) && $paypal["mc_amount1"] > 0) ? $paypal["mc_amount1"] : "0.00"; /* "0.00". */
847
  /**/
848
  $paypal["initial_term"] = (preg_match ("/^[1-9]/", $paypal["period1"])) ? $paypal["period1"] : "0 D"; /* Defaults to "0 D" ( zero days ). */
@@ -928,11 +927,11 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in"))
928
  Subscription payment notifications.
929
  We need these to update: `s2member_last_payment_time`.
930
  */
931
- else if (/**/(preg_match ("/^(subscr_payment|recurring_payment)$/i", $paypal["txn_type"]))/**/
932
  && ($paypal["item_number"] || ($paypal["item_number"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_item_number ($paypal)))/**/
933
  && (preg_match ("/^[1-4](\:|$)([\+a-z_0-9,]+)?(\:)?([0-9]+ [A-Z])?$/", $paypal["item_number"])) /* This must match a Subscription. */
934
  && ($paypal["subscr_id"] || ($paypal["subscr_id"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_subscr_id ($paypal)))/**/
935
- && (!preg_match ($payment_status_issues, $paypal["payment_status"])) /* Status OK? This goes thru a list of known status issues. */
936
  && ($paypal["item_name"] || ($paypal["item_name"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_item_name ($paypal)))/**/
937
  && ($paypal["payer_email"] || ($paypal["payer_email"] = c_ws_plugin__s2member_utils_users::get_user_email_with ($paypal["subscr_id"])))/**/
938
  && ($paypal["txn_id"] && $paypal["mc_gross"])/**/)
@@ -944,7 +943,7 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in"))
944
  $paypal["s2member_log"][] = "s2Member txn_type identified as subscr_payment|recurring_payment.";
945
  $paypal["s2member_log"][] = "Sleeping for 2 seconds. Waiting for a possible subscr_signup|subscr_modify|recurring_payment_profile_created.";
946
  sleep (2); /* Sleep here for a moment. PayPal® sometimes sends a subscr_payment before the subscr_signup, subscr_modify.
947
- It is NOT a big deal if they do. However, s2Member goes to sleep here, just to help keep the log files in a logical order. */
948
  $paypal["s2member_log"][] = "Awake. It's " . date ("D M j, Y g:i:s a T") . ". s2Member txn_type identified as subscr_payment|recurring_payment.";
949
  /**/
950
  list ($paypal["level"], $paypal["ccaps"]) = preg_split ("/\:/", $paypal["item_number"], 2);
@@ -1087,7 +1086,7 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in"))
1087
  be necessary in a future release of s2Member. For now, it's just a fill-in.
1088
  These Hooks/Filters will remain, so you can use them now; if you need to.
1089
  */
1090
- else if (/**/(preg_match ("/^(subscr_failed|recurring_payment_failed|recurring_payment_skipped)$/i", $paypal["txn_type"]))/**/
1091
  && ($paypal["item_number"] || ($paypal["item_number"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_item_number ($paypal)))/**/
1092
  && (preg_match ("/^[1-4](\:|$)([\+a-z_0-9,]+)?(\:)?([0-9]+ [A-Z])?$/", $paypal["item_number"])) /* Must match a Subscription. */
1093
  && ($paypal["subscr_id"] || ($paypal["subscr_id"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_subscr_id ($paypal)))/**/
@@ -1120,11 +1119,11 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in"))
1120
  This works in conjunction with `s2member_last_payment_time`, and the s2Member Auto-EOT System.
1121
  For further details, see: https://www.x.com/thread/41155?start=15&tstart=0
1122
  */
1123
- else if (/**/(preg_match ("/^(subscr_cancel|recurring_payment_profile_cancel)$/i", $paypal["txn_type"]))/**/
1124
- && ! (preg_match ("/^recurring_payment_profile_cancel$/i", $paypal["txn_type"]) && preg_match ("/^failed$/i", $paypal["initial_payment_status"]))
1125
- /* ^^ Bypass this case ( for now ) "recurring_payment_profile_cancel" with an initial failed payment warrants an Immediate EOT instead. */
1126
- && ($paypal["item_number"] || ($paypal["item_number"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_item_number ($paypal))) /* Got the item_number? */
1127
- && (preg_match ("/^[1-4](\:|$)([\+a-z_0-9,]+)?(\:)?([0-9]+ [A-Z])?$/", $paypal["item_number"])) /* This item_number must validate. */
1128
  && ($paypal["period1"] || ($paypal["period1"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_period1 ($paypal)) || ($paypal["period1"] = "0 D"))/**/
1129
  && ($paypal["period3"] || ($paypal["period3"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_period3 ($paypal))) /* Must have a period3 value. */
1130
  && ($paypal["subscr_id"] || ($paypal["subscr_id"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_subscr_id ($paypal))) /* Must have this. */
@@ -1266,28 +1265,28 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in"))
1266
  practice it never seems to happen. It's best to check the negative mc_gross amount instead.
1267
  */
1268
  else if (/**/( /* Partial Refunds ( i.e. payment_status=partially_refunded or txn_type=adjustment ) are NOT processed by this routine. */
1269
- (preg_match ("/^(subscr_eot|recurring_payment_expired|recurring_payment_suspended_due_to_max_failed_payment)$/i", $paypal["txn_type"]) && ($recurring = 1))/**/
1270
- || (preg_match ("/^recurring_payment_profile_cancel$/i", $paypal["txn_type"]) && preg_match ("/^failed$/i", $paypal["initial_payment_status"]) && ($recurring = 1))/**/
1271
- || (preg_match ("/^new_case$/i", $paypal["txn_type"]) && preg_match ("/^chargeback$/i", $paypal["case_type"])) /* ONLY for future compatibility. */
1272
- || (preg_match ("/^(refunded|reversed|reversal)$/i", $paypal["payment_status"])) /* The "txn_type" is irrelevant in all of these special cases. */)/**/
1273
  && ($paypal["period1"] || ($paypal["period1"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_period1 ($paypal)) || !$recurring || ($paypal["period1"] = "0 D"))/**/
1274
  && ($paypal["period3"] || ($paypal["period3"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_period3 ($paypal)) || !$recurring) /* Was it even recurring? */
1275
- && ($paypal["item_number"] || ($paypal["item_number"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_item_number ($paypal))) /* A valid item_number? */
1276
- && (preg_match ("/^[1-4](\:|$)([\+a-z_0-9,]+)?(\:)?([0-9]+ [A-Z])?$/", $paypal["item_number"])) /* Only "Membership Access". NOT for Specific Posts/Pages. */
1277
  && ($paypal["subscr_id"] || ($paypal["subscr_id"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_subscr_id ($paypal)) || ($paypal["subscr_id"] = $paypal["parent_txn_id"]))/**/
1278
  && ($paypal["item_name"] || ($paypal["item_name"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_item_name ($paypal)) || ($paypal["item_name"] = $_SERVER["HTTP_HOST"]))/**/
1279
- /* The item_name can default to HTTP_HOST because we've seen payment_status=Reversed come through without a product_name or item_name given. */
1280
  && ($paypal["payer_email"] || ($paypal["payer_email"] = c_ws_plugin__s2member_utils_users::get_user_email_with ($paypal["subscr_id"])))/**/)
1281
  {
1282
  eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
1283
  do_action ("ws_plugin__s2member_during_paypal_notify_before_subscr_eot", get_defined_vars ());
1284
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
1285
  /**/
1286
- $is_refund = (preg_match ("/^refunded$/i", $paypal["payment_status"]) && $paypal["parent_txn_id"]);
1287
- $is_reversal = (preg_match ("/^(reversed|reversal)$/i", $paypal["payment_status"]) && $paypal["parent_txn_id"]);
1288
- $is_reversal = (!$is_reversal) ? (preg_match ("/^new_case$/i", $paypal["txn_type"]) && preg_match ("/^chargeback$/i", $paypal["case_type"])) : $is_reversal;
1289
  $is_refund_or_reversal = ($is_refund || $is_reversal); /* If either of the previous tests above evaluated to true; it's obviously a Refund or Reversal. */
1290
- $is_delayed_eot = (preg_match ("/^(subscr_eot|recurring_payment_expired)$/i", $paypal["txn_type"]) && preg_match ("/^I-/i", $paypal["subscr_id"]));
1291
  /**/
1292
  if ($is_refund_or_reversal)
1293
  $paypal["s2member_log"][] = "s2Member txn_type identified as [empty or irrelevant] w/ payment_status (refunded|reversed|reversal) - or - new_case w/ case_type (chargeback).";
@@ -1451,7 +1450,7 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in"))
1451
  /**/
1452
  else /* Otherwise, we can actually delete them. */
1453
  /* This will automatically trigger `eot_del_notification_urls` as well. */
1454
- wp_delete_user ($user_id); /* `c_ws_plugin__s2member_user_deletions::handle_user_deletions()` */
1455
  /**/
1456
  $paypal["s2member_log"][] = "This Member's account has been " . ( (is_multisite ()) ? "removed" : "deleted") . ".";
1457
  /**/
@@ -1624,8 +1623,8 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in"))
1624
  HOWEVER. PayPal® does NOT always send payment_status=partially_refunded. This is well documented on their site, but in
1625
  practice it never seems to happen. It's best to check the negative mc_gross amount instead.
1626
  */
1627
- else if (/**/(/**/ (preg_match ("/^new_case$/i", $paypal["txn_type"]) && preg_match ("/^chargeback$/i", $paypal["case_type"])) /* Future compatibility. */
1628
- || (preg_match ("/^(refunded|reversed|reversal)$/i", $paypal["payment_status"])) /* The "txn_type" is irrelevant in all of these special cases. */)/**/
1629
  && ($paypal["item_number"] || ($paypal["item_number"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_item_number ($paypal))) /* Required. */
1630
  && (preg_match ("/^sp\:[0-9,]+\:[0-9]+$/", $paypal["item_number"])) /* Only for "Specific Post/Page Access" here. NOT for Membership. */
1631
  && ($paypal["item_name"] || ($paypal["item_name"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_item_name ($paypal))) /* ? */
@@ -1718,7 +1717,7 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in"))
1718
  /*
1719
  Else, check on cancelled recurring profiles.
1720
  */
1721
- else if (preg_match ("/^recurring_payment_profile_cancel$/i", $paypal["txn_type"]))
1722
  {
1723
  $paypal["s2member_log"][] = "Transaction type ( recurring_payment_profile_cancel ), but there is no match to an existing account; so verification of _SERVER[HTTP_HOST] was not possible.";
1724
  $paypal["s2member_log"][] = "It's likely this account was just upgraded/downgraded by s2Member Pro; so the Subscr. ID has probably been updated on-site; nothing to worry about here.";
@@ -1726,7 +1725,7 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in"))
1726
  /*
1727
  Else, check on other ^recurring_ transaction types.
1728
  */
1729
- else if (preg_match ("/^recurring_/i", $paypal["txn_type"])) /* Otherwise, is this a ^recurring_ txn_type? */
1730
  $paypal["s2member_log"][] = "Transaction type ( ^recurring_? ), but there is no match to an existing account; so verification of _SERVER[HTTP_HOST] was not possible.";
1731
  /**/
1732
  else /* Else, use the default _SERVER[HTTP_HOST] error. */
@@ -1761,7 +1760,7 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in"))
1761
  */
1762
  $log4 = $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"] . "\nUser-Agent: " . $_SERVER["HTTP_USER_AGENT"];
1763
  $log4 = (is_multisite () && !is_main_site ()) ? ($_log4 = $current_blog->domain . $current_blog->path) . "\n" . $log4 : $log4;
1764
- $log2 = (is_multisite () && !is_main_site ()) ? "paypal-ipn-4-" . trim (preg_replace ("/[^a-z0-9]/i", "-", $_log4), "-") . ".log" : "paypal-ipn.log";
1765
  /**/
1766
  if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["gateway_debug_logs"])
1767
  if (is_dir ($logs_dir = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["logs_dir"]))
@@ -1773,7 +1772,8 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in"))
1773
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
1774
  /**/
1775
  header ("HTTP/1.0 200 OK"); /* Send a 200 OK status header. */
1776
- exit ($paypal["s2member_paypal_proxy_return_url"]); /* Return. */
 
1777
  }
1778
  /**/
1779
  eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
40
  /**/
41
  if ($_GET["s2member_paypal_notify"] && ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_business"] || $_GET["s2member_paypal_proxy"]))
42
  {
43
+ @ignore_user_abort(true); /* Important. Continue processing even if/when the connection is broken by the sending party. */
44
  /**/
45
  include_once ABSPATH . "wp-admin/includes/admin.php"; /* Get administrative functions. Needed for `wp_delete_user()`. */
46
  /**/
49
  if (is_array ($paypal = c_ws_plugin__s2member_paypal_utilities::paypal_postvars ()) && ($_paypal = $paypal))
50
  {
51
  $paypal["s2member_log"][] = "IPN received on: " . date ("D M j, Y g:i:s a T");
52
+ $paypal["s2member_log"][] = "s2Member POST vars verified " . ( ($paypal["proxy_verified"]) ? "with a Proxy Key" : "through a POST back to PayPal®.");
 
53
  /**/
54
  $payment_status_issues = "/^(failed|denied|expired|refunded|partially_refunded|reversed|reversal|canceled_reversal|voided)$/i";
55
  /**/
77
  be necessary in a future release of s2Member. For now, it's just a fill-in.
78
  These Hooks/Filters will remain, so you can use them now; if you need to.
79
  */
80
+ if (/**/(preg_match ("/^virtual_terminal$/i",$paypal["txn_type"]))/**/
81
+ && (!preg_match ($payment_status_issues,$paypal["payment_status"]))/**/
82
  && ($paypal["txn_id"])/**/)
83
  {
84
  eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
105
  be necessary in a future release of s2Member. For now, it's just a fill-in.
106
  These Hooks/Filters will remain, so you can use them now; if you need to.
107
  */
108
+ else if (/**/(preg_match ("/^express_checkout$/i",$paypal["txn_type"]))/**/
109
+ && (!preg_match ($payment_status_issues,$paypal["payment_status"]))/**/
110
  && ($paypal["txn_id"])/**/)
111
  {
112
  eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
134
  be necessary in a future release of s2Member. For now, it's just a fill-in.
135
  These Hooks/Filters will remain, so you can use them now; if you need to.
136
  */
137
+ else if (/**/(preg_match ("/^cart$/i",$paypal["txn_type"]))/**/
138
+ && (!preg_match ($payment_status_issues,$paypal["payment_status"]))/**/
139
  && ($paypal["txn_id"])/**/)
140
  {
141
  eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
163
  be necessary in a future release of s2Member. For now, it's just a fill-in.
164
  These Hooks/Filters will remain, so you can use them now; if you need to.
165
  */
166
+ else if (/**/(preg_match ("/^send_money$/i",$paypal["txn_type"]))/**/
167
+ && (!preg_match ($payment_status_issues,$paypal["payment_status"]))/**/
168
  && ($paypal["txn_id"])/**/)
169
  {
170
  eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
188
  /*
189
  Specific Post/Page Access ~ Sales.
190
  */
191
+ else if (/**/(preg_match ("/^web_accept$/i",$paypal["txn_type"]))/**/
192
+ && (preg_match ("/^sp\:[0-9,]+\:[0-9]+$/",$paypal["item_number"]))/**/
193
+ && (!preg_match ($payment_status_issues,$paypal["payment_status"]))/**/
194
  && ($paypal["payer_email"] && $paypal["txn_id"])/**/)
195
  {
196
  eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
205
  {
206
  $processing = $during = true; /* Yes, we ARE processing this. */
207
  /**/
208
+ $sbj = preg_replace ("/%%sp_access_url%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($sp_access_url), $GLOBALS["WS_PLUGIN__"]["s2member"]["o"][ ( ($_GET["s2member_paypal_proxy"] && preg_match ("/pro-emails/",$_GET["s2member_paypal_proxy_use"])) ? "pro_" : "") . "sp_email_subject"]);
209
  $sbj = preg_replace ("/%%sp_access_exp%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (c_ws_plugin__s2member_utils_time::approx_time_difference (time (), strtotime ("+" . $paypal["hours"] . " hours"))), $sbj);
210
  /**/
211
+ $msg = preg_replace ("/%%sp_access_url%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($sp_access_url), $GLOBALS["WS_PLUGIN__"]["s2member"]["o"][ ( ($_GET["s2member_paypal_proxy"] && preg_match ("/pro-emails/",$_GET["s2member_paypal_proxy_use"])) ? "pro_" : "") . "sp_email_message"]);
212
  $msg = preg_replace ("/%%sp_access_exp%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (c_ws_plugin__s2member_utils_time::approx_time_difference (time (), strtotime ("+" . $paypal["hours"] . " hours"))), $msg);
213
  /**/
214
+ $rec = preg_replace ("/%%sp_access_url%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($sp_access_url), $GLOBALS["WS_PLUGIN__"]["s2member"]["o"][ ( ($_GET["s2member_paypal_proxy"] && preg_match ("/pro-emails/",$_GET["s2member_paypal_proxy_use"])) ? "pro_" : "") . "sp_email_recipients"]);
215
  $rec = preg_replace ("/%%sp_access_exp%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (c_ws_plugin__s2member_utils_time::approx_time_difference (time (), strtotime ("+" . $paypal["hours"] . " hours"))), $rec);
216
  /**/
217
  if (($rec = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim($cv[$1])', $rec)) && ($rec = preg_replace ("/%%txn_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["txn_id"]), $rec)))
350
  Possibly containing advanced update vars
351
  ( option_name1, option_selection1 ); which allow account modifications.
352
  */
353
+ else if (/**/(preg_match ("/^(web_accept|subscr_signup)$/i",$paypal["txn_type"]))/**/
354
+ && (preg_match ("/^[1-4](\:|$)([\+a-z_0-9,]+)?(\:)?([0-9]+ [A-Z])?$/",$paypal["item_number"]))/**/
355
  && ($paypal["subscr_id"] || ($paypal["subscr_id"] = $paypal["txn_id"]))/**/
356
+ && (!preg_match ($payment_status_issues,$paypal["payment_status"]))/**/
357
  && ($paypal["payer_email"])/**/)
358
  {
359
  eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
364
  /**/
365
  list ($paypal["level"], $paypal["ccaps"], $paypal["eotper"]) = preg_split ("/\:/", $paypal["item_number"], 3);
366
  /**/
367
+ $paypal["period1"] = (preg_match ("/^[1-9]/",$paypal["period1"])) ? $paypal["period1"] : "0 D"; /* Defaults to "0 D" ( zero days ). */
368
  $paypal["mc_amount1"] = (strlen ($paypal["mc_amount1"]) && $paypal["mc_amount1"] > 0) ? $paypal["mc_amount1"] : "0.00"; /* "0.00". */
369
  /**/
370
  if (preg_match ("/^web_accept$/i", $paypal["txn_type"])) /* Conversions for Lifetime & Fixed-Term sales. */
383
  /*
384
  New Subscription with advanced update vars ( option_name1, option_selection1 )? These variables are used in Subscr. Modifications.
385
  */
386
+ if (preg_match ("/(updat|upgrad)/i",$paypal["option_name1"]) && $paypal["option_selection1"]) /* This is an advanced way to handle Subscription update modifications. */
387
  /* This advanced method is required whenever a Subscription that is already completed, or was never setup to recur in the first place needs to be modified. PayPal® will not allow the
388
  modify=1|2 parameter to be used in those scenarios, because technically there is nothing to update. The only thing that actually needs to be updated is the account. */
389
  {
483
  {
484
  $processing = $during = true; /* Yes, we ARE processing this. */
485
  /**/
486
+ $sbj = preg_replace ("/%%registration_url%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($registration_url), $GLOBALS["WS_PLUGIN__"]["s2member"]["o"][ ( ($_GET["s2member_paypal_proxy"] && preg_match ("/pro-emails/",$_GET["s2member_paypal_proxy_use"])) ? "pro_" : "") . "signup_email_subject"]);
487
+ $msg = preg_replace ("/%%registration_url%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($registration_url), $GLOBALS["WS_PLUGIN__"]["s2member"]["o"][ ( ($_GET["s2member_paypal_proxy"] && preg_match ("/pro-emails/",$_GET["s2member_paypal_proxy_use"])) ? "pro_" : "") . "signup_email_message"]);
488
+ $rec = preg_replace ("/%%registration_url%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($registration_url), $GLOBALS["WS_PLUGIN__"]["s2member"]["o"][ ( ($_GET["s2member_paypal_proxy"] && preg_match ("/pro-emails/",$_GET["s2member_paypal_proxy_use"])) ? "pro_" : "") . "signup_email_recipients"]);
489
  /**/
490
  if (($rec = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim($cv[$1])', $rec)) && ($rec = preg_replace ("/%%subscr_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["subscr_id"]), $rec)))
491
  if (($rec = preg_replace ("/%%initial%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["initial"]), $rec)) && ($rec = preg_replace ("/%%regular%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["regular"]), $rec)))
617
  /**/
618
  if ($processing && $_GET["s2member_paypal_proxy"] && ($url = $_GET["s2member_paypal_proxy_return_url"]) && is_array ($cv = preg_split ("/\|/", $paypal["custom"]))) /* A Proxy is requesting a Return URL? */
619
  {
620
+ if (($user_id && is_object ($user) && $user->ID) || ( ($user_id = c_ws_plugin__s2member_utils_users::get_user_id_with ($paypal["subscr_id"],$paypal["option_selection1"])) && is_object ($user = new WP_User ($user_id)) && $user->ID))
621
  {
622
  $fields = get_user_option ("s2member_custom_fields", $user_id); /* These will be needed below. */
623
  /**/
652
  }
653
  /**/
654
  if ($processing /* Process a payment now? Special cases for web_accept and/or Proxy requests with `subscr-signup-as-subscr-payment`. */
655
+ && (preg_match ("/^web_accept$/i", $paypal["txn_type"]) || ($_GET["s2member_paypal_proxy"] && preg_match ("/subscr-signup-as-subscr-payment/",$_GET["s2member_paypal_proxy_use"]) && $paypal["txn_id"] && $paypal["mc_gross"] > 0))/**/
656
+ && ( ($user_id && is_object ($user) && $user->ID) || ( ($user_id = c_ws_plugin__s2member_utils_users::get_user_id_with ($paypal["subscr_id"],$paypal["option_selection1"])) && is_object ($user = new WP_User ($user_id)) && $user->ID)))
657
  {
658
  $paypal["s2member_log"][] = "User exists. Handling `payment` for Subscription via (" . ( (preg_match ("/^web_accept$/i", $paypal["txn_type"])) ? "web_accept" : "subscr-signup-as-subscr-payment") . ").";
659
  /**/
761
  }
762
  }
763
  else if ($processing /* Process a payment now? Special cases for web_accept and/or Proxy requests with `subscr-signup-as-subscr-payment`. */
764
+ && (preg_match ("/^web_accept$/i", $paypal["txn_type"]) || ($_GET["s2member_paypal_proxy"] && preg_match ("/subscr-signup-as-subscr-payment/",$_GET["s2member_paypal_proxy_use"]) && $paypal["txn_id"] && $paypal["mc_gross"] > 0)))
765
  {
766
  $paypal["s2member_log"][] = "Storing `payment` for Subscription via (" . ( (preg_match ("/^web_accept$/i", $paypal["txn_type"])) ? "web_accept" : "subscr-signup-as-subscr-payment") . ").";
767
  /**/
777
  }
778
  /**/
779
  if ($processing /* Store signup vars now? If the User already exists in the database, we can go ahead and store these right now. */
780
+ && ( ($user_id && is_object ($user) && $user->ID) || ( ($user_id = c_ws_plugin__s2member_utils_users::get_user_id_with ($paypal["subscr_id"],$paypal["option_selection1"])) && is_object ($user = new WP_User ($user_id)) && $user->ID)))
781
  {
782
  $paypal["s2member_log"][] = "Storing IPN signup vars now. These are associated with a User's account record; for future reference.";
783
  /**/
800
  be necessary in a future release of s2Member. For now, it's just a fill-in.
801
  These Hooks/Filters will remain, so you can use them now; if you need to.
802
  */
803
+ else if (/**/(preg_match ("/^recurring_payment_profile_created$/i",$paypal["txn_type"]))/**/
804
  && ($paypal["item_number"] || ($paypal["item_number"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_item_number ($paypal)))/**/
805
  && (preg_match ("/^[1-4](\:|$)([\+a-z_0-9,]+)?(\:)?([0-9]+ [A-Z])?$/", $paypal["item_number"])) /* This must match a Subscription. */
806
  && ($paypal["subscr_id"] || ($paypal["subscr_id"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_subscr_id ($paypal)))/**/
829
  /*
830
  Subscription modifications.
831
  */
832
+ else if (/**/(preg_match ("/^subscr_modify$/i",$paypal["txn_type"]))/**/
833
+ && (preg_match ("/^[1-4](\:|$)([\+a-z_0-9,]+)?(\:)?([0-9]+ [A-Z])?$/",$paypal["item_number"]))/**/
834
  && ($paypal["subscr_id"] && $paypal["payer_email"])/**/)
835
  {
836
  eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
841
  /**/
842
  list ($paypal["level"], $paypal["ccaps"]) = preg_split ("/\:/", $paypal["item_number"], 2);
843
  /**/
844
+ $paypal["period1"] = (preg_match ("/^[1-9]/",$paypal["period1"])) ? $paypal["period1"] : "0 D"; /* Defaults to "0 D" ( zero days ). */
845
  $paypal["mc_amount1"] = (strlen ($paypal["mc_amount1"]) && $paypal["mc_amount1"] > 0) ? $paypal["mc_amount1"] : "0.00"; /* "0.00". */
846
  /**/
847
  $paypal["initial_term"] = (preg_match ("/^[1-9]/", $paypal["period1"])) ? $paypal["period1"] : "0 D"; /* Defaults to "0 D" ( zero days ). */
927
  Subscription payment notifications.
928
  We need these to update: `s2member_last_payment_time`.
929
  */
930
+ else if (/**/(preg_match ("/^(subscr_payment|recurring_payment)$/i",$paypal["txn_type"]))/**/
931
  && ($paypal["item_number"] || ($paypal["item_number"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_item_number ($paypal)))/**/
932
  && (preg_match ("/^[1-4](\:|$)([\+a-z_0-9,]+)?(\:)?([0-9]+ [A-Z])?$/", $paypal["item_number"])) /* This must match a Subscription. */
933
  && ($paypal["subscr_id"] || ($paypal["subscr_id"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_subscr_id ($paypal)))/**/
934
+ && (!preg_match ($payment_status_issues,$paypal["payment_status"])) /* Status OK? This goes thru a list of known status issues. */
935
  && ($paypal["item_name"] || ($paypal["item_name"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_item_name ($paypal)))/**/
936
  && ($paypal["payer_email"] || ($paypal["payer_email"] = c_ws_plugin__s2member_utils_users::get_user_email_with ($paypal["subscr_id"])))/**/
937
  && ($paypal["txn_id"] && $paypal["mc_gross"])/**/)
943
  $paypal["s2member_log"][] = "s2Member txn_type identified as subscr_payment|recurring_payment.";
944
  $paypal["s2member_log"][] = "Sleeping for 2 seconds. Waiting for a possible subscr_signup|subscr_modify|recurring_payment_profile_created.";
945
  sleep (2); /* Sleep here for a moment. PayPal® sometimes sends a subscr_payment before the subscr_signup, subscr_modify.
946
+ It is NOT a big deal if they do. However, s2Member goes to sleep here, just to help keep the log files in a logical order. */
947
  $paypal["s2member_log"][] = "Awake. It's " . date ("D M j, Y g:i:s a T") . ". s2Member txn_type identified as subscr_payment|recurring_payment.";
948
  /**/
949
  list ($paypal["level"], $paypal["ccaps"]) = preg_split ("/\:/", $paypal["item_number"], 2);
1086
  be necessary in a future release of s2Member. For now, it's just a fill-in.
1087
  These Hooks/Filters will remain, so you can use them now; if you need to.
1088
  */
1089
+ else if (/**/(preg_match ("/^(subscr_failed|recurring_payment_failed|recurring_payment_skipped)$/i",$paypal["txn_type"]))/**/
1090
  && ($paypal["item_number"] || ($paypal["item_number"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_item_number ($paypal)))/**/
1091
  && (preg_match ("/^[1-4](\:|$)([\+a-z_0-9,]+)?(\:)?([0-9]+ [A-Z])?$/", $paypal["item_number"])) /* Must match a Subscription. */
1092
  && ($paypal["subscr_id"] || ($paypal["subscr_id"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_subscr_id ($paypal)))/**/
1119
  This works in conjunction with `s2member_last_payment_time`, and the s2Member Auto-EOT System.
1120
  For further details, see: https://www.x.com/thread/41155?start=15&tstart=0
1121
  */
1122
+ else if (/**/(preg_match ("/^(subscr_cancel|recurring_payment_profile_cancel)$/i",$paypal["txn_type"]))/**/
1123
+ && ! (preg_match ("/^recurring_payment_profile_cancel$/i", $paypal["txn_type"]) && preg_match ("/^failed$/i",$paypal["initial_payment_status"]))
1124
+ /* ^^ Bypass this case ( for now ) "recurring_payment_profile_cancel" with an initial failed payment warrants an EOT instead of a cancellation. */
1125
+ && ($paypal["item_number"] || ($paypal["item_number"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_item_number ($paypal))) /* item_number? */
1126
+ && (preg_match ("/^[1-4](\:|$)([\+a-z_0-9,]+)?(\:)?([0-9]+ [A-Z])?$/", $paypal["item_number"])) /* This item_number must validate as Membership Access. */
1127
  && ($paypal["period1"] || ($paypal["period1"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_period1 ($paypal)) || ($paypal["period1"] = "0 D"))/**/
1128
  && ($paypal["period3"] || ($paypal["period3"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_period3 ($paypal))) /* Must have a period3 value. */
1129
  && ($paypal["subscr_id"] || ($paypal["subscr_id"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_subscr_id ($paypal))) /* Must have this. */
1265
  practice it never seems to happen. It's best to check the negative mc_gross amount instead.
1266
  */
1267
  else if (/**/( /* Partial Refunds ( i.e. payment_status=partially_refunded or txn_type=adjustment ) are NOT processed by this routine. */
1268
+ (preg_match ("/^(subscr_eot|recurring_payment_expired|recurring_payment_suspended_due_to_max_failed_payment)$/i",$paypal["txn_type"]) && ($recurring = 1))/**/
1269
+ || (preg_match ("/^recurring_payment_profile_cancel$/i",$paypal["txn_type"]) && preg_match ("/^failed$/i",$paypal["initial_payment_status"]) && ($recurring = 1))/**/
1270
+ || (preg_match ("/^new_case$/i",$paypal["txn_type"]) && preg_match ("/^chargeback$/i",$paypal["case_type"])) /* ONLY for future compatibility. This does NOT work yet. */
1271
+ || (preg_match ("/^(refunded|reversed|reversal)$/i",$paypal["payment_status"])) /* The "txn_type" is irrelevant in all of these cases: refunded|reversed|reversal. */)/**/
1272
  && ($paypal["period1"] || ($paypal["period1"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_period1 ($paypal)) || !$recurring || ($paypal["period1"] = "0 D"))/**/
1273
  && ($paypal["period3"] || ($paypal["period3"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_period3 ($paypal)) || !$recurring) /* Was it even recurring? */
1274
+ && ($paypal["item_number"] || ($paypal["item_number"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_item_number ($paypal))) /* Do we have a valid item_number? */
1275
+ && (preg_match ("/^[1-4](\:|$)([\+a-z_0-9,]+)?(\:)?([0-9]+ [A-Z])?$/", $paypal["item_number"])) /* Only for "Membership Level Access". This is NOT for Specific Posts/Pages. */
1276
  && ($paypal["subscr_id"] || ($paypal["subscr_id"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_subscr_id ($paypal)) || ($paypal["subscr_id"] = $paypal["parent_txn_id"]))/**/
1277
  && ($paypal["item_name"] || ($paypal["item_name"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_item_name ($paypal)) || ($paypal["item_name"] = $_SERVER["HTTP_HOST"]))/**/
1278
+ /* The item_name can default to HTTP_HOST because we've seen payment_status=reversed come through WITHOUT a product_name or item_name given. */
1279
  && ($paypal["payer_email"] || ($paypal["payer_email"] = c_ws_plugin__s2member_utils_users::get_user_email_with ($paypal["subscr_id"])))/**/)
1280
  {
1281
  eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
1282
  do_action ("ws_plugin__s2member_during_paypal_notify_before_subscr_eot", get_defined_vars ());
1283
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
1284
  /**/
1285
+ $is_refund = (preg_match ("/^refunded$/i",$paypal["payment_status"]) && $paypal["parent_txn_id"]);
1286
+ $is_reversal = (preg_match ("/^(reversed|reversal)$/i",$paypal["payment_status"]) && $paypal["parent_txn_id"]);
1287
+ $is_reversal = (!$is_reversal) ? (preg_match ("/^new_case$/i",$paypal["txn_type"]) && preg_match ("/^chargeback$/i",$paypal["case_type"])) : $is_reversal;
1288
  $is_refund_or_reversal = ($is_refund || $is_reversal); /* If either of the previous tests above evaluated to true; it's obviously a Refund or Reversal. */
1289
+ $is_delayed_eot = (preg_match ("/^(subscr_eot|recurring_payment_expired)$/i",$paypal["txn_type"]) && preg_match ("/^I-/i", $paypal["subscr_id"]));
1290
  /**/
1291
  if ($is_refund_or_reversal)
1292
  $paypal["s2member_log"][] = "s2Member txn_type identified as [empty or irrelevant] w/ payment_status (refunded|reversed|reversal) - or - new_case w/ case_type (chargeback).";
1450
  /**/
1451
  else /* Otherwise, we can actually delete them. */
1452
  /* This will automatically trigger `eot_del_notification_urls` as well. */
1453
+ wp_delete_user($user_id); /* `c_ws_plugin__s2member_user_deletions::handle_user_deletions()` */
1454
  /**/
1455
  $paypal["s2member_log"][] = "This Member's account has been " . ( (is_multisite ()) ? "removed" : "deleted") . ".";
1456
  /**/
1623
  HOWEVER. PayPal® does NOT always send payment_status=partially_refunded. This is well documented on their site, but in
1624
  practice it never seems to happen. It's best to check the negative mc_gross amount instead.
1625
  */
1626
+ else if (/**/(/**/ (preg_match ("/^new_case$/i",$paypal["txn_type"]) && preg_match ("/^chargeback$/i",$paypal["case_type"])) /* Future compatibility. */
1627
+ || (preg_match ("/^(refunded|reversed|reversal)$/i",$paypal["payment_status"])) /* The "txn_type" is irrelevant in all of these special cases. */)/**/
1628
  && ($paypal["item_number"] || ($paypal["item_number"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_item_number ($paypal))) /* Required. */
1629
  && (preg_match ("/^sp\:[0-9,]+\:[0-9]+$/", $paypal["item_number"])) /* Only for "Specific Post/Page Access" here. NOT for Membership. */
1630
  && ($paypal["item_name"] || ($paypal["item_name"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_item_name ($paypal))) /* ? */
1717
  /*
1718
  Else, check on cancelled recurring profiles.
1719
  */
1720
+ else if (preg_match ("/^recurring_payment_profile_cancel$/i",$paypal["txn_type"]))
1721
  {
1722
  $paypal["s2member_log"][] = "Transaction type ( recurring_payment_profile_cancel ), but there is no match to an existing account; so verification of _SERVER[HTTP_HOST] was not possible.";
1723
  $paypal["s2member_log"][] = "It's likely this account was just upgraded/downgraded by s2Member Pro; so the Subscr. ID has probably been updated on-site; nothing to worry about here.";
1725
  /*
1726
  Else, check on other ^recurring_ transaction types.
1727
  */
1728
+ else if (preg_match ("/^recurring_/i",$paypal["txn_type"])) /* Otherwise, is this a ^recurring_ txn_type? */
1729
  $paypal["s2member_log"][] = "Transaction type ( ^recurring_? ), but there is no match to an existing account; so verification of _SERVER[HTTP_HOST] was not possible.";
1730
  /**/
1731
  else /* Else, use the default _SERVER[HTTP_HOST] error. */
1760
  */
1761
  $log4 = $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"] . "\nUser-Agent: " . $_SERVER["HTTP_USER_AGENT"];
1762
  $log4 = (is_multisite () && !is_main_site ()) ? ($_log4 = $current_blog->domain . $current_blog->path) . "\n" . $log4 : $log4;
1763
+ $log2 = (is_multisite () && !is_main_site ()) ? "paypal-ipn-4-" . trim (preg_replace ("/[^a-z0-9]/i", "-",$_log4), "-") . ".log" : "paypal-ipn.log";
1764
  /**/
1765
  if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["gateway_debug_logs"])
1766
  if (is_dir ($logs_dir = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["logs_dir"]))
1772
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
1773
  /**/
1774
  header ("HTTP/1.0 200 OK"); /* Send a 200 OK status header. */
1775
+ header ("Content-Type: text/plain; charset=utf-8"); /* With text/plain. */
1776
+ exit ($paypal["s2member_paypal_proxy_return_url"]); /* Possible return value. */
1777
  }
1778
  /**/
1779
  eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
includes/classes/paypal-return-in.inc.php CHANGED
@@ -33,16 +33,15 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_return_in"))
33
  if (is_array ($paypal = c_ws_plugin__s2member_paypal_utilities::paypal_postvars ()) && ($_paypal = $paypal))
34
  {
35
  $paypal["s2member_log"][] = "Return-Data received on: " . date ("D M j, Y g:i:s a T");
36
- $paypal["s2member_log"][] = "s2Member POST vars verified " . /* Indicate Proxy Key. */
37
- ( ($postvars["proxy_verified"]) ? "with a Proxy Key" : "through a POST back to PayPal®.");
38
  /**/
39
  $paypal["subscr_gateway"] = ($_GET["s2member_paypal_proxy"]) ? $_GET["s2member_paypal_proxy"] : "paypal";
40
  /**/
41
- if (!$_GET["s2member_paypal_proxy"] || !preg_match ("/ty-email/", $_GET["s2member_paypal_proxy_use"]))
42
  {
43
  $payment_status_issues = "/^(failed|denied|expired|refunded|partially_refunded|reversed|reversal|canceled_reversal|voided)$/i";
44
  /**/
45
- if (preg_match ("/^" . preg_quote (preg_replace ("/\:([0-9]+)$/", "", $_SERVER["HTTP_HOST"]), "/") . "/i", $paypal["custom"]))
46
  { /* The business address validation was removed from this routine, because PayPal® always fills that with the primary
47
  email address. In cases where an alternate PayPal® address is being paid, validation was not possible. */
48
  $paypal["s2member_log"][] = "s2Member originating domain ( _SERVER[HTTP_HOST] ) validated.";
@@ -56,9 +55,9 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_return_in"))
56
  /*
57
  Specific Post/Page Access ~ Sales.
58
  */
59
- if (/**/(preg_match ("/^web_accept$/i", $paypal["txn_type"]))/**/
60
- && (preg_match ("/^sp\:[0-9,]+\:[0-9]+$/", $paypal["item_number"]))/**/
61
- && (!preg_match ($payment_status_issues, $paypal["payment_status"]))/**/
62
  && ($paypal["txn_id"])/**/)
63
  {
64
  eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
@@ -98,7 +97,7 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_return_in"))
98
  /**/
99
  $paypal["s2member_log"][] = "Redirecting Customer to the Specific Post/Page.";
100
  /**/
101
- wp_redirect($sp_access_url); /* Redirect Customer to the Specific Post/Page. */
102
  }
103
  else /* Otherwise, the ID must have been invalid. Or the Post/Page was deleted. */
104
  {
@@ -124,10 +123,10 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_return_in"))
124
  With Auto-Return URLs via PDT, PayPal® will send subscr_payment instead of subscr_signup.
125
  So we need to look for (web_accept|subscr_signup|subscr_payment), and treat the same.
126
  */
127
- else if (/**/(preg_match ("/^(web_accept|subscr_signup|subscr_payment)$/i", $paypal["txn_type"]))/**/
128
- && (preg_match ("/^[1-4](\:|$)([\+a-z_0-9,]+)?(\:)?([0-9]+ [A-Z])?$/", $paypal["item_number"]))/**/
129
  && ($paypal["subscr_id"] || ($paypal["subscr_id"] = $paypal["txn_id"]))/**/
130
- && (!preg_match ($payment_status_issues, $paypal["payment_status"]))/**/)
131
  {
132
  eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
133
  do_action ("ws_plugin__s2member_during_paypal_return_before_subscr_signup", get_defined_vars ());
@@ -139,7 +138,7 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_return_in"))
139
  /*
140
  New Subscription with advanced update vars ( option_name1, option_selection1 ).
141
  */
142
- if (preg_match ("/(updat|upgrad)/i", $paypal["option_name1"]) && $paypal["option_selection1"]) /* Advanced Subscription update modifications. */
143
  /* This advanced method is required whenever a Subscription that is already completed, or was never setup to recur in the first place needs to be modified. PayPal® will not allow the
144
  modify=2 parameter to be used in those scenarios, because technically there is nothing to update. The only thing to be updated is the account. */
145
  {
@@ -301,8 +300,8 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_return_in"))
301
  /*
302
  Subscription modifications.
303
  */
304
- else if (/**/(preg_match ("/^subscr_modify$/i", $paypal["txn_type"]))/**/
305
- && (preg_match ("/^[1-4](\:|$)([\+a-z_0-9,]+)?(\:)?([0-9]+ [A-Z])?$/", $paypal["item_number"]))/**/
306
  && ($paypal["subscr_id"])/**/)
307
  {
308
  eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
33
  if (is_array ($paypal = c_ws_plugin__s2member_paypal_utilities::paypal_postvars ()) && ($_paypal = $paypal))
34
  {
35
  $paypal["s2member_log"][] = "Return-Data received on: " . date ("D M j, Y g:i:s a T");
36
+ $paypal["s2member_log"][] = "s2Member POST vars verified " . ( ($paypal["proxy_verified"]) ? "with a Proxy Key" : "through a POST back to PayPal®.");
 
37
  /**/
38
  $paypal["subscr_gateway"] = ($_GET["s2member_paypal_proxy"]) ? $_GET["s2member_paypal_proxy"] : "paypal";
39
  /**/
40
+ if (!$_GET["s2member_paypal_proxy"] || !preg_match ("/ty-email/",$_GET["s2member_paypal_proxy_use"]))
41
  {
42
  $payment_status_issues = "/^(failed|denied|expired|refunded|partially_refunded|reversed|reversal|canceled_reversal|voided)$/i";
43
  /**/
44
+ if (preg_match ("/^" . preg_quote (preg_replace ("/\:([0-9]+)$/", "", $_SERVER["HTTP_HOST"]), "/") . "/i",$paypal["custom"]))
45
  { /* The business address validation was removed from this routine, because PayPal® always fills that with the primary
46
  email address. In cases where an alternate PayPal® address is being paid, validation was not possible. */
47
  $paypal["s2member_log"][] = "s2Member originating domain ( _SERVER[HTTP_HOST] ) validated.";
55
  /*
56
  Specific Post/Page Access ~ Sales.
57
  */
58
+ if (/**/(preg_match ("/^web_accept$/i",$paypal["txn_type"]))/**/
59
+ && (preg_match ("/^sp\:[0-9,]+\:[0-9]+$/",$paypal["item_number"]))/**/
60
+ && (!preg_match ($payment_status_issues,$paypal["payment_status"]))/**/
61
  && ($paypal["txn_id"])/**/)
62
  {
63
  eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
97
  /**/
98
  $paypal["s2member_log"][] = "Redirecting Customer to the Specific Post/Page.";
99
  /**/
100
+ wp_redirect ($sp_access_url); /* Redirect Customer to the Specific Post/Page. */
101
  }
102
  else /* Otherwise, the ID must have been invalid. Or the Post/Page was deleted. */
103
  {
123
  With Auto-Return URLs via PDT, PayPal® will send subscr_payment instead of subscr_signup.
124
  So we need to look for (web_accept|subscr_signup|subscr_payment), and treat the same.
125
  */
126
+ else if (/**/(preg_match ("/^(web_accept|subscr_signup|subscr_payment)$/i",$paypal["txn_type"]))/**/
127
+ && (preg_match ("/^[1-4](\:|$)([\+a-z_0-9,]+)?(\:)?([0-9]+ [A-Z])?$/",$paypal["item_number"]))/**/
128
  && ($paypal["subscr_id"] || ($paypal["subscr_id"] = $paypal["txn_id"]))/**/
129
+ && (!preg_match ($payment_status_issues,$paypal["payment_status"]))/**/)
130
  {
131
  eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
132
  do_action ("ws_plugin__s2member_during_paypal_return_before_subscr_signup", get_defined_vars ());
138
  /*
139
  New Subscription with advanced update vars ( option_name1, option_selection1 ).
140
  */
141
+ if (preg_match ("/(updat|upgrad)/i",$paypal["option_name1"]) && $paypal["option_selection1"]) /* Advanced Subscription update modifications. */
142
  /* This advanced method is required whenever a Subscription that is already completed, or was never setup to recur in the first place needs to be modified. PayPal® will not allow the
143
  modify=2 parameter to be used in those scenarios, because technically there is nothing to update. The only thing to be updated is the account. */
144
  {
300
  /*
301
  Subscription modifications.
302
  */
303
+ else if (/**/(preg_match ("/^subscr_modify$/i",$paypal["txn_type"]))/**/
304
+ && (preg_match ("/^[1-4](\:|$)([\+a-z_0-9,]+)?(\:)?([0-9]+ [A-Z])?$/",$paypal["item_number"]))/**/
305
  && ($paypal["subscr_id"])/**/)
306
  {
307
  eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
includes/classes/paypal-utilities.inc.php CHANGED
@@ -120,7 +120,7 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_utilities"))
120
  /**/
121
  $url = "https://" . ( ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_sandbox"]) ? "api-3t.sandbox.paypal.com" : "api-3t.paypal.com") . "/nvp";
122
  /**/
123
- $post_vars = (is_array ($post_vars)) ? $post_vars : array (); /* Must be in array format. */
124
  /**/
125
  $post_vars["VERSION"] = "63.0"; /* Configure the PayPal® API version. */
126
  $post_vars["USER"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_api_username"];
@@ -234,7 +234,7 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_utilities"))
234
  else if (is_string ($string = $array_or_string) && $string)
235
  $subscr_id = $string;
236
  /**/
237
- return apply_filters ("ws_plugin__s2member_paypal_pro_subscr_id", $subscr_id, get_defined_vars ());
238
  }
239
  /*
240
  Parse/validate item_number from either an array with:
@@ -262,7 +262,7 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_utilities"))
262
  else if ($_item_number && preg_match ("/^sp\:[0-9,]+\:[0-9]+$/", $_item_number))
263
  $item_number = $_item_number;
264
  /**/
265
- return apply_filters ("ws_plugin__s2member_paypal_pro_item_number", $item_number, get_defined_vars ());
266
  }
267
  /*
268
  Parse/validate item_name from either an array with: item_name1|product_name, or use an existing string.
@@ -282,7 +282,7 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_utilities"))
282
  else if (is_string ($string = $array_or_string))
283
  $item_name = $string;
284
  /**/
285
- return apply_filters ("ws_plugin__s2member_paypal_pro_item_name", $item_name, get_defined_vars ());
286
  }
287
  /*
288
  Parse/validate period1 from either a return array coming from the
120
  /**/
121
  $url = "https://" . ( ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_sandbox"]) ? "api-3t.sandbox.paypal.com" : "api-3t.paypal.com") . "/nvp";
122
  /**/
123
+ $post_vars = (is_array ($post_vars)) ? $post_vars : array (); /* Must be an array. */
124
  /**/
125
  $post_vars["VERSION"] = "63.0"; /* Configure the PayPal® API version. */
126
  $post_vars["USER"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_api_username"];
234
  else if (is_string ($string = $array_or_string) && $string)
235
  $subscr_id = $string;
236
  /**/
237
+ return apply_filters ("ws_plugin__s2member_paypal_pro_subscr_id",$subscr_id, get_defined_vars ());
238
  }
239
  /*
240
  Parse/validate item_number from either an array with:
262
  else if ($_item_number && preg_match ("/^sp\:[0-9,]+\:[0-9]+$/", $_item_number))
263
  $item_number = $_item_number;
264
  /**/
265
+ return apply_filters ("ws_plugin__s2member_paypal_pro_item_number",$item_number, get_defined_vars ());
266
  }
267
  /*
268
  Parse/validate item_name from either an array with: item_name1|product_name, or use an existing string.
282
  else if (is_string ($string = $array_or_string))
283
  $item_name = $string;
284
  /**/
285
+ return apply_filters ("ws_plugin__s2member_paypal_pro_item_name",$item_name, get_defined_vars ());
286
  }
287
  /*
288
  Parse/validate period1 from either a return array coming from the
includes/classes/posts-sp.inc.php CHANGED
@@ -19,7 +19,7 @@ if (!class_exists ("c_ws_plugin__s2member_posts_sp"))
19
  class c_ws_plugin__s2member_posts_sp
20
  {
21
  /*
22
- Function checks Post Level Access restrictions - for a specific Post.
23
 
24
  Don't call this function directly, use one of these API functions:
25
 
@@ -31,7 +31,7 @@ if (!class_exists ("c_ws_plugin__s2member_posts_sp"))
31
  - is_post_permitted_by_s2member($post_id);
32
  - is_permitted_by_s2member($post_id, "post");
33
 
34
- see: `/s2member/includes/functions/api-functions.inc.php`.
35
  */
36
  public static function check_specific_post_level_access ($post_id = FALSE, $check_user = TRUE)
37
  {
19
  class c_ws_plugin__s2member_posts_sp
20
  {
21
  /*
22
+ Checks Post Level Access restrictions - for a specific Post.
23
 
24
  Don't call this function directly, use one of these API functions:
25
 
31
  - is_post_permitted_by_s2member($post_id);
32
  - is_permitted_by_s2member($post_id, "post");
33
 
34
+ See: `/s2member/includes/functions/api-functions.inc.php`.
35
  */
36
  public static function check_specific_post_level_access ($post_id = FALSE, $check_user = TRUE)
37
  {
includes/classes/posts.inc.php CHANGED
@@ -19,7 +19,7 @@ if (!class_exists ("c_ws_plugin__s2member_posts"))
19
  class c_ws_plugin__s2member_posts
20
  {
21
  /*
22
- Function for handling Post Level Access restrictions.
23
 
24
  Don't call this function directly, use one of these API functions:
25
 
@@ -31,7 +31,7 @@ if (!class_exists ("c_ws_plugin__s2member_posts"))
31
  - is_post_permitted_by_s2member($post_id);
32
  - is_permitted_by_s2member($post_id, "post");
33
 
34
- see: `/s2member/includes/functions/api-functions.inc.php`.
35
  */
36
  public static function check_post_level_access ()
37
  {
19
  class c_ws_plugin__s2member_posts
20
  {
21
  /*
22
+ Handles Post Level Access restrictions.
23
 
24
  Don't call this function directly, use one of these API functions:
25
 
31
  - is_post_permitted_by_s2member($post_id);
32
  - is_permitted_by_s2member($post_id, "post");
33
 
34
+ See: `/s2member/includes/functions/api-functions.inc.php`.
35
  */
36
  public static function check_post_level_access ()
37
  {
includes/classes/profile-mods-in.inc.php CHANGED
@@ -34,33 +34,33 @@ if (!class_exists ("c_ws_plugin__s2member_profile_mods_in"))
34
  {
35
  $GLOBALS["ws_plugin__s2member_profile_saved"] = true; /* Global flag as having been saved/updated successfully. */
36
  /**/
37
- $_POST = c_ws_plugin__s2member_utils_strings::trim_deep (stripslashes_deep ($_POST)); /* Clean POST vars. */
38
  /**/
39
  $userdata["ID"] = $user_id = $current_user->ID; /* Needed for database update. */
40
  /**/
41
  include_once ABSPATH . WPINC . "/registration.php";
42
  /**/
43
- if (is_email ($_POST["ws_plugin__s2member_profile_email"]))
44
- if (!email_exists ($_POST["ws_plugin__s2member_profile_email"]))
45
- $userdata["user_email"] = $_POST["ws_plugin__s2member_profile_email"];
46
  /**/
47
- if ($_POST["ws_plugin__s2member_profile_password"])
48
  if ($current_user->user_login !== "demo") /* No pass change on demo. */
49
- $userdata["user_pass"] = $_POST["ws_plugin__s2member_profile_password"];
50
  /**/
51
- if ($_POST["ws_plugin__s2member_profile_first_name"])
52
- $userdata["first_name"] = $_POST["ws_plugin__s2member_profile_first_name"];
53
  /**/
54
- if ($_POST["ws_plugin__s2member_profile_display_name"])
55
- $userdata["display_name"] = $_POST["ws_plugin__s2member_profile_display_name"];
56
  /**/
57
- if ($_POST["ws_plugin__s2member_profile_last_name"])
58
- $userdata["last_name"] = $_POST["ws_plugin__s2member_profile_last_name"];
59
  /**/
60
  wp_update_user ($userdata); /* OK. Now send this array for an update. */
61
  /**/
62
  if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"])
63
- if ($fields_applicable = c_ws_plugin__s2member_custom_reg_fields::custom_fields_configured_at_level ("auto-detection"))
64
  {
65
  $_existing_fields = get_user_option ("s2member_custom_fields", $user_id);
66
  /**/
@@ -72,12 +72,11 @@ if (!class_exists ("c_ws_plugin__s2member_profile_mods_in"))
72
  if (!in_array ($field["id"], $fields_applicable) || preg_match ("/^no/", $field["editable"]))
73
  $fields[$field_var] = $_existing_fields[$field_var];
74
  /**/
75
- else if ($field["required"] === "yes" && empty ($_POST["ws_plugin__s2member_profile_" . $field_var])/**/
76
- && $_POST["ws_plugin__s2member_profile_" . $field_var] !== "0") /* Allow zeros. */
77
  $fields[$field_var] = $_existing_fields[$field_var];
78
  /**/
79
  else /* Otherwise, we can use the newly updated value. */
80
- $fields[$field_var] = $_POST["ws_plugin__s2member_profile_" . $field_var];
81
  }
82
  /**/
83
  update_user_option ($user_id, "s2member_custom_fields", $fields);
@@ -90,7 +89,7 @@ if (!class_exists ("c_ws_plugin__s2member_profile_mods_in"))
90
  $current_user = new WP_User ($user_id); /* Update the WP_User object for current User/Member. */
91
  (function_exists ("setup_userdata")) ? setup_userdata () : null; /* Update global vars. */
92
  /**/
93
- if (!$_POST["ws_plugin__s2member_sc_profile_save"]) /* But NOT with Shortcode Profiles. */
94
  {
95
  echo '<script type="text/javascript">' . "\n";
96
  echo "if(window.parent && window.parent != window) { try{ window.parent.Shadowbox.close(); } catch(e){} try{ window.parent.tb_remove(); } catch(e){} window.parent.alert('Profile updated successfully!'); window.parent.location = '" . esc_js (get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"])) . "'; }";
34
  {
35
  $GLOBALS["ws_plugin__s2member_profile_saved"] = true; /* Global flag as having been saved/updated successfully. */
36
  /**/
37
+ $_p = c_ws_plugin__s2member_utils_strings::trim_deep (stripslashes_deep ($_POST)); /* Clean POST vars. */
38
  /**/
39
  $userdata["ID"] = $user_id = $current_user->ID; /* Needed for database update. */
40
  /**/
41
  include_once ABSPATH . WPINC . "/registration.php";
42
  /**/
43
+ if (is_email ($_p["ws_plugin__s2member_profile_email"]))
44
+ if (!email_exists ($_p["ws_plugin__s2member_profile_email"]))
45
+ $userdata["user_email"] = $_p["ws_plugin__s2member_profile_email"];
46
  /**/
47
+ if ($_p["ws_plugin__s2member_profile_password"])
48
  if ($current_user->user_login !== "demo") /* No pass change on demo. */
49
+ $userdata["user_pass"] = $_p["ws_plugin__s2member_profile_password"];
50
  /**/
51
+ if ($_p["ws_plugin__s2member_profile_first_name"])
52
+ $userdata["first_name"] = $_p["ws_plugin__s2member_profile_first_name"];
53
  /**/
54
+ if ($_p["ws_plugin__s2member_profile_display_name"])
55
+ $userdata["display_name"] = $_p["ws_plugin__s2member_profile_display_name"];
56
  /**/
57
+ if ($_p["ws_plugin__s2member_profile_last_name"])
58
+ $userdata["last_name"] = $_p["ws_plugin__s2member_profile_last_name"];
59
  /**/
60
  wp_update_user ($userdata); /* OK. Now send this array for an update. */
61
  /**/
62
  if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"])
63
+ if ($fields_applicable = c_ws_plugin__s2member_custom_reg_fields::custom_fields_configured_at_level ("auto-detection", "profile"))
64
  {
65
  $_existing_fields = get_user_option ("s2member_custom_fields", $user_id);
66
  /**/
72
  if (!in_array ($field["id"], $fields_applicable) || preg_match ("/^no/", $field["editable"]))
73
  $fields[$field_var] = $_existing_fields[$field_var];
74
  /**/
75
+ else if ($field["required"] === "yes" && empty ($_p["ws_plugin__s2member_profile_" . $field_var]) && $_p["ws_plugin__s2member_profile_" . $field_var] !== "0")
 
76
  $fields[$field_var] = $_existing_fields[$field_var];
77
  /**/
78
  else /* Otherwise, we can use the newly updated value. */
79
+ $fields[$field_var] = $_p["ws_plugin__s2member_profile_" . $field_var];
80
  }
81
  /**/
82
  update_user_option ($user_id, "s2member_custom_fields", $fields);
89
  $current_user = new WP_User ($user_id); /* Update the WP_User object for current User/Member. */
90
  (function_exists ("setup_userdata")) ? setup_userdata () : null; /* Update global vars. */
91
  /**/
92
+ if (!$_p["ws_plugin__s2member_sc_profile_save"]) /* But NOT with Shortcode Profiles. */
93
  {
94
  echo '<script type="text/javascript">' . "\n";
95
  echo "if(window.parent && window.parent != window) { try{ window.parent.Shadowbox.close(); } catch(e){} try{ window.parent.tb_remove(); } catch(e){} window.parent.alert('Profile updated successfully!'); window.parent.location = '" . esc_js (get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"])) . "'; }";
includes/classes/ptags-sp.inc.php CHANGED
@@ -19,7 +19,7 @@ if (!class_exists ("c_ws_plugin__s2member_ptags_sp"))
19
  class c_ws_plugin__s2member_ptags_sp
20
  {
21
  /*
22
- Function checks Tag Level Access permissions - for a specific Tag.
23
 
24
  Don't call this function directly, use one of these API functions:
25
 
@@ -31,7 +31,7 @@ if (!class_exists ("c_ws_plugin__s2member_ptags_sp"))
31
  - is_tag_permitted_by_s2member($tag_id [ or slug, or tag name ]);
32
  - is_permitted_by_s2member($tag_id [ or slug, or tag name ], "tag");
33
 
34
- see: `/s2member/includes/functions/api-functions.inc.php`.
35
  */
36
  public static function check_specific_ptag_level_access ($__tag = FALSE, $check_user = TRUE)
37
  {
19
  class c_ws_plugin__s2member_ptags_sp
20
  {
21
  /*
22
+ Checks Tag Level Access permissions - for a specific Tag.
23
 
24
  Don't call this function directly, use one of these API functions:
25
 
31
  - is_tag_permitted_by_s2member($tag_id [ or slug, or tag name ]);
32
  - is_permitted_by_s2member($tag_id [ or slug, or tag name ], "tag");
33
 
34
+ See: `/s2member/includes/functions/api-functions.inc.php`.
35
  */
36
  public static function check_specific_ptag_level_access ($__tag = FALSE, $check_user = TRUE)
37
  {
includes/classes/ptags.inc.php CHANGED
@@ -19,7 +19,7 @@ if (!class_exists ("c_ws_plugin__s2member_ptags"))
19
  class c_ws_plugin__s2member_ptags
20
  {
21
  /*
22
- Function for handling Tag Level Access permissions.
23
 
24
  Don't call this function directly, use one of these API functions:
25
 
@@ -31,7 +31,7 @@ if (!class_exists ("c_ws_plugin__s2member_ptags"))
31
  - is_tag_permitted_by_s2member($tag_id [ or slug, or tag name ]);
32
  - is_permitted_by_s2member($tag_id [ or slug, or tag name ], "tag");
33
 
34
- see: `/s2member/includes/functions/api-functions.inc.php`.
35
  */
36
  public static function check_ptag_level_access ()
37
  {
19
  class c_ws_plugin__s2member_ptags
20
  {
21
  /*
22
+ Handles Tag Level Access permissions.
23
 
24
  Don't call this function directly, use one of these API functions:
25
 
31
  - is_tag_permitted_by_s2member($tag_id [ or slug, or tag name ]);
32
  - is_permitted_by_s2member($tag_id [ or slug, or tag name ], "tag");
33
 
34
+ See: `/s2member/includes/functions/api-functions.inc.php`.
35
  */
36
  public static function check_ptag_level_access ()
37
  {
includes/classes/querys.inc.php CHANGED
@@ -19,11 +19,11 @@ if (!class_exists ("c_ws_plugin__s2member_querys"))
19
  class c_ws_plugin__s2member_querys
20
  {
21
  /*
22
- This can filter all WordPress® Post/Page queries.
23
  ( based on s2Member's configuration )
24
 
25
  s2Member respects the query var: `suppress_filters`.
26
- If you need to make a query without it being filtered,
27
  $wp_query->set ("suppress_filters", true);
28
 
29
  WordPress® 3.0+ Menus set: `suppress_filters`.
@@ -38,20 +38,20 @@ if (!class_exists ("c_ws_plugin__s2member_querys"))
38
  Detach query filters:
39
  - detach_s2member_query_filters();
40
 
41
- see: `/s2member/includes/functions/api-functions.inc.php`.
42
  */
43
  public static function query_level_access (&$wp_query = FALSE, $force = FALSE)
44
  {
45
- static $initial_query = true; /* Tracks initial query filtering. */
46
  /**/
47
  eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
48
  do_action ("ws_plugin__s2member_before_query_level_access", get_defined_vars ());
49
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
50
  /**/
51
- if (($o = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["filter_wp_query"]) !== "none" || $force) /* If `none`, the ONLY way to filter is with $force. */
52
  if ($force /* Forcing this routine bypasses all of these conditions. This works with the API function `attach_s2member_query_filters()`. */
53
- || ($initial_query && preg_match ("/^(all|searches,feeds|searches)$/", $o) && is_search ()) /* Initial query; filter search results? */
54
- || ($initial_query && preg_match ("/^(all|searches,feeds|feeds)$/", $o) && is_feed ()) /* Initital query; filter feed listings? */
55
  || ($o === "all" && ! ($initial_query && is_singular ())) /* << do NOT create 404's. Allow the Security Gate to handle these. */)
56
  {
57
  if (!is_admin () && is_object ($wp_query) && !$wp_query->get ("suppress_filters")) /* These are ALWAYS requirements. */
@@ -143,7 +143,7 @@ if (!class_exists ("c_ws_plugin__s2member_querys"))
143
  return; /* For uniformity. */
144
  }
145
  /*
146
- This filters Systematics in search results & feeds.
147
 
148
  Specifically, these 3 Pages:
149
  - Membership Options
@@ -162,7 +162,7 @@ if (!class_exists ("c_ws_plugin__s2member_querys"))
162
  Detach query filters:
163
  - detach_s2member_query_filters();
164
 
165
- see: `/s2member/includes/functions/api-functions.inc.php`.
166
  */
167
  public static function _query_level_access_sys (&$wp_query = FALSE)
168
  {
@@ -196,7 +196,7 @@ if (!class_exists ("c_ws_plugin__s2member_querys"))
196
  return; /* For uniformity. */
197
  }
198
  /*
199
- Forces query filters ( on-demand ).
200
  But still respects: `suppress_filters`.
201
 
202
  s2Member respects the query var: `suppress_filters`.
@@ -211,7 +211,7 @@ if (!class_exists ("c_ws_plugin__s2member_querys"))
211
  Detach query filters:
212
  - detach_s2member_query_filters();
213
 
214
- see: `/s2member/includes/functions/api-functions.inc.php`.
215
  */
216
  public static function force_query_level_access (&$wp_query = FALSE)
217
  {
19
  class c_ws_plugin__s2member_querys
20
  {
21
  /*
22
+ This can Filter all WordPress® Post/Page queries.
23
  ( based on s2Member's configuration )
24
 
25
  s2Member respects the query var: `suppress_filters`.
26
+ If you need to make a query without it being Filtered:
27
  $wp_query->set ("suppress_filters", true);
28
 
29
  WordPress® 3.0+ Menus set: `suppress_filters`.
38
  Detach query filters:
39
  - detach_s2member_query_filters();
40
 
41
+ See: `/s2member/includes/functions/api-functions.inc.php`.
42
  */
43
  public static function query_level_access (&$wp_query = FALSE, $force = FALSE)
44
  {
45
+ static $initial_query = true; /* Tracks initial query Filtering. */
46
  /**/
47
  eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
48
  do_action ("ws_plugin__s2member_before_query_level_access", get_defined_vars ());
49
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
50
  /**/
51
+ if (($o = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["filter_wp_query"]) !== "none" || $force) /* If `none`, the ONLY way to Filter is with $force. */
52
  if ($force /* Forcing this routine bypasses all of these conditions. This works with the API function `attach_s2member_query_filters()`. */
53
+ || ($initial_query && preg_match ("/^(all|searches,feeds|searches)$/", $o) && is_search ()) /* Initial query; Filter search results? */
54
+ || ($initial_query && preg_match ("/^(all|searches,feeds|feeds)$/", $o) && is_feed ()) /* Initital query; Filter feed listings? */
55
  || ($o === "all" && ! ($initial_query && is_singular ())) /* << do NOT create 404's. Allow the Security Gate to handle these. */)
56
  {
57
  if (!is_admin () && is_object ($wp_query) && !$wp_query->get ("suppress_filters")) /* These are ALWAYS requirements. */
143
  return; /* For uniformity. */
144
  }
145
  /*
146
+ This Filters Systematics in search results & feeds.
147
 
148
  Specifically, these 3 Pages:
149
  - Membership Options
162
  Detach query filters:
163
  - detach_s2member_query_filters();
164
 
165
+ See: `/s2member/includes/functions/api-functions.inc.php`.
166
  */
167
  public static function _query_level_access_sys (&$wp_query = FALSE)
168
  {
196
  return; /* For uniformity. */
197
  }
198
  /*
199
+ Forces query Filters ( on-demand ).
200
  But still respects: `suppress_filters`.
201
 
202
  s2Member respects the query var: `suppress_filters`.
211
  Detach query filters:
212
  - detach_s2member_query_filters();
213
 
214
+ See: `/s2member/includes/functions/api-functions.inc.php`.
215
  */
216
  public static function force_query_level_access (&$wp_query = FALSE)
217
  {
includes/classes/register-access.inc.php CHANGED
@@ -53,8 +53,8 @@ if (!class_exists ("c_ws_plugin__s2member_register_access"))
53
  do_action ("ws_plugin__s2member_before_reg_access_link_via_ajax", get_defined_vars ());
54
  /**/
55
  if (current_user_can ("create_users")) /* Check priveledges as well. */
56
- if (($nonce = $_POST["ws_plugin__s2member_reg_access_link_via_ajax"]) && wp_verify_nonce ($nonce, "ws-plugin--s2member-reg-access-link-via-ajax") && ($p = c_ws_plugin__s2member_utils_strings::trim_deep (stripslashes_deep ($_POST))))
57
- echo apply_filters ("ws_plugin__s2member_reg_access_link_via_ajax", c_ws_plugin__s2member_register_access::register_link_gen ($p["s2member_reg_access_link_subscr_gateway"], $p["s2member_reg_access_link_subscr_id"], $p["s2member_reg_access_link_custom"], $p["s2member_reg_access_link_item_number"]), get_defined_vars ());
58
  /**/
59
  exit (); /* Clean exit. */
60
  }
53
  do_action ("ws_plugin__s2member_before_reg_access_link_via_ajax", get_defined_vars ());
54
  /**/
55
  if (current_user_can ("create_users")) /* Check priveledges as well. */
56
+ if (($nonce = $_POST["ws_plugin__s2member_reg_access_link_via_ajax"]) && wp_verify_nonce ($nonce, "ws-plugin--s2member-reg-access-link-via-ajax") && ($_p = c_ws_plugin__s2member_utils_strings::trim_deep (stripslashes_deep ($_POST))))
57
+ echo apply_filters ("ws_plugin__s2member_reg_access_link_via_ajax", c_ws_plugin__s2member_register_access::register_link_gen ($_p["s2member_reg_access_link_subscr_gateway"],$_p["s2member_reg_access_link_subscr_id"],$_p["s2member_reg_access_link_custom"],$_p["s2member_reg_access_link_item_number"]), get_defined_vars ());
58
  /**/
59
  exit (); /* Clean exit. */
60
  }
includes/classes/registration-times.inc.php CHANGED
@@ -19,7 +19,7 @@ if (!class_exists ("c_ws_plugin__s2member_registration_times"))
19
  class c_ws_plugin__s2member_registration_times
20
  {
21
  /*
22
- Function that synchronizes Paid Registration Times with Role assignments.
23
  Attach to: add_action("set_user_role");
24
  */
25
  public static function synchronize_paid_reg_times ($user_id = FALSE, $role = FALSE)
19
  class c_ws_plugin__s2member_registration_times
20
  {
21
  /*
22
+ Synchronizes Paid Registration Times with Role assignments.
23
  Attach to: add_action("set_user_role");
24
  */
25
  public static function synchronize_paid_reg_times ($user_id = FALSE, $role = FALSE)
includes/classes/registrations.inc.php CHANGED
@@ -134,17 +134,14 @@ if (!class_exists ("c_ws_plugin__s2member_registrations"))
134
  do_action ("ws_plugin__s2member_before_ms_activate_existing_user", get_defined_vars ());
135
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
136
  /**/
137
- if (is_array ($vars)) /* Make sure this IS an array first. */
138
- extract($vars); /* Extract all variables from `wpmu_activate_signup()` function. */
139
  /**/
140
  if (is_multisite ()) /* This event should ONLY be processed with Multisite Networking. */
141
  if (!is_admin () && ( (preg_match ("/\/wp-activate\.php/", $_SERVER["REQUEST_URI"])) || (defined ("BP_VERSION") && preg_match ("/\/" . preg_quote (BP_ACTIVATION_SLUG, "/") . "/", $_SERVER["REQUEST_URI"]))))
142
  {
143
- if ($user_id && $password && $meta && $user_already_exists && c_ws_plugin__s2member_utils_users::ms_user_login_email_exists_but_not_on_blog ($user_login, $user_email))
144
  {
145
- $role = ($meta["new_role"]) ? $meta["new_role"] : get_site_option ("default_role"); /* Role? */
146
- add_user_to_blog ($meta["add_to_blog"], $user_id, $meta["new_role"]); /* Add existing User to Blog. */
147
- /**/
148
  wp_update_user (array ("ID" => $user_id, "user_pass" => $password)); /* Update Password so it's the same as in the following msg. */
149
  wpmu_welcome_user_notification ($user_id, $password, $meta); /* Send welcome letter via email just like `wpmu_activate_signup()` does. */
150
  /**/
@@ -319,7 +316,7 @@ if (!class_exists ("c_ws_plugin__s2member_registrations"))
319
  c_ws_plugin__s2member_email_configs::email_config (); /* Configures From: header that will be used in new user notifications. */
320
  /**/
321
  if (!$processed /* Process only once. Safeguard this routine against duplicate processing via plugins ( or even WordPress® itself ). */
322
- && (is_array ($post = c_ws_plugin__s2member_utils_strings::trim_deep (stripslashes_deep ($_POST))) || is_array ($meta = c_ws_plugin__s2member_utils_strings::trim_deep (stripslashes_deep ($meta))))/**/
323
  /* These negative matches are designed to prevent this routine from running under certain conditions; where we need to wait for `wpmu_activate_user|blog` instead of processing now. */
324
  && ! (is_multisite () && c_ws_plugin__s2member_utils_conds::is_blog_admin () && $pagenow === "user-new.php" && isset ($post["noconfirmation"]) && is_super_admin () && func_num_args () !== 3)/**/
325
  && ! (preg_match ("/\/wp-activate\.php/", $_SERVER["REQUEST_URI"]) && func_num_args () !== 3) /* If activating; we MUST have a $meta arg to proceed. */
@@ -334,6 +331,8 @@ if (!class_exists ("c_ws_plugin__s2member_registrations"))
334
  $post[$key] = $value; /* Add these keys for uniformity. */
335
  unset ($key, $value); /* Prevents bleeding vars into Hooks/Filters. */
336
  /**/
 
 
337
  if (!is_admin () && ($post["ws_plugin__s2member_custom_reg_field_s2member_subscr_gateway"] || $post["ws_plugin__s2member_custom_reg_field_s2member_subscr_id"] || $post["ws_plugin__s2member_custom_reg_field_s2member_custom"] || $post["ws_plugin__s2member_custom_reg_field_s2member_ccaps"] || $post["ws_plugin__s2member_custom_reg_field_s2member_auto_eot_time"] || $post["ws_plugin__s2member_custom_reg_field_s2member_notes"]))
338
  exit ("s2Member security violation. You attempted to POST administrative variables that will NOT be trusted in a NON-administrative zone!");
339
  /**/
@@ -360,7 +359,7 @@ if (!class_exists ("c_ws_plugin__s2member_registrations"))
360
  $ip = $_SERVER["REMOTE_ADDR"];
361
  $cv = preg_split ("/\|/", $custom);
362
  /**/
363
- if ($eotper) /* If a specific EOT Period has been attached; calculate that now. */
364
  $auto_eot_time = c_ws_plugin__s2member_utils_time::auto_eot_time ("", "", "", $eotper);
365
  /**/
366
  $notes = $_pmr["ws_plugin__s2member_custom_reg_field_s2member_notes"];
134
  do_action ("ws_plugin__s2member_before_ms_activate_existing_user", get_defined_vars ());
135
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
136
  /**/
137
+ extract($vars); /* Extract all variables from `wpmu_activate_signup()` function. */
 
138
  /**/
139
  if (is_multisite ()) /* This event should ONLY be processed with Multisite Networking. */
140
  if (!is_admin () && ( (preg_match ("/\/wp-activate\.php/", $_SERVER["REQUEST_URI"])) || (defined ("BP_VERSION") && preg_match ("/\/" . preg_quote (BP_ACTIVATION_SLUG, "/") . "/", $_SERVER["REQUEST_URI"]))))
141
  {
142
+ if ($user_id && $password && $meta && $meta["add_to_blog"] && $meta["new_role"] && $user_already_exists && c_ws_plugin__s2member_utils_users::ms_user_login_email_exists_but_not_on_blog ($user_login, $user_email))
143
  {
144
+ add_user_to_blog ($meta["add_to_blog"], $user_id, $meta["new_role"]); /* Add this User to the specified Blog. */
 
 
145
  wp_update_user (array ("ID" => $user_id, "user_pass" => $password)); /* Update Password so it's the same as in the following msg. */
146
  wpmu_welcome_user_notification ($user_id, $password, $meta); /* Send welcome letter via email just like `wpmu_activate_signup()` does. */
147
  /**/
316
  c_ws_plugin__s2member_email_configs::email_config (); /* Configures From: header that will be used in new user notifications. */
317
  /**/
318
  if (!$processed /* Process only once. Safeguard this routine against duplicate processing via plugins ( or even WordPress® itself ). */
319
+ && (is_array ($post = c_ws_plugin__s2member_utils_strings::trim_deep (stripslashes_deep ($_POST))) || is_array ($meta)) /* Or a $meta array. */
320
  /* These negative matches are designed to prevent this routine from running under certain conditions; where we need to wait for `wpmu_activate_user|blog` instead of processing now. */
321
  && ! (is_multisite () && c_ws_plugin__s2member_utils_conds::is_blog_admin () && $pagenow === "user-new.php" && isset ($post["noconfirmation"]) && is_super_admin () && func_num_args () !== 3)/**/
322
  && ! (preg_match ("/\/wp-activate\.php/", $_SERVER["REQUEST_URI"]) && func_num_args () !== 3) /* If activating; we MUST have a $meta arg to proceed. */
331
  $post[$key] = $value; /* Add these keys for uniformity. */
332
  unset ($key, $value); /* Prevents bleeding vars into Hooks/Filters. */
333
  /**/
334
+ $meta = c_ws_plugin__s2member_utils_strings::trim_deep (stripslashes_deep ((array)$meta)); /* Clean up. */
335
+ /**/
336
  if (!is_admin () && ($post["ws_plugin__s2member_custom_reg_field_s2member_subscr_gateway"] || $post["ws_plugin__s2member_custom_reg_field_s2member_subscr_id"] || $post["ws_plugin__s2member_custom_reg_field_s2member_custom"] || $post["ws_plugin__s2member_custom_reg_field_s2member_ccaps"] || $post["ws_plugin__s2member_custom_reg_field_s2member_auto_eot_time"] || $post["ws_plugin__s2member_custom_reg_field_s2member_notes"]))
337
  exit ("s2Member security violation. You attempted to POST administrative variables that will NOT be trusted in a NON-administrative zone!");
338
  /**/
359
  $ip = $_SERVER["REMOTE_ADDR"];
360
  $cv = preg_split ("/\|/", $custom);
361
  /**/
362
+ if (! ($auto_eot_time = "") && $eotper) /* If a specific EOT Period has been attached. */
363
  $auto_eot_time = c_ws_plugin__s2member_utils_time::auto_eot_time ("", "", "", $eotper);
364
  /**/
365
  $notes = $_pmr["ws_plugin__s2member_custom_reg_field_s2member_notes"];
includes/classes/ruris-sp.inc.php CHANGED
@@ -19,7 +19,7 @@ if (!class_exists ("c_ws_plugin__s2member_ruris_sp"))
19
  class c_ws_plugin__s2member_ruris_sp
20
  {
21
  /*
22
- Function checks Request URI Level Access restrictions - for a specific URI/URL.
23
 
24
  Don't call this function directly, use one of these API functions:
25
 
@@ -31,7 +31,7 @@ if (!class_exists ("c_ws_plugin__s2member_ruris_sp"))
31
  - is_uri_permitted_by_s2member($uri [ or full url ]);
32
  - is_permitted_by_s2member($uri [ or full url ], "uri");
33
 
34
- see: `/s2member/includes/functions/api-functions.inc.php`.
35
  */
36
  public static function check_specific_ruri_level_access ($__uri = FALSE, $check_user = TRUE)
37
  {
19
  class c_ws_plugin__s2member_ruris_sp
20
  {
21
  /*
22
+ Checks Request URI Level Access restrictions - for a specific URI/URL.
23
 
24
  Don't call this function directly, use one of these API functions:
25
 
31
  - is_uri_permitted_by_s2member($uri [ or full url ]);
32
  - is_permitted_by_s2member($uri [ or full url ], "uri");
33
 
34
+ See: `/s2member/includes/functions/api-functions.inc.php`.
35
  */
36
  public static function check_specific_ruri_level_access ($__uri = FALSE, $check_user = TRUE)
37
  {
includes/classes/ruris.inc.php CHANGED
@@ -19,7 +19,7 @@ if (!class_exists ("c_ws_plugin__s2member_ruris"))
19
  class c_ws_plugin__s2member_ruris
20
  {
21
  /*
22
- Function for handling Request URI Level Access restrictions.
23
 
24
  Don't call this function directly, use one of these API functions:
25
 
@@ -31,7 +31,7 @@ if (!class_exists ("c_ws_plugin__s2member_ruris"))
31
  - is_uri_permitted_by_s2member($uri [ or full url ]);
32
  - is_permitted_by_s2member($uri [ or full url ], "uri");
33
 
34
- see: `/s2member/includes/functions/api-functions.inc.php`.
35
  */
36
  public static function check_ruri_level_access ()
37
  {
@@ -70,7 +70,7 @@ if (!class_exists ("c_ws_plugin__s2member_ruris"))
70
  return; /* For uniformity. */
71
  }
72
  /*
73
- Function that fills replacement code variables in URIs; collectively.
74
  */
75
  public static function fill_ruri_level_access_rc_vars ($uris = FALSE, $user = FALSE)
76
  {
@@ -78,9 +78,9 @@ if (!class_exists ("c_ws_plugin__s2member_ruris"))
78
  do_action ("ws_plugin__s2member_before_fill_ruri_level_access_rc_vars", get_defined_vars ());
79
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
80
  /**/
81
- $user = (is_object ($user)) ? $user : wp_get_current_user ();
82
- $user_login = (is_object ($user)) ? strtolower ($user->user_login) : "";
83
- $user_id = (is_object ($user)) ? (string)$user->ID : "";
84
  $user_level = (string)c_ws_plugin__s2member_user_access::user_access_level ($user);
85
  $user_role = (string)c_ws_plugin__s2member_user_access::user_access_role ($user);
86
  $user_ccaps = implode ("-", c_ws_plugin__s2member_user_access::user_access_ccaps ($user));
19
  class c_ws_plugin__s2member_ruris
20
  {
21
  /*
22
+ Handles URI Level Access restrictions.
23
 
24
  Don't call this function directly, use one of these API functions:
25
 
31
  - is_uri_permitted_by_s2member($uri [ or full url ]);
32
  - is_permitted_by_s2member($uri [ or full url ], "uri");
33
 
34
+ See: `/s2member/includes/functions/api-functions.inc.php`.
35
  */
36
  public static function check_ruri_level_access ()
37
  {
70
  return; /* For uniformity. */
71
  }
72
  /*
73
+ Fills Replacement Code variables in URIs; collectively.
74
  */
75
  public static function fill_ruri_level_access_rc_vars ($uris = FALSE, $user = FALSE)
76
  {
78
  do_action ("ws_plugin__s2member_before_fill_ruri_level_access_rc_vars", get_defined_vars ());
79
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
80
  /**/
81
+ $user = (is_object ($user) && $user->ID) ? $user : wp_get_current_user ();
82
+ $user_login = (is_object ($user) && $user->ID) ? strtolower ($user->user_login) : "";
83
+ $user_id = (is_object ($user) && $user->ID) ? (string)$user->ID : "";
84
  $user_level = (string)c_ws_plugin__s2member_user_access::user_access_level ($user);
85
  $user_role = (string)c_ws_plugin__s2member_user_access::user_access_role ($user);
86
  $user_ccaps = implode ("-", c_ws_plugin__s2member_user_access::user_access_ccaps ($user));
includes/classes/sc-gets-in.inc.php CHANGED
@@ -19,7 +19,7 @@ if (!class_exists ("c_ws_plugin__s2member_sc_gets_in"))
19
  class c_ws_plugin__s2member_sc_gets_in
20
  {
21
  /*
22
- Function that handles the Shortcode for:
23
  [s2Get constant="S2MEMBER_CURRENT_USER_DISPLAY_NAME" /]
24
  [s2Get user_field="a_custom_registration_field_id" /]
25
  [s2Get user_option="s2member_subscr_id" /]
@@ -28,14 +28,11 @@ if (!class_exists ("c_ws_plugin__s2member_sc_gets_in"))
28
  */
29
  public static function sc_get_details ($attr = FALSE, $content = FALSE, $shortcode = FALSE)
30
  {
31
- static $current_user; /* Optimizes this routine a bit. */
32
- $current_user = (!isset ($current_user)) ? wp_get_current_user () : $current_user;
33
- /**/
34
  eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
35
  do_action ("ws_plugin__s2member_before_sc_get_details", get_defined_vars ());
36
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
37
  /**/
38
- $attr = c_ws_plugin__s2member_utils_strings::trim_quot_deep ((array)$attr); /* Force array, and fix &quot;. */
39
  /**/
40
  $attr = shortcode_atts (array ("constant" => "", "user_field" => "", "user_option" => ""), $attr);
41
  /**/
@@ -49,13 +46,13 @@ if (!class_exists ("c_ws_plugin__s2member_sc_gets_in"))
49
  $get = constant ($attr["constant"]);
50
  }
51
  /**/
52
- else if ($attr["user_field"] && $current_user)
53
  $get = c_ws_plugin__s2member_utils_users::get_user_field ($attr["user_field"]);
54
  /**/
55
- else if ($attr["user_option"] && $current_user)
56
  $get = get_user_option ($attr["user_option"]);
57
  /**/
58
- return apply_filters ("ws_plugin__s2member_sc_get_details", $get, get_defined_vars ());
59
  }
60
  }
61
  }
19
  class c_ws_plugin__s2member_sc_gets_in
20
  {
21
  /*
22
+ Handles the Shortcode for:
23
  [s2Get constant="S2MEMBER_CURRENT_USER_DISPLAY_NAME" /]
24
  [s2Get user_field="a_custom_registration_field_id" /]
25
  [s2Get user_option="s2member_subscr_id" /]
28
  */
29
  public static function sc_get_details ($attr = FALSE, $content = FALSE, $shortcode = FALSE)
30
  {
 
 
 
31
  eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
32
  do_action ("ws_plugin__s2member_before_sc_get_details", get_defined_vars ());
33
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
34
  /**/
35
+ $attr = c_ws_plugin__s2member_utils_strings::trim_quot_deep ((array)$attr);
36
  /**/
37
  $attr = shortcode_atts (array ("constant" => "", "user_field" => "", "user_option" => ""), $attr);
38
  /**/
46
  $get = constant ($attr["constant"]);
47
  }
48
  /**/
49
+ else if ($attr["user_field"] && /* Logged in? */ is_user_logged_in ())
50
  $get = c_ws_plugin__s2member_utils_users::get_user_field ($attr["user_field"]);
51
  /**/
52
+ else if ($attr["user_option"] && is_user_logged_in ())
53
  $get = get_user_option ($attr["user_option"]);
54
  /**/
55
+ return apply_filters ("ws_plugin__s2member_sc_get_details",$get, get_defined_vars ());
56
  }
57
  }
58
  }
includes/classes/sc-if-conds-in.inc.php CHANGED
@@ -19,7 +19,7 @@ if (!class_exists ("c_ws_plugin__s2member_sc_if_conds_in"))
19
  class c_ws_plugin__s2member_sc_if_conds_in
20
  {
21
  /*
22
- Function that handles the Shortcode for [s2If ... simple conditionals][/s2If].
23
  - These Shortcodes are also safe to use on a Multisite Blog Farm.
24
 
25
  Attach to: add_shortcode("s2If") + _s2If, __s2If, ___s2If for nesting.
19
  class c_ws_plugin__s2member_sc_if_conds_in
20
  {
21
  /*
22
+ Handles the Shortcode for [s2If ... simple conditionals][/s2If].
23
  - These Shortcodes are also safe to use on a Multisite Blog Farm.
24
 
25
  Attach to: add_shortcode("s2If") + _s2If, __s2If, ___s2If for nesting.
includes/classes/sc-paypal-button-e.inc.php CHANGED
@@ -38,7 +38,7 @@ if (!class_exists ("c_ws_plugin__s2member_sc_paypal_button_e"))
38
  if ($cache && ($transient = "s2m_btn_" . md5 ($code . c_ws_plugin__s2member_utilities::ver_checksum ())) && ($cache = get_transient ($transient)))
39
  $code = $cache; /* Great, so we can use the cached version here to save processing time. Notice the MD5 hash uses $code and NOT $_code. */
40
  /**/
41
- else if (is_array ($inputs = c_ws_plugin__s2member_utils_forms::form_whips_2_array ($_code)) && !empty ($inputs)) /* Were we able to parse the hidden inputs variables? */
42
  {
43
  $paypal = array ("METHOD" => "BMCreateButton", "BUTTONCODE" => "ENCRYPTED", "BUTTONTYPE" => ( ($attr["sp"] || $attr["rr"] === "BN") ? "BUYNOW" : "SUBSCRIBE"));
44
  /**/
38
  if ($cache && ($transient = "s2m_btn_" . md5 ($code . c_ws_plugin__s2member_utilities::ver_checksum ())) && ($cache = get_transient ($transient)))
39
  $code = $cache; /* Great, so we can use the cached version here to save processing time. Notice the MD5 hash uses $code and NOT $_code. */
40
  /**/
41
+ else if (is_array ($inputs = c_ws_plugin__s2member_utils_forms::form_whips_2_array ($_code)) && !empty ($inputs)) /* Were we able to parse hidden input variables? */
42
  {
43
  $paypal = array ("METHOD" => "BMCreateButton", "BUTTONCODE" => "ENCRYPTED", "BUTTONTYPE" => ( ($attr["sp"] || $attr["rr"] === "BN") ? "BUYNOW" : "SUBSCRIBE"));
44
  /**/
includes/classes/sc-profile-in.inc.php CHANGED
@@ -165,7 +165,7 @@ if (!class_exists ("c_ws_plugin__s2member_sc_profile_in"))
165
  if (apply_filters ("ws_plugin__s2member_during_profile_during_fields_display_custom_fields", true, get_defined_vars ()))
166
  {
167
  if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"]) /* Now, do we have Custom Fields? */
168
- if ($fields_applicable = c_ws_plugin__s2member_custom_reg_fields::custom_fields_configured_at_level ("auto-detection"))
169
  {
170
  $fields = get_user_option ("s2member_custom_fields", $current_user->ID); /* Existing fields. */
171
  /**/
@@ -181,25 +181,22 @@ if (!class_exists ("c_ws_plugin__s2member_sc_profile_in"))
181
  /**/
182
  if (in_array ($field["id"], $fields_applicable)) /* Field applicable? */
183
  {
184
- if ($field["editable"] !== "no-invisible") /* Uneditable/invisible? */
 
 
 
 
185
  {
186
- $field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field["id"]));
187
- $field_id_class = preg_replace ("/_/", "-", $field_var);
188
- /**/
189
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
190
- if (apply_filters ("ws_plugin__s2member_during_profile_during_fields_during_custom_fields_display", true, get_defined_vars ()))
191
- {
192
- echo '<tr>' . "\n";
193
- echo '<td>' . "\n";
194
- echo '<label>' . "\n";
195
- echo '<strong' . ( (preg_match ("/^(checkbox|pre_checkbox)$/", $field["type"])) ? ' style="display:none;"' : '') . '>' . $field["label"] . ( ($field["required"] === "yes") ? ' *' : '') . '</strong>' . ( (preg_match ("/^(checkbox|pre_checkbox)$/", $field["type"])) ? '' : '<br />') . "\n";
196
- echo c_ws_plugin__s2member_custom_reg_fields::custom_field_gen ("ws_plugin__s2member_profile", $field, "ws_plugin__s2member_profile_", "ws-plugin--s2member-profile-", "", ( (preg_match ("/^(select|selects)$/", $field["type"])) ? "width:100%;" : ( (preg_match ("/^(text|textarea)$/", $field["type"])) ? "width:99%;" : "")), ($tabindex = $tabindex + 10), "", $fields, $fields[$field_var], true);
197
- echo '</label>' . "\n";
198
- echo '</td>' . "\n";
199
- echo '</tr>' . "\n";
200
- }
201
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
202
  }
 
203
  }
204
  /**/
205
  eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
165
  if (apply_filters ("ws_plugin__s2member_during_profile_during_fields_display_custom_fields", true, get_defined_vars ()))
166
  {
167
  if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"]) /* Now, do we have Custom Fields? */
168
+ if ($fields_applicable = c_ws_plugin__s2member_custom_reg_fields::custom_fields_configured_at_level ("auto-detection", "profile"))
169
  {
170
  $fields = get_user_option ("s2member_custom_fields", $current_user->ID); /* Existing fields. */
171
  /**/
181
  /**/
182
  if (in_array ($field["id"], $fields_applicable)) /* Field applicable? */
183
  {
184
+ $field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field["id"]));
185
+ $field_id_class = preg_replace ("/_/", "-", $field_var);
186
+ /**/
187
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
188
+ if (apply_filters ("ws_plugin__s2member_during_profile_during_fields_during_custom_fields_display", true, get_defined_vars ()))
189
  {
190
+ echo '<tr>' . "\n";
191
+ echo '<td>' . "\n";
192
+ echo '<label>' . "\n";
193
+ echo '<strong' . ( (preg_match ("/^(checkbox|pre_checkbox)$/", $field["type"])) ? ' style="display:none;"' : '') . '>' . $field["label"] . ( ($field["required"] === "yes") ? ' *' : '') . '</strong>' . ( (preg_match ("/^(checkbox|pre_checkbox)$/", $field["type"])) ? '' : '<br />') . "\n";
194
+ echo c_ws_plugin__s2member_custom_reg_fields::custom_field_gen ("ws_plugin__s2member_profile", $field, "ws_plugin__s2member_profile_", "ws-plugin--s2member-profile-", "", ( (preg_match ("/^(select|selects)$/", $field["type"])) ? "width:100%;" : ( (preg_match ("/^(text|textarea)$/", $field["type"])) ? "width:99%;" : "")), ($tabindex = $tabindex + 10), "", $fields,$fields[$field_var], true);
195
+ echo '</label>' . "\n";
196
+ echo '</td>' . "\n";
197
+ echo '</tr>' . "\n";
 
 
 
 
 
 
 
 
198
  }
199
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
200
  }
201
  /**/
202
  eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
includes/classes/sp-access.inc.php CHANGED
@@ -53,8 +53,8 @@ if (!class_exists ("c_ws_plugin__s2member_sp_access"))
53
  do_action ("ws_plugin__s2member_before_sp_access_link_via_ajax", get_defined_vars ());
54
  /**/
55
  if (current_user_can ("create_users")) /* Check priveledges as well. */
56
- if (($nonce = $_POST["ws_plugin__s2member_sp_access_link_via_ajax"]) && wp_verify_nonce ($nonce, "ws-plugin--s2member-sp-access-link-via-ajax") && ($p = c_ws_plugin__s2member_utils_strings::trim_deep (stripslashes_deep ($_POST))))
57
- echo apply_filters ("ws_plugin__s2member_sp_access_link_via_ajax", c_ws_plugin__s2member_sp_access::sp_access_link_gen ($p["s2member_sp_access_link_ids"], $p["s2member_sp_access_link_hours"]), get_defined_vars ());
58
  /**/
59
  exit (); /* Clean exit. */
60
  }
53
  do_action ("ws_plugin__s2member_before_sp_access_link_via_ajax", get_defined_vars ());
54
  /**/
55
  if (current_user_can ("create_users")) /* Check priveledges as well. */
56
+ if (($nonce = $_POST["ws_plugin__s2member_sp_access_link_via_ajax"]) && wp_verify_nonce ($nonce, "ws-plugin--s2member-sp-access-link-via-ajax") && ($_p = c_ws_plugin__s2member_utils_strings::trim_deep (stripslashes_deep ($_POST))))
57
+ echo apply_filters ("ws_plugin__s2member_sp_access_link_via_ajax", c_ws_plugin__s2member_sp_access::sp_access_link_gen ($_p["s2member_sp_access_link_ids"],$_p["s2member_sp_access_link_hours"]), get_defined_vars ());
58
  /**/
59
  exit (); /* Clean exit. */
60
  }
includes/classes/tracking-codes.inc.php CHANGED
@@ -19,7 +19,7 @@ if (!class_exists ("c_ws_plugin__s2member_tracking_codes"))
19
  class c_ws_plugin__s2member_tracking_codes
20
  {
21
  /*
22
- Function that displays Signup Tracking Codes.
23
  These are stored inside s2Member's Transient Queue by the IPN processor.
24
 
25
  Attach to: add_action("login_footer");
@@ -39,7 +39,7 @@ if (!class_exists ("c_ws_plugin__s2member_tracking_codes"))
39
  {
40
  if (($code = get_transient ($transient = "s2m_" . md5 ("s2member_transient_signup_tracking_codes_" . $subscr_id))))
41
  {
42
- delete_transient($transient); /* Only display this ONE time. Delete transient immediately. */
43
  /**/
44
  echo '<img src="' . esc_attr (site_url ("/?s2member_delete_signup_tracking_cookie=1")) . '" alt="." style="width:1px; height:1px; border:0;" />' . "\n";
45
  /**/
@@ -61,7 +61,7 @@ if (!class_exists ("c_ws_plugin__s2member_tracking_codes"))
61
  do_action ("ws_plugin__s2member_after_display_signup_tracking_codes", get_defined_vars ());
62
  }
63
  /*
64
- Function that displays Specific Post/Page Tracking Codes.
65
  These are stored inside s2Member's Transient Queue,
66
  by BOTH the IPN & Return-Data processors.
67
 
@@ -78,7 +78,7 @@ if (!class_exists ("c_ws_plugin__s2member_tracking_codes"))
78
  {
79
  if (($code = get_transient ($transient = "s2m_" . md5 ("s2member_transient_sp_tracking_codes_" . $txn_id))))
80
  {
81
- delete_transient($transient); /* Only display this ONE time. Delete transient immediately. */
82
  /**/
83
  echo '<img src="' . esc_attr (site_url ("/?s2member_delete_sp_tracking_cookie=1")) . '" alt="." style="width:1px; height:1px; border:0;" />' . "\n";
84
  /**/
19
  class c_ws_plugin__s2member_tracking_codes
20
  {
21
  /*
22
+ Displays Signup Tracking Codes.
23
  These are stored inside s2Member's Transient Queue by the IPN processor.
24
 
25
  Attach to: add_action("login_footer");
39
  {
40
  if (($code = get_transient ($transient = "s2m_" . md5 ("s2member_transient_signup_tracking_codes_" . $subscr_id))))
41
  {
42
+ delete_transient ($transient); /* Only display this ONE time. Delete transient immediately. */
43
  /**/
44
  echo '<img src="' . esc_attr (site_url ("/?s2member_delete_signup_tracking_cookie=1")) . '" alt="." style="width:1px; height:1px; border:0;" />' . "\n";
45
  /**/
61
  do_action ("ws_plugin__s2member_after_display_signup_tracking_codes", get_defined_vars ());
62
  }
63
  /*
64
+ Displays Specific Post/Page Tracking Codes.
65
  These are stored inside s2Member's Transient Queue,
66
  by BOTH the IPN & Return-Data processors.
67
 
78
  {
79
  if (($code = get_transient ($transient = "s2m_" . md5 ("s2member_transient_sp_tracking_codes_" . $txn_id))))
80
  {
81
+ delete_transient ($transient); /* Only display this ONE time. Delete transient immediately. */
82
  /**/
83
  echo '<img src="' . esc_attr (site_url ("/?s2member_delete_sp_tracking_cookie=1")) . '" alt="." style="width:1px; height:1px; border:0;" />' . "\n";
84
  /**/
includes/classes/user-access.inc.php CHANGED
@@ -19,91 +19,76 @@ if (!class_exists ("c_ws_plugin__s2member_user_access"))
19
  class c_ws_plugin__s2member_user_access
20
  {
21
  /*
22
- Function for determing the Access Role of a User/Member.
23
  If $user is NOT passed in, check the current User/Member.
24
  If $user IS passed in, this function will check a specific $user.
 
25
  */
26
  public static function user_access_role ($user = FALSE)
27
  {
28
- $user = (func_num_args () && is_object ($user)) ? $user : false;
29
- /**/
30
- if ((func_num_args () && !$user) || (!$user && (!is_object ($user = (is_user_logged_in ()) ? wp_get_current_user () : false) || !reset ($user->roles))))
31
  {
32
  return apply_filters ("ws_plugin__s2member_user_access_role", "", get_defined_vars ());
33
- /* Return of "", means $user was passed in but is NOT an object; or nobody is logged in, or they have to Role. */
34
  }
35
- else /* Else we return the first role in their array of assigned WordPress Roles. */
36
  return apply_filters ("ws_plugin__s2member_user_access_role", reset ($user->roles), get_defined_vars ());
37
  }
38
  /*
39
- Function for determing the Custom Capabilities of a User/Member.
40
-
41
  If $user is NOT passed in, check the current User/Member.
 
42
  Returns an array of Custom Capabilities.
43
  */
44
  public static function user_access_ccaps ($user = FALSE)
45
  {
46
- $user = (func_num_args () && is_object ($user)) ? $user : false;
47
- /**/
48
- if ((func_num_args () && !$user) || (!$user && !is_object ($user = (is_user_logged_in ()) ? wp_get_current_user () : false)))
49
  {
50
  return apply_filters ("ws_plugin__s2member_user_access_ccaps", array (), get_defined_vars ());
51
  }
52
  else /* Otherwise, we DO have the $user object available. */
53
  {
 
 
54
  foreach ($user->allcaps as $cap => $cap_enabled)
55
  if (preg_match ("/^access_s2member_ccap_/", $cap))
56
  $ccaps[] = preg_replace ("/^access_s2member_ccap_/", "", $cap);
57
  /**/
58
- return apply_filters ("ws_plugin__s2member_user_access_ccaps", (array)$ccaps, get_defined_vars ());
59
  }
60
  }
61
  /*
62
- Function for determing the Access Level of a User/Member.
63
-
64
  If $user is NOT passed in, check the current User/Member.
65
- Returns -1 thru 4, according to the User/Member's Access Level.
66
- Negative (-1) if a User/Member is NOT logged in.
67
-
68
  If $user IS passed in, this function will check a specific $user.
69
  Returns -1 thru 4, according to the User/Member's Access Level.
70
- Negative (-1) if $user is passed in, but NOT an object.
71
  */
72
  public static function user_access_level ($user = FALSE)
73
  {
74
- $user = (func_num_args () && is_object ($user)) ? $user : false;
75
- /**/
76
- if ((func_num_args () && !$user) || (!$user && !is_object ((is_user_logged_in ()) ? wp_get_current_user () : false)))
77
  {
78
- return apply_filters ("ws_plugin__s2member_user_access_level", -1, get_defined_vars ());
79
- /* Return of -1, means $user was passed in but is NOT an object; or nobody is logged in. */
80
  }
81
- else if (($user && $user->has_cap ("access_s2member_level4")) || (!$user && current_user_can ("access_s2member_level4")))
82
  {
83
  return apply_filters ("ws_plugin__s2member_user_access_level", 4, get_defined_vars ());
84
- /* The $user has; or a Member is logged in with Level 4 Access. */
85
  }
86
- else if (($user && $user->has_cap ("access_s2member_level3")) || (!$user && current_user_can ("access_s2member_level3")))
87
  {
88
  return apply_filters ("ws_plugin__s2member_user_access_level", 3, get_defined_vars ());
89
- /* The $user has; or a Member is logged in with Level 3 Access. */
90
  }
91
- else if (($user && $user->has_cap ("access_s2member_level2")) || (!$user && current_user_can ("access_s2member_level2")))
92
  {
93
  return apply_filters ("ws_plugin__s2member_user_access_level", 2, get_defined_vars ());
94
- /* The $user has; or a Member is logged in with Level 2 Access. */
95
  }
96
- else if (($user && $user->has_cap ("access_s2member_level1")) || (!$user && current_user_can ("access_s2member_level1")))
97
  {
98
  return apply_filters ("ws_plugin__s2member_user_access_level", 1, get_defined_vars ());
99
- /* The $user has; or a Member is logged in with Level 1 Access. */
100
  }
101
- else if (($user && $user->has_cap ("access_s2member_level0")) || (!$user && current_user_can ("access_s2member_level0")))
102
  {
103
  return apply_filters ("ws_plugin__s2member_user_access_level", 0, get_defined_vars ());
104
- /* The $user has; or a Free Subscriber is logged in with Level 0 Access. */
105
  }
106
- else /* Else we assume this is a User ( a Free Subscriber with a level of 0. ). */
107
  return apply_filters ("ws_plugin__s2member_user_access_level", 0, get_defined_vars ());
108
  }
109
  }
19
  class c_ws_plugin__s2member_user_access
20
  {
21
  /*
22
+ Determines the Access Role of a User/Member.
23
  If $user is NOT passed in, check the current User/Member.
24
  If $user IS passed in, this function will check a specific $user.
25
+ Returns their Role ID/code value.
26
  */
27
  public static function user_access_role ($user = FALSE)
28
  {
29
+ if ((func_num_args () && (!is_object ($user) || !$user->ID)) || (!func_num_args () && !$user && (!is_object ($user = (is_user_logged_in ()) ? wp_get_current_user () : false) || !$user->ID)))
 
 
30
  {
31
  return apply_filters ("ws_plugin__s2member_user_access_role", "", get_defined_vars ());
 
32
  }
33
+ else /* Else we return the first Role in their array of assigned WordPress® Roles. */
34
  return apply_filters ("ws_plugin__s2member_user_access_role", reset ($user->roles), get_defined_vars ());
35
  }
36
  /*
37
+ Determines Custom Capabilities of a User/Member.
 
38
  If $user is NOT passed in, check the current User/Member.
39
+ If $user IS passed in, this function will check a specific $user.
40
  Returns an array of Custom Capabilities.
41
  */
42
  public static function user_access_ccaps ($user = FALSE)
43
  {
44
+ if ((func_num_args () && (!is_object ($user) || !$user->ID)) || (!func_num_args () && !$user && (!is_object ($user = (is_user_logged_in ()) ? wp_get_current_user () : false) || !$user->ID)))
 
 
45
  {
46
  return apply_filters ("ws_plugin__s2member_user_access_ccaps", array (), get_defined_vars ());
47
  }
48
  else /* Otherwise, we DO have the $user object available. */
49
  {
50
+ $ccaps = array (); /* Initializes $ccaps array. */
51
+ /**/
52
  foreach ($user->allcaps as $cap => $cap_enabled)
53
  if (preg_match ("/^access_s2member_ccap_/", $cap))
54
  $ccaps[] = preg_replace ("/^access_s2member_ccap_/", "", $cap);
55
  /**/
56
+ return apply_filters ("ws_plugin__s2member_user_access_ccaps", $ccaps, get_defined_vars ());
57
  }
58
  }
59
  /*
60
+ Determines Access Level of a User/Member.
 
61
  If $user is NOT passed in, check the current User/Member.
 
 
 
62
  If $user IS passed in, this function will check a specific $user.
63
  Returns -1 thru 4, according to the User/Member's Access Level.
 
64
  */
65
  public static function user_access_level ($user = FALSE)
66
  {
67
+ if ((func_num_args () && (!is_object ($user) || !$user->ID)) || (!func_num_args () && !$user && (!is_object ($user = (is_user_logged_in ()) ? wp_get_current_user () : false) || !$user->ID)))
 
 
68
  {
69
+ return apply_filters ("ws_plugin__s2member_user_access_level", -1, get_defined_vars ()); /* No $user, or NOT logged in. */
 
70
  }
71
+ else if ($user->has_cap ("access_s2member_level4")) /* Testing for Membership Level #4 access. */
72
  {
73
  return apply_filters ("ws_plugin__s2member_user_access_level", 4, get_defined_vars ());
 
74
  }
75
+ else if ($user->has_cap ("access_s2member_level3")) /* Testing for Membership Level #3 access. */
76
  {
77
  return apply_filters ("ws_plugin__s2member_user_access_level", 3, get_defined_vars ());
 
78
  }
79
+ else if ($user->has_cap ("access_s2member_level2")) /* Testing for Membership Level #2 access. */
80
  {
81
  return apply_filters ("ws_plugin__s2member_user_access_level", 2, get_defined_vars ());
 
82
  }
83
+ else if ($user->has_cap ("access_s2member_level1")) /* Testing for Membership Level #1 access. */
84
  {
85
  return apply_filters ("ws_plugin__s2member_user_access_level", 1, get_defined_vars ());
 
86
  }
87
+ else if ($user->has_cap ("access_s2member_level0")) /* Testing for Membership Level #0 access. */
88
  {
89
  return apply_filters ("ws_plugin__s2member_user_access_level", 0, get_defined_vars ());
 
90
  }
91
+ else /* Else we assume this is a "User" ( a Free Subscriber with an Access Level of 0. ). */
92
  return apply_filters ("ws_plugin__s2member_user_access_level", 0, get_defined_vars ());
93
  }
94
  }
includes/classes/user-new-in.inc.php CHANGED
@@ -33,7 +33,7 @@ if (!class_exists ("c_ws_plugin__s2member_user_new_in"))
33
  /**/
34
  if (c_ws_plugin__s2member_utils_conds::is_blog_admin () && $pagenow === "user-new.php" && current_user_can ("create_users"))
35
  {
36
- $_POST = c_ws_plugin__s2member_utils_strings::trim_deep (stripslashes_deep ($_POST));
37
  /**/
38
  $unfs = '<div style="margin:25px 0 25px 0; height:1px; line-height:1px; background:#CCCCCC;"></div>' . "\n";
39
  /**/
@@ -53,7 +53,7 @@ if (!class_exists ("c_ws_plugin__s2member_user_new_in"))
53
  /**/
54
  $unfs .= '<tr>' . "\n";
55
  $unfs .= '<th><label>First Name:</label></th>' . "\n";
56
- $unfs .= '<td><input type="text" name="ws_plugin__s2member_user_new_first_name" id="ws-plugin--s2member-user-new-first-name" value="' . format_to_edit ($_POST["ws_plugin__s2member_user_new_first_name"]) . '" class="regular-text" /></td>' . "\n";
57
  $unfs .= '</tr>' . "\n";
58
  /**/
59
  eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
@@ -66,7 +66,7 @@ if (!class_exists ("c_ws_plugin__s2member_user_new_in"))
66
  /**/
67
  $unfs .= '<tr>' . "\n";
68
  $unfs .= '<th><label>Last Name:</label></th>' . "\n";
69
- $unfs .= '<td><input type="text" name="ws_plugin__s2member_user_new_last_name" id="ws-plugin--s2member-user-new-last-name" value="' . format_to_edit ($_POST["ws_plugin__s2member_user_new_last_name"]) . '" class="regular-text" /></td>' . "\n";
70
  $unfs .= '</tr>' . "\n";
71
  /**/
72
  eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
@@ -82,7 +82,7 @@ if (!class_exists ("c_ws_plugin__s2member_user_new_in"))
82
  $unfs .= '<th><label>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® TID/SID ( with an s2 prefix ), an AliPay® Trade No. ). Under normal circumstances, this is filled automatically by s2Member. This field is ONLY here for Customer Service purposes; just in case you ever need to enter a Paid Subscr. Gateway/ID manually. This field will be empty for Free Subscribers, and/or anyone who is NOT paying you.\\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® Checkout, use the TID/SID value in the sale Description; it always starts with `s2-`. 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";
83
  $unfs .= '<td><select name="ws_plugin__s2member_user_new_s2member_subscr_gateway" id="ws-plugin--s2member-user-new-s2member-subscr-gateway" style="width:27.5em;"><option value=""></option>' . "\n";
84
  foreach (apply_filters ("ws_plugin__s2member_profile_s2member_subscr_gateways", array ("paypal" => "PayPal® ( code: paypal )"), get_defined_vars ()) as $gateway => $gateway_name)
85
- $unfs .= '<option value="' . esc_attr ($gateway) . '"' . ( ($gateway === $_POST["ws_plugin__s2member_user_new_s2member_subscr_gateway"]) ? ' selected="selected"' : '') . '>' . esc_html ($gateway_name) . '</option>' . "\n";
86
  $unfs .= '</select>' . "\n";
87
  $unfs .= '</td>' . "\n";
88
  $unfs .= '</tr>' . "\n";
@@ -97,7 +97,7 @@ if (!class_exists ("c_ws_plugin__s2member_user_new_in"))
97
  /**/
98
  $unfs .= '<tr>' . "\n";
99
  $unfs .= '<th><label>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® TID/SID ( with an s2 prefix ), an AliPay® Trade No. ). Under normal circumstances, this is filled automatically by s2Member. This field is ONLY here for Customer Service purposes; just in case you ever need to enter a Paid Subscr. Gateway/ID manually. This field will be empty for Free Subscribers, and/or anyone who is NOT paying you.\\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® Checkout, use the TID/SID value in the sale Description; it always starts with `s2-`. 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";
100
- $unfs .= '<td><input type="text" name="ws_plugin__s2member_user_new_s2member_subscr_id" id="ws-plugin--s2member-user-new-s2member-subscr-id" value="' . format_to_edit ($_POST["ws_plugin__s2member_user_new_s2member_subscr_id"]) . '" class="regular-text" /></td>' . "\n";
101
  $unfs .= '</tr>' . "\n";
102
  /**/
103
  eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
@@ -110,7 +110,7 @@ if (!class_exists ("c_ws_plugin__s2member_user_new_in"))
110
  /**/
111
  $unfs .= '<tr>' . "\n";
112
  $unfs .= '<th><label>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_sq (esc_attr ($_SERVER["HTTP_HOST"])) . '\\\'\\\' 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_sq (esc_attr ($_SERVER["HTTP_HOST"])) . '|cv1|cv2|cv3\'); return false;" tabindex="-1">[?]</a></th>' . "\n";
113
- $unfs .= '<td><input type="text" name="ws_plugin__s2member_user_new_s2member_custom" id="ws-plugin--s2member-user-new-s2member-custom" value="' . format_to_edit ($_POST["ws_plugin__s2member_user_new_s2member_custom"]) . '" class="regular-text" /></td>' . "\n";
114
  $unfs .= '</tr>' . "\n";
115
  /**/
116
  eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
@@ -126,7 +126,7 @@ if (!class_exists ("c_ws_plugin__s2member_user_new_in"))
126
  /**/
127
  $unfs .= '<tr>' . "\n";
128
  $unfs .= '<th><label>Custom Capabilities:</label> <a href="#" onclick="alert(\'Optional. This is VERY advanced. For full details, see:\\ns2Member -> 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></th>' . "\n";
129
- $unfs .= '<td><input type="text" name="ws_plugin__s2member_user_new_s2member_ccaps" id="ws-plugin--s2member-user-new-s2member-ccaps" value="' . format_to_edit ($_POST["ws_plugin__s2member_user_new_s2member_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";
130
  $unfs .= '</tr>' . "\n";
131
  /**/
132
  eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
@@ -140,7 +140,7 @@ if (!class_exists ("c_ws_plugin__s2member_user_new_in"))
140
  /**/
141
  $unfs .= '<tr>' . "\n";
142
  $unfs .= '<th><label>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>( based on server time )</small>' : '') . '</th>' . "\n";
143
- $unfs .= '<td><input type="text" name="ws_plugin__s2member_user_new_s2member_auto_eot_time" id="ws-plugin--s2member-user-new-auto-eot-time" value="' . format_to_edit ($_POST["ws_plugin__s2member_user_new_s2member_auto_eot_time"]) . '" class="regular-text" /></td>' . "\n";
144
  $unfs .= '</tr>' . "\n";
145
  /**/
146
  eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
@@ -155,7 +155,7 @@ if (!class_exists ("c_ws_plugin__s2member_user_new_in"))
155
  /**/
156
  $unfs .= '<tr>' . "\n";
157
  $unfs .= '<th><label>Process List Servers:</label> <a href="#" onclick="alert(\'You have at least one List Server integrated with s2Member. Would you like to process a confirmation request for this new User? If not, just leave the box un-checked.\'); return false;" tabindex="-1">[?]</a></th>' . "\n";
158
- $unfs .= '<td><label><input type="checkbox" name="ws_plugin__s2member_user_new_opt_in" id="ws-plugin--s2member-user-new-opt-in" value="1"' . ( ($_POST["ws_plugin__s2member_user_new_opt_in"]) ? ' checked="checked"' : '') . ' /> Yes, send a mailing list confirmation email to this new User.</label></td>' . "\n";
159
  $unfs .= '</tr>' . "\n";
160
  /**/
161
  eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
@@ -189,7 +189,7 @@ if (!class_exists ("c_ws_plugin__s2member_user_new_in"))
189
  {
190
  $unfs .= '<tr>' . "\n";
191
  $unfs .= '<th><label>' . ( (preg_match ("/^(checkbox|pre_checkbox)$/", $field["type"])) ? ucwords (preg_replace ("/_/", " ", $field_var)) : $field["label"]) . ':</label></th>' . "\n";
192
- $unfs .= '<td>' . c_ws_plugin__s2member_custom_reg_fields::custom_field_gen (__FUNCTION__, $field, "ws_plugin__s2member_user_new_", "ws-plugin--s2member-user-new-", "", ( (preg_match ("/^(text|textarea|select|selects)$/", $field["type"])) ? "width:99%;" : ""), "", "", $_POST, $_POST["ws_plugin__s2member_user_new_" . $field_var]) . '</td>' . "\n";
193
  $unfs .= '</tr>' . "\n";
194
  }
195
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
@@ -216,7 +216,7 @@ if (!class_exists ("c_ws_plugin__s2member_user_new_in"))
216
  /**/
217
  $unfs .= '<tr>' . "\n";
218
  $unfs .= '<th><label>Administrative<br />Notations:</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 occassionaly, 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></th>' . "\n";
219
- $unfs .= '<td><textarea name="ws_plugin__s2member_user_new_s2member_notes" id="ws-plugin--s2member-user-new-s2member-notes" rows="5" wrap="off" spellcheck="false" style="width:99%;">' . format_to_edit ($_POST["ws_plugin__s2member_user_new_s2member_notes"]) . '</textarea></td>' . "\n";
220
  $unfs .= '</tr>' . "\n";
221
  /**/
222
  eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
33
  /**/
34
  if (c_ws_plugin__s2member_utils_conds::is_blog_admin () && $pagenow === "user-new.php" && current_user_can ("create_users"))
35
  {
36
+ $_p = c_ws_plugin__s2member_utils_strings::trim_deep (stripslashes_deep ($_POST));
37
  /**/
38
  $unfs = '<div style="margin:25px 0 25px 0; height:1px; line-height:1px; background:#CCCCCC;"></div>' . "\n";
39
  /**/
53
  /**/
54
  $unfs .= '<tr>' . "\n";
55
  $unfs .= '<th><label>First Name:</label></th>' . "\n";
56
+ $unfs .= '<td><input type="text" name="ws_plugin__s2member_user_new_first_name" id="ws-plugin--s2member-user-new-first-name" value="' . format_to_edit ($_p["ws_plugin__s2member_user_new_first_name"]) . '" class="regular-text" /></td>' . "\n";
57
  $unfs .= '</tr>' . "\n";
58
  /**/
59
  eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
66
  /**/
67
  $unfs .= '<tr>' . "\n";
68
  $unfs .= '<th><label>Last Name:</label></th>' . "\n";
69
+ $unfs .= '<td><input type="text" name="ws_plugin__s2member_user_new_last_name" id="ws-plugin--s2member-user-new-last-name" value="' . format_to_edit ($_p["ws_plugin__s2member_user_new_last_name"]) . '" class="regular-text" /></td>' . "\n";
70
  $unfs .= '</tr>' . "\n";
71
  /**/
72
  eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
82
  $unfs .= '<th><label>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® TID/SID ( with an s2 prefix ), an AliPay® Trade No. ). Under normal circumstances, this is filled automatically by s2Member. This field is ONLY here for Customer Service purposes; just in case you ever need to enter a Paid Subscr. Gateway/ID manually. This field will be empty for Free Subscribers, and/or anyone who is NOT paying you.\\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® Checkout, use the TID/SID value in the sale Description; it always starts with `s2-`. 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";
83
  $unfs .= '<td><select name="ws_plugin__s2member_user_new_s2member_subscr_gateway" id="ws-plugin--s2member-user-new-s2member-subscr-gateway" style="width:27.5em;"><option value=""></option>' . "\n";
84
  foreach (apply_filters ("ws_plugin__s2member_profile_s2member_subscr_gateways", array ("paypal" => "PayPal® ( code: paypal )"), get_defined_vars ()) as $gateway => $gateway_name)
85
+ $unfs .= '<option value="' . esc_attr ($gateway) . '"' . ( ($gateway === $_p["ws_plugin__s2member_user_new_s2member_subscr_gateway"]) ? ' selected="selected"' : '') . '>' . esc_html ($gateway_name) . '</option>' . "\n";
86
  $unfs .= '</select>' . "\n";
87
  $unfs .= '</td>' . "\n";
88
  $unfs .= '</tr>' . "\n";
97
  /**/
98
  $unfs .= '<tr>' . "\n";
99
  $unfs .= '<th><label>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® TID/SID ( with an s2 prefix ), an AliPay® Trade No. ). Under normal circumstances, this is filled automatically by s2Member. This field is ONLY here for Customer Service purposes; just in case you ever need to enter a Paid Subscr. Gateway/ID manually. This field will be empty for Free Subscribers, and/or anyone who is NOT paying you.\\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® Checkout, use the TID/SID value in the sale Description; it always starts with `s2-`. 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";
100
+ $unfs .= '<td><input type="text" name="ws_plugin__s2member_user_new_s2member_subscr_id" id="ws-plugin--s2member-user-new-s2member-subscr-id" value="' . format_to_edit ($_p["ws_plugin__s2member_user_new_s2member_subscr_id"]) . '" class="regular-text" /></td>' . "\n";
101
  $unfs .= '</tr>' . "\n";
102
  /**/
103
  eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
110
  /**/
111
  $unfs .= '<tr>' . "\n";
112
  $unfs .= '<th><label>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_sq (esc_attr ($_SERVER["HTTP_HOST"])) . '\\\'\\\' 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_sq (esc_attr ($_SERVER["HTTP_HOST"])) . '|cv1|cv2|cv3\'); return false;" tabindex="-1">[?]</a></th>' . "\n";
113
+ $unfs .= '<td><input type="text" name="ws_plugin__s2member_user_new_s2member_custom" id="ws-plugin--s2member-user-new-s2member-custom" value="' . format_to_edit ($_p["ws_plugin__s2member_user_new_s2member_custom"]) . '" class="regular-text" /></td>' . "\n";
114
  $unfs .= '</tr>' . "\n";
115
  /**/
116
  eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
126
  /**/
127
  $unfs .= '<tr>' . "\n";
128
  $unfs .= '<th><label>Custom Capabilities:</label> <a href="#" onclick="alert(\'Optional. This is VERY advanced. For full details, see:\\ns2Member -> 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></th>' . "\n";
129
+ $unfs .= '<td><input type="text" name="ws_plugin__s2member_user_new_s2member_ccaps" id="ws-plugin--s2member-user-new-s2member-ccaps" value="' . format_to_edit ($_p["ws_plugin__s2member_user_new_s2member_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";
130
  $unfs .= '</tr>' . "\n";
131
  /**/
132
  eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
140
  /**/
141
  $unfs .= '<tr>' . "\n";
142
  $unfs .= '<th><label>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>( based on server time )</small>' : '') . '</th>' . "\n";
143
+ $unfs .= '<td><input type="text" name="ws_plugin__s2member_user_new_s2member_auto_eot_time" id="ws-plugin--s2member-user-new-auto-eot-time" value="' . format_to_edit ($_p["ws_plugin__s2member_user_new_s2member_auto_eot_time"]) . '" class="regular-text" /></td>' . "\n";
144
  $unfs .= '</tr>' . "\n";
145
  /**/
146
  eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
155
  /**/
156
  $unfs .= '<tr>' . "\n";
157
  $unfs .= '<th><label>Process List Servers:</label> <a href="#" onclick="alert(\'You have at least one List Server integrated with s2Member. Would you like to process a confirmation request for this new User? If not, just leave the box un-checked.\'); return false;" tabindex="-1">[?]</a></th>' . "\n";
158
+ $unfs .= '<td><label><input type="checkbox" name="ws_plugin__s2member_user_new_opt_in" id="ws-plugin--s2member-user-new-opt-in" value="1"' . ( ($_p["ws_plugin__s2member_user_new_opt_in"]) ? ' checked="checked"' : '') . ' /> Yes, send a mailing list confirmation email to this new User.</label></td>' . "\n";
159
  $unfs .= '</tr>' . "\n";
160
  /**/
161
  eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
189
  {
190
  $unfs .= '<tr>' . "\n";
191
  $unfs .= '<th><label>' . ( (preg_match ("/^(checkbox|pre_checkbox)$/", $field["type"])) ? ucwords (preg_replace ("/_/", " ", $field_var)) : $field["label"]) . ':</label></th>' . "\n";
192
+ $unfs .= '<td>' . c_ws_plugin__s2member_custom_reg_fields::custom_field_gen (__FUNCTION__, $field, "ws_plugin__s2member_user_new_", "ws-plugin--s2member-user-new-", "", ( (preg_match ("/^(text|textarea|select|selects)$/", $field["type"])) ? "width:99%;" : ""), "", "", $_p,$_p["ws_plugin__s2member_user_new_" . $field_var]) . '</td>' . "\n";
193
  $unfs .= '</tr>' . "\n";
194
  }
195
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
216
  /**/
217
  $unfs .= '<tr>' . "\n";
218
  $unfs .= '<th><label>Administrative<br />Notations:</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 occassionaly, 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></th>' . "\n";
219
+ $unfs .= '<td><textarea name="ws_plugin__s2member_user_new_s2member_notes" id="ws-plugin--s2member-user-new-s2member-notes" rows="5" wrap="off" spellcheck="false" style="width:99%;">' . format_to_edit ($_p["ws_plugin__s2member_user_new_s2member_notes"]) . '</textarea></td>' . "\n";
220
  $unfs .= '</tr>' . "\n";
221
  /**/
222
  eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
includes/classes/user-notes.inc.php CHANGED
@@ -66,7 +66,7 @@ if (!class_exists ("c_ws_plugin__s2member_user_notes"))
66
  update_user_option ($user_id, "s2member_notes", $notes);
67
  }
68
  /**/
69
- return apply_filters ("ws_plugin__s2member_clear_user_note_lines", $notes, get_defined_vars ());
70
  }
71
  }
72
  }
66
  update_user_option ($user_id, "s2member_notes", $notes);
67
  }
68
  /**/
69
+ return apply_filters ("ws_plugin__s2member_clear_user_note_lines",$notes, get_defined_vars ());
70
  }
71
  }
72
  }
includes/classes/user-securities.inc.php CHANGED
@@ -19,6 +19,16 @@ if (!class_exists ("c_ws_plugin__s2member_user_securities"))
19
  class c_ws_plugin__s2member_user_securities
20
  {
21
  /*
 
 
 
 
 
 
 
 
 
 
22
  Alters `WP_User->has_cap()` on a Multisite Blog Farm.
23
  Attach to: add_filter("user_has_cap");
24
  */
@@ -69,11 +79,11 @@ if (!class_exists ("c_ws_plugin__s2member_user_securities"))
69
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
70
  /**/
71
  if ($show && is_multisite () && c_ws_plugin__s2member_utils_conds::is_multisite_farm ())
72
- if (!is_super_admin () && is_object ($user) && is_object ($current_user = wp_get_current_user ()))
73
  if ($user->ID !== $current_user->ID)
74
  $show = false;
75
  /**/
76
- if ($show && is_object ($user) && $user->user_login === "demo") /* Lock Password on Demos. */
77
  $show = false; /* Lock Password on Demos. */
78
  /**/
79
  return apply_filters ("ws_plugin__s2member_hide_password_fields", $show, get_defined_vars ());
19
  class c_ws_plugin__s2member_user_securities
20
  {
21
  /*
22
+ Attach to: add_action("init");
23
+ It's very important that this is NOT attached before WordPress® creates `$current_user` via `$wp->init()`.
24
+ This prevents crashes when other plugins attempt to call upon `current_user_can()` before WordPress is initialized.
25
+ For instance, some plugins attempt to use `current_user_can()` on the `plugins_loaded` Hook, which they should not do.
26
+ */
27
+ public static function initialize () /* Initializes the Filter for `user_has_cap`. */
28
+ {
29
+ add_filter ("user_has_cap", "c_ws_plugin__s2member_user_securities::ms_user_capabilities", 10, 3);
30
+ }
31
+ /*
32
  Alters `WP_User->has_cap()` on a Multisite Blog Farm.
33
  Attach to: add_filter("user_has_cap");
34
  */
79
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
80
  /**/
81
  if ($show && is_multisite () && c_ws_plugin__s2member_utils_conds::is_multisite_farm ())
82
+ if (!is_super_admin () && is_object ($user) && $user->ID && is_object ($current_user = wp_get_current_user ()) && $current_user->ID)
83
  if ($user->ID !== $current_user->ID)
84
  $show = false;
85
  /**/
86
+ if ($show && is_object ($user) && $user->ID && $user->user_login === "demo")
87
  $show = false; /* Lock Password on Demos. */
88
  /**/
89
  return apply_filters ("ws_plugin__s2member_hide_password_fields", $show, get_defined_vars ());
includes/classes/users-list-in.inc.php CHANGED
@@ -39,7 +39,7 @@ if (!class_exists ("c_ws_plugin__s2member_users_list_in"))
39
  /**/
40
  $current_user = (is_user_logged_in ()) ? wp_get_current_user () : false; /* Get the current User's object. */
41
  /**/
42
- if ($user && $user->ID && $current_user && $current_user->ID) /* Validate both of these User objects beforehand. */
43
  {
44
  $level = c_ws_plugin__s2member_user_access::user_access_level ($user); /* This User's Access Level for s2Member; needed below. */
45
  /**/
@@ -214,7 +214,7 @@ if (!class_exists ("c_ws_plugin__s2member_users_list_in"))
214
  {
215
  echo '<tr>' . "\n";
216
  echo '<th><label>' . ( (preg_match ("/^(checkbox|pre_checkbox)$/", $field["type"])) ? ucwords (preg_replace ("/_/", " ", $field_var)) : $field["label"]) . ':</label></th>' . "\n";
217
- 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]) . '</td>' . "\n";
218
  echo '</tr>' . "\n";
219
  }
220
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
@@ -261,7 +261,7 @@ if (!class_exists ("c_ws_plugin__s2member_users_list_in"))
261
  else if ($current_user->ID === $user->ID) /* Otherwise, a User can always edit their own Profile. */
262
  {
263
  if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"]) /* Only if configured. */
264
- if ($fields_applicable = c_ws_plugin__s2member_custom_reg_fields::custom_fields_configured_at_level ($level))
265
  {
266
  echo '<div style="margin:25px 0 25px 0; height:1px; line-height:1px; background:#CCCCCC;"></div>' . "\n";
267
  /**/
@@ -287,21 +287,18 @@ if (!class_exists ("c_ws_plugin__s2member_users_list_in"))
287
  /**/
288
  if (in_array ($field["id"], $fields_applicable)) /* Field applicable? */
289
  {
290
- if ($field["editable"] !== "no-invisible") /* Uneditable/invisible? */
 
 
 
 
291
  {
292
- $field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field["id"]));
293
- $field_id_class = preg_replace ("/_/", "-", $field_var);
294
- /**/
295
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
296
- if (apply_filters ("ws_plugin__s2member_during_users_list_edit_cols_during_custom_fields_display", true, get_defined_vars ()))
297
- {
298
- echo '<tr>' . "\n";
299
- echo '<th><label>' . ( (preg_match ("/^(checkbox|pre_checkbox)$/", $field["type"])) ? ucwords (preg_replace ("/_/", " ", $field_var)) : $field["label"]) . ':</label></th>' . "\n";
300
- 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], true) . '</td>' . "\n";
301
- echo '</tr>' . "\n";
302
- }
303
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
304
  }
 
305
  }
306
  /**/
307
  eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
@@ -352,7 +349,7 @@ if (!class_exists ("c_ws_plugin__s2member_users_list_in"))
352
  $user = new WP_User ($user_id); /* We need both. The $user and $current_user. */
353
  $current_user = (is_user_logged_in ()) ? wp_get_current_user () : false; /* Get the current User's object. */
354
  /**/
355
- if ($user && $user->ID && $current_user && $current_user->ID) /* Validate both of these User objects before we even begin. */
356
  {
357
  $level = c_ws_plugin__s2member_user_access::user_access_level ($user); /* This User's Access Level for s2Member. */
358
  /**/
@@ -412,7 +409,7 @@ if (!class_exists ("c_ws_plugin__s2member_users_list_in"))
412
  }
413
  /**/
414
  if ($_p["ws_plugin__s2member_profile_opt_in"]) /* Should we process List Servers for this User? */
415
- c_ws_plugin__s2member_list_servers::process_list_servers (c_ws_plugin__s2member_user_access::user_access_role ($user), c_ws_plugin__s2member_user_access::user_access_level ($user), $user->user_login, $_p["pass1"], $user->user_email, $user->first_name, $user->last_name, false, true, $user_id);
416
  /**/
417
  if ($_p["ws_plugin__s2member_profile_ip_restrictions"]) /* Delete/reset IP Restrictions? */
418
  c_ws_plugin__s2member_ip_restrictions::delete_reset_specific_ip_restrictions (strtolower ($user->user_login));
@@ -428,7 +425,7 @@ if (!class_exists ("c_ws_plugin__s2member_users_list_in"))
428
  if (is_array ($_p = c_ws_plugin__s2member_utils_strings::trim_deep (stripslashes_deep ($_POST))) && !empty ($_p))
429
  {
430
  if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"])
431
- if ($fields_applicable = c_ws_plugin__s2member_custom_reg_fields::custom_fields_configured_at_level ($level))
432
  {
433
  $_existing_fields = get_user_option ("s2member_custom_fields", $user_id);
434
  /**/
@@ -440,8 +437,7 @@ if (!class_exists ("c_ws_plugin__s2member_users_list_in"))
440
  if (!in_array ($field["id"], $fields_applicable) || preg_match ("/^no/", $field["editable"]))
441
  $fields[$field_var] = $_existing_fields[$field_var];
442
  /**/
443
- else if ($field["required"] === "yes" && empty ($_p["ws_plugin__s2member_profile_" . $field_var])/**/
444
- && $_p["ws_plugin__s2member_profile_" . $field_var] !== "0") /* Allow zeros. */
445
  $fields[$field_var] = $_existing_fields[$field_var];
446
  /**/
447
  else /* Otherwise, we can use the newly updated value. */
39
  /**/
40
  $current_user = (is_user_logged_in ()) ? wp_get_current_user () : false; /* Get the current User's object. */
41
  /**/
42
+ if (is_object ($user) && $user->ID && is_object ($current_user) && $current_user->ID) /* Validate both of these User objects. */
43
  {
44
  $level = c_ws_plugin__s2member_user_access::user_access_level ($user); /* This User's Access Level for s2Member; needed below. */
45
  /**/
214
  {
215
  echo '<tr>' . "\n";
216
  echo '<th><label>' . ( (preg_match ("/^(checkbox|pre_checkbox)$/", $field["type"])) ? ucwords (preg_replace ("/_/", " ", $field_var)) : $field["label"]) . ':</label></th>' . "\n";
217
+ 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]) . '</td>' . "\n";
218
  echo '</tr>' . "\n";
219
  }
220
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
261
  else if ($current_user->ID === $user->ID) /* Otherwise, a User can always edit their own Profile. */
262
  {
263
  if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"]) /* Only if configured. */
264
+ if ($fields_applicable = c_ws_plugin__s2member_custom_reg_fields::custom_fields_configured_at_level ($level, "profile"))
265
  {
266
  echo '<div style="margin:25px 0 25px 0; height:1px; line-height:1px; background:#CCCCCC;"></div>' . "\n";
267
  /**/
287
  /**/
288
  if (in_array ($field["id"], $fields_applicable)) /* Field applicable? */
289
  {
290
+ $field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field["id"]));
291
+ $field_id_class = preg_replace ("/_/", "-", $field_var);
292
+ /**/
293
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
294
+ if (apply_filters ("ws_plugin__s2member_during_users_list_edit_cols_during_custom_fields_display", true, get_defined_vars ()))
295
  {
296
+ echo '<tr>' . "\n";
297
+ echo '<th><label>' . ( (preg_match ("/^(checkbox|pre_checkbox)$/", $field["type"])) ? ucwords (preg_replace ("/_/", " ", $field_var)) : $field["label"]) . ':</label></th>' . "\n";
298
+ 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], true) . '</td>' . "\n";
299
+ echo '</tr>' . "\n";
 
 
 
 
 
 
 
 
300
  }
301
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
302
  }
303
  /**/
304
  eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
349
  $user = new WP_User ($user_id); /* We need both. The $user and $current_user. */
350
  $current_user = (is_user_logged_in ()) ? wp_get_current_user () : false; /* Get the current User's object. */
351
  /**/
352
+ if (is_object ($user) && $user->ID && is_object ($current_user) && $current_user->ID) /* Validate both User objects. */
353
  {
354
  $level = c_ws_plugin__s2member_user_access::user_access_level ($user); /* This User's Access Level for s2Member. */
355
  /**/
409
  }
410
  /**/
411
  if ($_p["ws_plugin__s2member_profile_opt_in"]) /* Should we process List Servers for this User? */
412
+ c_ws_plugin__s2member_list_servers::process_list_servers (c_ws_plugin__s2member_user_access::user_access_role ($user), c_ws_plugin__s2member_user_access::user_access_level ($user), $user->user_login,$_p["pass1"], $user->user_email, $user->first_name, $user->last_name, false, true, $user_id);
413
  /**/
414
  if ($_p["ws_plugin__s2member_profile_ip_restrictions"]) /* Delete/reset IP Restrictions? */
415
  c_ws_plugin__s2member_ip_restrictions::delete_reset_specific_ip_restrictions (strtolower ($user->user_login));
425
  if (is_array ($_p = c_ws_plugin__s2member_utils_strings::trim_deep (stripslashes_deep ($_POST))) && !empty ($_p))
426
  {
427
  if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"])
428
+ if ($fields_applicable = c_ws_plugin__s2member_custom_reg_fields::custom_fields_configured_at_level ($level, "profile"))
429
  {
430
  $_existing_fields = get_user_option ("s2member_custom_fields", $user_id);
431
  /**/
437
  if (!in_array ($field["id"], $fields_applicable) || preg_match ("/^no/", $field["editable"]))
438
  $fields[$field_var] = $_existing_fields[$field_var];
439
  /**/
440
+ else if ($field["required"] === "yes" && empty ($_p["ws_plugin__s2member_profile_" . $field_var]) && $_p["ws_plugin__s2member_profile_" . $field_var] !== "0")
 
441
  $fields[$field_var] = $_existing_fields[$field_var];
442
  /**/
443
  else /* Otherwise, we can use the newly updated value. */
includes/classes/users-list.inc.php CHANGED
@@ -19,7 +19,7 @@ if (!class_exists ("c_ws_plugin__s2member_users_list"))
19
  class c_ws_plugin__s2member_users_list
20
  {
21
  /*
22
- Function adds Custom Fields to the admin profile editing page.
23
 
24
  Attach to: add_action("edit_user_profile");
25
  Attach to: add_action("show_user_profile");
@@ -34,7 +34,7 @@ if (!class_exists ("c_ws_plugin__s2member_users_list"))
34
  return c_ws_plugin__s2member_users_list_in::users_list_edit_cols ($user);
35
  }
36
  /*
37
- Function that saves custom fields after an admin updates profile.
38
 
39
  Attach to: add_action("edit_user_profile_update");
40
  Attach to: add_action("personal_options_update");
@@ -49,7 +49,7 @@ if (!class_exists ("c_ws_plugin__s2member_users_list"))
49
  return c_ws_plugin__s2member_users_list_in::users_list_update_cols ($user_id);
50
  }
51
  /*
52
- Function that modifies the search query.
53
  Affects searches performed in the list of Users.
54
  Attach to: add_action("pre_user_query");
55
  */
@@ -86,7 +86,7 @@ if (!class_exists ("c_ws_plugin__s2member_users_list"))
86
  return; /* Return for uniformity. */
87
  }
88
  /*
89
- Function that modifies the search query.
90
  Affects searches performed in the list of Users.
91
  Attach to: add_action("pre_user_search");
92
 
19
  class c_ws_plugin__s2member_users_list
20
  {
21
  /*
22
+ Adds Custom Fields to the admin profile editing page.
23
 
24
  Attach to: add_action("edit_user_profile");
25
  Attach to: add_action("show_user_profile");
34
  return c_ws_plugin__s2member_users_list_in::users_list_edit_cols ($user);
35
  }
36
  /*
37
+ Saves Custom Fields after an admin updates profile.
38
 
39
  Attach to: add_action("edit_user_profile_update");
40
  Attach to: add_action("personal_options_update");
49
  return c_ws_plugin__s2member_users_list_in::users_list_update_cols ($user_id);
50
  }
51
  /*
52
+ Modifies the search query.
53
  Affects searches performed in the list of Users.
54
  Attach to: add_action("pre_user_query");
55
  */
86
  return; /* Return for uniformity. */
87
  }
88
  /*
89
+ Modifies the search query.
90
  Affects searches performed in the list of Users.
91
  Attach to: add_action("pre_user_search");
92
 
includes/classes/utils-css.inc.php CHANGED
@@ -19,7 +19,7 @@ if (!class_exists ("c_ws_plugin__s2member_utils_css"))
19
  class c_ws_plugin__s2member_utils_css
20
  {
21
  /*
22
- Functions that handles CSS compression routines.
23
  */
24
  public static function compress_css ($css = FALSE)
25
  {
19
  class c_ws_plugin__s2member_utils_css
20
  {
21
  /*
22
+ Handles CSS compression.
23
  */
24
  public static function compress_css ($css = FALSE)
25
  {
includes/classes/utils-dirs.inc.php CHANGED
@@ -19,7 +19,7 @@ if (!class_exists ("c_ws_plugin__s2member_utils_dirs"))
19
  class c_ws_plugin__s2member_utils_dirs
20
  {
21
  /*
22
- Functions that formulates basename dirs from a full directory path.
23
  - This takes Windows® \app_data sub-folders into consideration.
24
  */
25
  public static function basename_dirs ($dir_path = FALSE)
@@ -31,7 +31,7 @@ if (!class_exists ("c_ws_plugin__s2member_utils_dirs"))
31
  return basename ($dir_path) . (($app_data) ? "/app_data" : "");
32
  }
33
  /*
34
- Functions that strips a trailing \app_data sub-directory from the full path.
35
  */
36
  public static function strip_dir_app_data ($dir_path = FALSE)
37
  {
19
  class c_ws_plugin__s2member_utils_dirs
20
  {
21
  /*
22
+ Formulates basename dirs from a full directory path.
23
  - This takes Windows® \app_data sub-folders into consideration.
24
  */
25
  public static function basename_dirs ($dir_path = FALSE)
31
  return basename ($dir_path) . (($app_data) ? "/app_data" : "");
32
  }
33
  /*
34
+ Strips a trailing \app_data sub-directory from the full path.
35
  */
36
  public static function strip_dir_app_data ($dir_path = FALSE)
37
  {
includes/classes/utils-encryption.inc.php CHANGED
@@ -26,8 +26,7 @@ if (!class_exists ("c_ws_plugin__s2member_utils_encryption"))
26
  {
27
  $string = (is_string ($string)) ? $string : "";
28
  /**/
29
- $key = (!is_string ($key) || !strlen ($key)) ? /* For security. */
30
- $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sec_encryption_key"] : $key;
31
  $key = (!is_string ($key) || !strlen ($key)) ? wp_salt () : $key;
32
  /**/
33
  if (function_exists ("mcrypt_encrypt") && in_array ("rijndael-256", mcrypt_list_algorithms ()) && in_array ("cbc", mcrypt_list_modes ()))
@@ -51,14 +50,12 @@ if (!class_exists ("c_ws_plugin__s2member_utils_encryption"))
51
  {
52
  $base64 = (is_string ($base64)) ? $base64 : "";
53
  /**/
54
- $key = (!is_string ($key) || !strlen ($key)) ? /* For security. */
55
- $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sec_encryption_key"] : $key;
56
  $key = (!is_string ($key) || !strlen ($key)) ? wp_salt () : $key;
57
  /**/
58
  $encrypted = base64_decode (str_replace (array ("-", "_", "~", "."), array ("+", "/", "=", "="), $base64));
59
  /**/
60
- if (function_exists ("mcrypt_decrypt") && in_array ("rijndael-256", mcrypt_list_algorithms ()) && in_array ("cbc", mcrypt_list_modes ())/**/
61
- && preg_match ("/^~r2\:(.+?)\|/", $encrypted, $v1)) /* Check validity. */
62
  {
63
  $encrypted = preg_replace ("/^~r2\:(.+?)\|/", "", $encrypted);
64
  $key = substr ($key, 0, mcrypt_get_key_size (MCRYPT_RIJNDAEL_256, MCRYPT_MODE_CBC));
@@ -79,8 +76,7 @@ if (!class_exists ("c_ws_plugin__s2member_utils_encryption"))
79
  {
80
  $string = (is_string ($string)) ? $string : "";
81
  /**/
82
- $key = (!is_string ($key) || !strlen ($key)) ? /* For security. */
83
- $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sec_encryption_key"] : $key;
84
  $key = (!is_string ($key) || !strlen ($key)) ? wp_salt () : $key;
85
  /**/
86
  $string = (strlen ($string)) ? "~xe|" . $string : "";
@@ -103,8 +99,7 @@ if (!class_exists ("c_ws_plugin__s2member_utils_encryption"))
103
  {
104
  $base64 = (is_string ($base64)) ? $base64 : "";
105
  /**/
106
- $key = (!is_string ($key) || !strlen ($key)) ? /* For security. */
107
- $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sec_encryption_key"] : $key;
108
  $key = (!is_string ($key) || !strlen ($key)) ? wp_salt () : $key;
109
  /**/
110
  $encrypted = base64_decode (str_replace (array ("-", "_", "~", "."), array ("+", "/", "=", "="), $base64));
26
  {
27
  $string = (is_string ($string)) ? $string : "";
28
  /**/
29
+ $key = (!is_string ($key) || !strlen ($key)) ? $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sec_encryption_key"] : $key;
 
30
  $key = (!is_string ($key) || !strlen ($key)) ? wp_salt () : $key;
31
  /**/
32
  if (function_exists ("mcrypt_encrypt") && in_array ("rijndael-256", mcrypt_list_algorithms ()) && in_array ("cbc", mcrypt_list_modes ()))
50
  {
51
  $base64 = (is_string ($base64)) ? $base64 : "";
52
  /**/
53
+ $key = (!is_string ($key) || !strlen ($key)) ? $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sec_encryption_key"] : $key;
 
54
  $key = (!is_string ($key) || !strlen ($key)) ? wp_salt () : $key;
55
  /**/
56
  $encrypted = base64_decode (str_replace (array ("-", "_", "~", "."), array ("+", "/", "=", "="), $base64));
57
  /**/
58
+ if (function_exists ("mcrypt_decrypt") && in_array ("rijndael-256", mcrypt_list_algorithms ()) && in_array ("cbc", mcrypt_list_modes ()) && preg_match ("/^~r2\:(.+?)\|/", $encrypted, $v1))
 
59
  {
60
  $encrypted = preg_replace ("/^~r2\:(.+?)\|/", "", $encrypted);
61
  $key = substr ($key, 0, mcrypt_get_key_size (MCRYPT_RIJNDAEL_256, MCRYPT_MODE_CBC));
76
  {
77
  $string = (is_string ($string)) ? $string : "";
78
  /**/
79
+ $key = (!is_string ($key) || !strlen ($key)) ? $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sec_encryption_key"] : $key;
 
80
  $key = (!is_string ($key) || !strlen ($key)) ? wp_salt () : $key;
81
  /**/
82
  $string = (strlen ($string)) ? "~xe|" . $string : "";
99
  {
100
  $base64 = (is_string ($base64)) ? $base64 : "";
101
  /**/
102
+ $key = (!is_string ($key) || !strlen ($key)) ? $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sec_encryption_key"] : $key;
 
103
  $key = (!is_string ($key) || !strlen ($key)) ? wp_salt () : $key;
104
  /**/
105
  $encrypted = base64_decode (str_replace (array ("-", "_", "~", "."), array ("+", "/", "=", "="), $base64));
includes/classes/utils-gets.inc.php CHANGED
@@ -113,7 +113,7 @@ if (!class_exists ("c_ws_plugin__s2member_utils_gets"))
113
  {
114
  foreach ($results as $result) /* Now we need to check Custom Capabilities against $user. */
115
  {
116
- if (!$user) /* Optimization. Saves time when NOT even logged into the site. */
117
  $ids[] = $result->post_id; /* There's no way to satisfy anything here. */
118
  /**/
119
  else if (is_array ($ccaps = @unserialize ($result->meta_value)))
113
  {
114
  foreach ($results as $result) /* Now we need to check Custom Capabilities against $user. */
115
  {
116
+ if (!is_object ($user) || !$user->ID) /* No $user? / not logged-in?. */
117
  $ids[] = $result->post_id; /* There's no way to satisfy anything here. */
118
  /**/
119
  else if (is_array ($ccaps = @unserialize ($result->meta_value)))
includes/classes/utils-logs.inc.php CHANGED
@@ -62,10 +62,10 @@ if (!class_exists ("c_ws_plugin__s2member_utils_logs"))
62
  /**/
63
  if (!$stagger || is_float ($stagger = time () / 2)) /* Stagger this routine? */
64
  {
65
- if (is_array ($expired_s2m_transients = $wpdb->get_results ("SELECT * FROM `" . $wpdb->options . "` WHERE `option_name` LIKE '\_transient\_timeout\_s2m\_%' AND `option_value` < '" . esc_sql (time ()) . "' LIMIT 5")) && !empty ($expired_s2m_transients))
66
  {
67
- foreach ($expired_s2m_transients as $expired_s2m_transient) /* Delete the _timeout, and also the Transient entry itself. */
68
- if (($id = $expired_s2m_transient->option_id) && ($name = preg_replace ("/_timeout/i", "", $expired_s2m_transient->option_name, 1)))
69
  $wpdb->query ("DELETE FROM `" . $wpdb->options . "` WHERE `option_id` = '" . esc_sql ($id) . "' OR `option_name` = '" . esc_sql ($name) . "'");
70
  }
71
  }
62
  /**/
63
  if (!$stagger || is_float ($stagger = time () / 2)) /* Stagger this routine? */
64
  {
65
+ if (is_array ($expired_s2m_transients = $wpdb->get_results ("SELECT * FROM `" . $wpdb->options . "` WHERE `option_name` LIKE '" . esc_sql (like_escape ("_transient_timeout_s2m_")) . "%' AND `option_value` < '" . esc_sql (time ()) . "' LIMIT 5")) && !empty ($expired_s2m_transients))
66
  {
67
+ foreach ($expired_s2m_transients as $expired_s2m_transient) /* Delete the _timeout, and also the Transient entry name itself. */
68
+ if (($id = $expired_s2m_transient->option_id) && ($name = preg_replace ("/_transient_timeout_/i", "_transient_", $expired_s2m_transient->option_name, 1)))
69
  $wpdb->query ("DELETE FROM `" . $wpdb->options . "` WHERE `option_id` = '" . esc_sql ($id) . "' OR `option_name` = '" . esc_sql ($name) . "'");
70
  }
71
  }
includes/classes/utils-strings.inc.php CHANGED
@@ -43,9 +43,9 @@ if (!class_exists ("c_ws_plugin__s2member_utils_strings"))
43
  Function that sanitizes a string; by removing non-standard characters.
44
  This allows all characters that appears on a standard computer keyboard.
45
  */
46
- public static function keyboard_chars_only ($value = FALSE)
47
  {
48
- return preg_replace ("/[^0-9A-Z\r\n\t\s`\=\[\]\\\;',\.\/~\!@#\$%\^&\*\(\)_\+\|\}\{\:\"\?\>\<\-]/i", "", remove_accents ((string)$value));
49
  }
50
  /*
51
  Function that trims deeply.
@@ -82,7 +82,7 @@ if (!class_exists ("c_ws_plugin__s2member_utils_strings"))
82
  for ($i = 0, $random_str = ""; $i < $length; $i++)
83
  $random_str .= substr ($chars, mt_rand (0, strlen ($chars) - 1), 1);
84
  /**/
85
- return $random_str;
86
  }
87
  /*
88
  Functions that highlights PHP, and also Shortcodes.
43
  Function that sanitizes a string; by removing non-standard characters.
44
  This allows all characters that appears on a standard computer keyboard.
45
  */
46
+ public static function keyboard_chars_only ($string = FALSE)
47
  {
48
+ return preg_replace ("/[^0-9A-Z\r\n\t\s`\=\[\]\\\;',\.\/~\!@#\$%\^&\*\(\)_\+\|\}\{\:\"\?\>\<\-]/i", "", remove_accents ($string));
49
  }
50
  /*
51
  Function that trims deeply.
82
  for ($i = 0, $random_str = ""; $i < $length; $i++)
83
  $random_str .= substr ($chars, mt_rand (0, strlen ($chars) - 1), 1);
84
  /**/
85
+ return$random_str;
86
  }
87
  /*
88
  Functions that highlights PHP, and also Shortcodes.
includes/classes/utils-time.inc.php CHANGED
@@ -193,7 +193,7 @@ if (!class_exists ("c_ws_plugin__s2member_utils_time"))
193
  $term_cycle = $paypal_term_cycles[strtoupper (preg_replace ("/^(.+?) /", "", $term_or_period_term))];
194
  }
195
  /**/
196
- return $term_cycle; /* Return converted value. */
197
  }
198
  /*
199
  Function accepts a period, term, and recurring flag.
193
  $term_cycle = $paypal_term_cycles[strtoupper (preg_replace ("/^(.+?) /", "", $term_or_period_term))];
194
  }
195
  /**/
196
+ return$term_cycle; /* Return converted value. */
197
  }
198
  /*
199
  Function accepts a period, term, and recurring flag.
includes/classes/utils-users.inc.php CHANGED
@@ -48,6 +48,9 @@ if (!class_exists ("c_ws_plugin__s2member_utils_users"))
48
  else if (preg_match ("/^(last_name|Last Name)$/i", $field_id))
49
  return $user->last_name;
50
  /**/
 
 
 
51
  else if (preg_match ("/^(email|E-mail|Email Address|E-mail Address)$/i", $field_id))
52
  return $user->user_email;
53
  /**/
@@ -55,7 +58,7 @@ if (!class_exists ("c_ws_plugin__s2member_utils_users"))
55
  return $user->$field_id;
56
  /**/
57
  else if (is_array ($fields = get_user_option ("s2member_custom_fields", $user_id)))
58
- return $fields[preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field_id))];
59
  }
60
  /**/
61
  return false; /* Otherwise, return false. */
@@ -118,13 +121,13 @@ if (!class_exists ("c_ws_plugin__s2member_utils_users"))
118
  {
119
  if (($q = $wpdb->get_row ("SELECT `user_id` FROM `" . $wpdb->usermeta . "` WHERE `meta_key` = '" . $wpdb->prefix . "s2member_subscr_id' AND (`meta_value` = '" . $wpdb->escape ($subscr_id) . "' OR `meta_value` = '" . $wpdb->escape ($os0) . "') LIMIT 1"))/**/
120
  || ($q = $wpdb->get_row ("SELECT `ID` AS `user_id` FROM `" . $wpdb->users . "` WHERE `ID` = '" . $wpdb->escape ($os0) . "' LIMIT 1")))
121
- if (is_object ($user = new WP_User ($q->user_id)) && ($email = $user->user_email))
122
  return $email;
123
  }
124
  else if ($subscr_id) /* Otherwise, if all we have is a Subscr. ID value. */
125
  {
126
  if ($q = $wpdb->get_row ("SELECT `user_id` FROM `" . $wpdb->usermeta . "` WHERE `meta_key` = '" . $wpdb->prefix . "s2member_subscr_id' AND `meta_value` = '" . $wpdb->escape ($subscr_id) . "' LIMIT 1"))
127
- if (is_object ($user = new WP_User ($q->user_id)) && ($email = $user->user_email))
128
  return $email;
129
  }
130
  /**/
@@ -154,9 +157,7 @@ if (!class_exists ("c_ws_plugin__s2member_utils_users"))
154
  */
155
  public static function get_user_subscr_or_wp_id ($user = FALSE)
156
  {
157
- $user = (func_num_args () && is_object ($user)) ? $user : false;
158
- /**/
159
- if ((func_num_args () && !$user) || (!$user && !is_object ($user = (is_user_logged_in ()) ? wp_get_current_user () : false)))
160
  {
161
  return false; /* The $user was passed in but is NOT an object; or nobody is logged in. */
162
  }
48
  else if (preg_match ("/^(last_name|Last Name)$/i", $field_id))
49
  return $user->last_name;
50
  /**/
51
+ else if (preg_match ("/^(full_name|Full Name)$/i", $field_id))
52
+ return trim ($user->first_name . " " . $user->last_name);
53
+ /**/
54
  else if (preg_match ("/^(email|E-mail|Email Address|E-mail Address)$/i", $field_id))
55
  return $user->user_email;
56
  /**/
58
  return $user->$field_id;
59
  /**/
60
  else if (is_array ($fields = get_user_option ("s2member_custom_fields", $user_id)))
61
+ return$fields[preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field_id))];
62
  }
63
  /**/
64
  return false; /* Otherwise, return false. */
121
  {
122
  if (($q = $wpdb->get_row ("SELECT `user_id` FROM `" . $wpdb->usermeta . "` WHERE `meta_key` = '" . $wpdb->prefix . "s2member_subscr_id' AND (`meta_value` = '" . $wpdb->escape ($subscr_id) . "' OR `meta_value` = '" . $wpdb->escape ($os0) . "') LIMIT 1"))/**/
123
  || ($q = $wpdb->get_row ("SELECT `ID` AS `user_id` FROM `" . $wpdb->users . "` WHERE `ID` = '" . $wpdb->escape ($os0) . "' LIMIT 1")))
124
+ if (is_object ($user = new WP_User ($q->user_id)) && $user->ID && ($email = $user->user_email))
125
  return $email;
126
  }
127
  else if ($subscr_id) /* Otherwise, if all we have is a Subscr. ID value. */
128
  {
129
  if ($q = $wpdb->get_row ("SELECT `user_id` FROM `" . $wpdb->usermeta . "` WHERE `meta_key` = '" . $wpdb->prefix . "s2member_subscr_id' AND `meta_value` = '" . $wpdb->escape ($subscr_id) . "' LIMIT 1"))
130
+ if (is_object ($user = new WP_User ($q->user_id)) && $user->ID && ($email = $user->user_email))
131
  return $email;
132
  }
133
  /**/
157
  */
158
  public static function get_user_subscr_or_wp_id ($user = FALSE)
159
  {
160
+ if ((func_num_args () && (!is_object ($user) || !$user->ID)) || (!func_num_args () && !$user && (!is_object ($user = (is_user_logged_in ()) ? wp_get_current_user () : false) || !$user->ID)))
 
 
161
  {
162
  return false; /* The $user was passed in but is NOT an object; or nobody is logged in. */
163
  }
includes/dropins/bridges/_s2member-bbpress-bridge.php CHANGED
@@ -51,7 +51,7 @@ if (!function_exists ("ws_plugin__s2member_bridge_bbpress_roles"))
51
  {
52
  if (empty ($user->roles)) /* Only if/when no bbPress® Role is assigned. */
53
  {
54
- bb_give_user_default_role ($user); /* Assign default Role. */
55
  }
56
  }
57
  /**/
51
  {
52
  if (empty ($user->roles)) /* Only if/when no bbPress® Role is assigned. */
53
  {
54
+ bb_give_user_default_role($user); /* Assign default Role. */
55
  }
56
  }
57
  /**/
includes/functions/api-functions.inc.php CHANGED
@@ -131,7 +131,7 @@ if (!function_exists ("is_protected_by_s2member"))
131
  {
132
  global $post; /* Global reference to $post in The Loop. */
133
  /**/
134
- $__id = ($__id) ? $__id : ( (is_object ($post)) ? $post->ID : false);
135
  $__type = ($__type) ? strtolower ($__type) : "singular";
136
  /**/
137
  if ($__type === "category" && ($array = c_ws_plugin__s2member_catgs_sp::check_specific_catg_level_access ($__id, $check_user)))
@@ -166,7 +166,7 @@ if (!function_exists ("is_permitted_by_s2member"))
166
  {
167
  global $post; /* Global reference to $post in The Loop. */
168
  /**/
169
- $__id = ($__id) ? $__id : ( (is_object ($post)) ? $post->ID : false);
170
  $__type = ($__type) ? strtolower ($__type) : "singular";
171
  /**/
172
  if ($__type === "category" && c_ws_plugin__s2member_catgs_sp::check_specific_catg_level_access ($__id, true))
131
  {
132
  global $post; /* Global reference to $post in The Loop. */
133
  /**/
134
+ $__id = ($__id) ? $__id : ( (is_object ($post) && $post->ID) ? $post->ID : false);
135
  $__type = ($__type) ? strtolower ($__type) : "singular";
136
  /**/
137
  if ($__type === "category" && ($array = c_ws_plugin__s2member_catgs_sp::check_specific_catg_level_access ($__id, $check_user)))
166
  {
167
  global $post; /* Global reference to $post in The Loop. */
168
  /**/
169
+ $__id = ($__id) ? $__id : ( (is_object ($post) && $post->ID) ? $post->ID : false);
170
  $__type = ($__type) ? strtolower ($__type) : "singular";
171
  /**/
172
  if ($__type === "category" && c_ws_plugin__s2member_catgs_sp::check_specific_catg_level_access ($__id, true))
includes/hooks.inc.php CHANGED
@@ -20,7 +20,10 @@ add_action ("pre_get_posts", /* WP Query. */
20
  "c_ws_plugin__s2member_security::security_gate_query", 20);
21
  /* Priority matches `/api-functions.inc.php`.
22
  /**/
 
 
23
  add_action ("init", "c_ws_plugin__s2member_nocache::nocache", 1);
 
24
  add_action ("init", "c_ws_plugin__s2member_profile::profile", 1);
25
  add_action ("init", "c_ws_plugin__s2member_register::register", 1);
26
  add_action ("init", "c_ws_plugin__s2member_paypal_return::paypal_return", 1);
@@ -59,7 +62,6 @@ add_action ("wpmu_delete_user", "c_ws_plugin__s2member_user_deletions::handle_ms
59
  add_action ("remove_user_from_blog", "c_ws_plugin__s2member_user_deletions::handle_ms_user_deletions", 10, 2);
60
  /**/
61
  add_filter ("enable_edit_any_user_configuration", "c_ws_plugin__s2member_user_securities::ms_allow_edits");
62
- add_filter ("user_has_cap", "c_ws_plugin__s2member_user_securities::ms_user_capabilities", 10, 3);
63
  /**/
64
  add_filter ("pre_option_default_role", "c_ws_plugin__s2member_option_forces::force_default_role");
65
  add_filter ("pre_site_option_default_user_role", "c_ws_plugin__s2member_option_forces::force_mms_default_role");
20
  "c_ws_plugin__s2member_security::security_gate_query", 20);
21
  /* Priority matches `/api-functions.inc.php`.
22
  /**/
23
+ add_action ("init", "c_ws_plugin__s2member_user_securities::initialize", 1);
24
+ /**/
25
  add_action ("init", "c_ws_plugin__s2member_nocache::nocache", 1);
26
+ /**/
27
  add_action ("init", "c_ws_plugin__s2member_profile::profile", 1);
28
  add_action ("init", "c_ws_plugin__s2member_register::register", 1);
29
  add_action ("init", "c_ws_plugin__s2member_paypal_return::paypal_return", 1);
62
  add_action ("remove_user_from_blog", "c_ws_plugin__s2member_user_deletions::handle_ms_user_deletions", 10, 2);
63
  /**/
64
  add_filter ("enable_edit_any_user_configuration", "c_ws_plugin__s2member_user_securities::ms_allow_edits");
 
65
  /**/
66
  add_filter ("pre_option_default_role", "c_ws_plugin__s2member_option_forces::force_default_role");
67
  add_filter ("pre_site_option_default_user_role", "c_ws_plugin__s2member_option_forces::force_mms_default_role");
includes/menu-pages/menu-pages-s-min.js CHANGED
@@ -1 +1 @@
1
- jQuery(document).ready(function(b){var a=esc_html=function(c){return String(c).replace(/"/g,"&quot;").replace(/\</g,"&lt;").replace(/\>/g,"&gt;")};if(location.href.match(/page\=ws-plugin--s2member-mms-options/)){b("select#ws-plugin--s2member-mms-registration-file").change(function(){if(b(this).val()==="wp-signup"){b("div#ws-plugin--s2member-mms-registration-support-package-details-wrapper").show(),b("div.ws-plugin--s2member-mms-registration-wp-login, table.ws-plugin--s2member-mms-registration-wp-login").hide(),b("div.ws-plugin--s2member-mms-registration-wp-signup, table.ws-plugin--s2member-mms-registration-wp-signup").show();b("div.ws-plugin--s2member-mms-registration-wp-signup-blogs-level0, table.ws-plugin--s2member-mms-registration-wp-signup-blogs-level0")[((b("select#ws-plugin--s2member-mms-registration-grants").val()==="all")?"show":"hide")](),b("input#ws-plugin--s2member-mms-registration-blogs-level0").val(((b("select#ws-plugin--s2member-mms-registration-grants").val()==="all")?"1":"0"))}else{if(b(this).val()==="wp-login"){b("div#ws-plugin--s2member-mms-registration-support-package-details-wrapper").hide(),b("div.ws-plugin--s2member-mms-registration-wp-login, table.ws-plugin--s2member-mms-registration-wp-login").show(),b("div.ws-plugin--s2member-mms-registration-wp-signup, table.ws-plugin--s2member-mms-registration-wp-signup").hide(),b("input#ws-plugin--s2member-mms-registration-blogs-level0").val("0")}}}).trigger("change");b("select#ws-plugin--s2member-mms-registration-grants").change(function(){b("select#ws-plugin--s2member-mms-registration-file").trigger("change")})}else{if(location.href.match(/page\=ws-plugin--s2member-bridges/)){b("select#ws-plugin--s2member-bbpress-ovg").change(function(){if(b(this).val()==="0"){b("span#ws-plugin--s2member-bbpress-ovg-off-note").css("display","inline");var c='form#ws-plugin--s2member-bridge-bbpress-form label[for="ws_plugin--s2member-bridge-bbpress-min-level"]';b(c).text(b(c).text().replace(/to (read\/)?participate/i,"to read/participate")),b("select#ws-plugin--s2member-bbpress-min-level option").each(function(){b(this).text(b(this).text().replace(/\( to( read and)? participate \)/i,"( to read and participate )"))})}else{if(b(this).val()==="1"){b("span#ws-plugin--s2member-bbpress-ovg-off-note").css("display","none");var c='form#ws-plugin--s2member-bridge-bbpress-form label[for="ws_plugin--s2member-bridge-bbpress-min-level"]';b(c).text(b(c).text().replace(/to (read\/)?participate/i,"to participate")),b("select#ws-plugin--s2member-bbpress-min-level option").each(function(){b(this).text(b(this).text().replace(/\( to( read and)? participate \)/i,"( to participate )"))})}}}).trigger("change")}else{if(location.href.match(/page\=ws-plugin--s2member-options/)){ws_plugin__s2member_generateSecurityKey=function(){var f=function(h,g){h=(arguments.length<1)?0:h;g=(arguments.length<2)?2147483647:g;return Math.floor(Math.random()*(g-h+1))+h};var e="ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()";for(var d=0,c="";d<56;d++){c+=e.substr(f(0,e.length-1),1)}b("input#ws-plugin--s2member-sec-encryption-key").val(c);return false};ws_plugin__s2member_enableSecurityKey=function(){if(confirm("Edit Key? Are you sure?\nThis could break your installation!\n\n*Note* If you've been testing s2Member, feel free to change this Key before you go live. Just don't go live, and then change it. You'll have some very unhappy Customers. Data corruption WILL occur!\n\nFor your safety, s2Member keeps a history of the last 10 Keys that you've used. If you get yourself into a real situation, s2Member will let you revert back to a previous Key.")){b("input#ws-plugin--s2member-sec-encryption-key").attr("disabled",false)}return false};ws_plugin__s2member_securityKeyHistory=function(){b("div#ws-plugin--s2member-sec-encryption-key-history").toggle();return false};if(b("input#ws-plugin--s2member-custom-reg-fields").length&&b("div#ws-plugin--s2member-custom-reg-field-configuration").length){(function(){var c=b("input#ws-plugin--s2member-custom-reg-fields");var f=b("div#ws-plugin--s2member-custom-reg-field-configuration");var l=(c.val())?b.JSON.parse(c.val()):[];l=(l instanceof Array)?l:[];var k='<div id="ws-plugin--s2member-custom-reg-field-configuration-tools"></div>';var r='<table id="ws-plugin--s2member-custom-reg-field-configuration-table"></table>';f.html(k+r);var i=b("div#ws-plugin--s2member-custom-reg-field-configuration-tools");var o=b("table#ws-plugin--s2member-custom-reg-field-configuration-table");ws_plugin__s2member_customRegFieldTypeChange=function(t){var s,v,u=b(t).val();s="tr.ws-plugin--s2member-custom-reg-field-configuration-tools-form-options";v="tr.ws-plugin--s2member-custom-reg-field-configuration-tools-form-expected";if(u.match(/^(text|textarea|checkbox|pre_checkbox)$/)){b(s).css("display","none"),b(s).prev("tr").css("display","none")}else{b(s).css("display",""),b(s).prev("tr").css("display","")}if(u.match(/^(select|selects|checkboxes|radios)$/)){b(v).css("display","none"),b(v).prev("tr").css("display","none")}else{b(v).css("display",""),b(v).prev("tr").css("display","")}};ws_plugin__s2member_customRegFieldDelete=function(t){var s=new Array();for(var u=0;u<l.length;u++){if(u!==t){s.push(l[u])}}l=s,q(),p()};ws_plugin__s2member_customRegFieldMoveUp=function(u){if(typeof l[u]==="object"&&typeof l[u-1]==="object"){var t=l[u-1],s=l[u];l[u-1]=s,l[u]=t;q(),p()}};ws_plugin__s2member_customRegFieldMoveDown=function(u){if(typeof l[u]==="object"&&typeof l[u+1]==="object"){var s=l[u+1],t=l[u];l[u+1]=t,l[u]=s;q(),p()}};ws_plugin__s2member_customRegFieldCreate=function(){var s=b("table#ws-plugin--s2member-custom-reg-field-configuration-tools-form"),t={};b(":input[property]",s).each(function(){var v=b(this),u=v.attr("property"),w=b.trim(v.val());t[u]=w});if((t=d(t))){l.push(t),q(),j(),p(),n();setTimeout(function(){var u="tr.ws-plugin--s2member-custom-reg-field-configuration-table-row-"+(l.length-1);alert('Field created successfully.\n* Remember to "Save Changes".');b(u).effect("highlight",1000)},500)}};ws_plugin__s2member_customRegFieldUpdate=function(t){var s=b("table#ws-plugin--s2member-custom-reg-field-configuration-tools-form"),u={};b(":input[property]",s).each(function(){var x=b(this),w=x.attr("property"),y=b.trim(x.val());u[w]=y});if((u=d(u,t))){l[t]=u,q(),j(),p(),n();var v="tr.ws-plugin--s2member-custom-reg-field-configuration-table-row-"+t;b(v).effect("highlight",1000)}};ws_plugin__s2member_customRegFieldAdd=function(){j(true)};ws_plugin__s2member_customRegFieldEdit=function(s){j(false,s),n()};ws_plugin__s2member_customRegFieldCancel=function(){j(),n()};var d=function(w,u){var s=(typeof u==="number"&&typeof l[u]==="object")?true:false,x=[],t,v;if(typeof w!=="object"){x.push("Invalid field object. Please try again.")}else{if(!w.id){x.push("Unique Field ID:\nThis is required. Please try again.")}else{if(h(w.id)&&(!s||w.id!==l[u].id)){x.push("Unique Field ID:\nThat Field ID already exists. Please try again.")}}if(!w.label){x.push("Field Label/Description:\nThis is required. Please try again.")}if(w.type.match(/^(select|selects|checkboxes|radios)$/)){w.expected="";if(!w.options){x.push("Option Configuration File:\nThis is required. Please try again.")}else{t=w.options.split(/[\r\n]+/);for(v=0;v<t.length;v++){t[v]=b.trim(t[v]);if(!t[v].match(/^([^\|]*)(\|)([^\|]*)(\|default)?$/)){x.push("Option Configuration File:\nInvalid configuration at line #"+(v+1)+".");break}}w.options=b.trim(t.join("\n"))}}else{w.options=""}if(!(w.levels=w.levels.replace(/ /g,""))){x.push("Applicable Levels:\nThis is required. Please try again.")}else{if(!w.levels.match(/^(all|[0-9,]+)$/)){x.push("Applicable Levels:\nShould be comma-delimited Levels, or just type: all.\n( examples: 0,1,2,3,4 or type the word: all )")}}if(w.classes&&w.classes.match(/[^a-z 0-9 _ \-]/i)){x.push("CSS Classes:\nContains invalid characters. Please try again.\n( only: alphanumerics, underscores, hyphens, spaces )")}if(w.styles&&w.styles.match(/["\=\>\<]/)){x.push('CSS Styles:\nContains invalid characters. Please try again.\n( do NOT use these characters: = " < > )')}if(w.attrs&&w.attrs.match(/[\>\<]/)){x.push("Other Attributes:\nContains invalid characters. Please try again.\n( do NOT use these characters: < > )")}}if(x.length>0){alert(x.join("\n\n"));return false}else{return w}};var q=function(){c.val(((l.length>0)?b.JSON.stringify(l):""))};var m=function(s){return(typeof s==="string")?b.trim(s).toLowerCase().replace(/[^a-z0-9]/g,"_"):""};var g=function(t){var s={text:"Text ( single line )",textarea:"Textarea ( multi-line )",select:"Select Menu ( drop-down )",selects:"Select Menu ( multi-option )",checkbox:"Checkbox ( single )",pre_checkbox:"Checkbox ( pre-checked )",checkboxes:"Checkboxes ( multi-option )",radios:"Radio Buttons ( multi-option )"};if(typeof s[t]==="string"){return s[t]}return""};var h=function(s){for(var t=0;t<l.length;t++){if(l[t].id===s){return true}}};var n=function(){scrollTo(0,b("div.ws-plugin--s2member-custom-reg-fields-section").offset()["top"]-100)};var j=function(s,A){var x=0,z="",t="",D=0,y=0,v={id:"",label:"",type:"text",options:"",expected:"",required:"yes",levels:"all",editable:"yes",classes:"",styles:"",attrs:""};var u=(typeof A==="number"&&typeof l[A]==="object")?true:false,C=(s||u)?true:false,B=(u)?l[A]:v;z+='<a href="#" onclick="ws_plugin__s2member_customRegFieldAdd(); return false;">Add New Field</a>';tb_remove(),b("div#ws-plugin--s2member-custom-reg-field-configuration-thickbox-tools-form").remove();if(C){t+='<div id="ws-plugin--s2member-custom-reg-field-configuration-thickbox-tools-form">';t+='<table id="ws-plugin--s2member-custom-reg-field-configuration-tools-form">';t+="<tbody>";t+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-type">';t+='<td colspan="2">';t+='<label for="ws-plugin--s2member-custom-reg-field-configuration-tools-form-type">Form Field Type: *</label>';t+="</td>";t+="</tr>";t+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-type">';t+='<td colspan="2">';t+='<select property="type" onchange="ws_plugin__s2member_customRegFieldTypeChange(this);" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-type">';t+='<option value="text"'+((B.type==="text")?' selected="selected"':"")+'">'+esc_html(g("text"))+"</option>";t+='<option value="textarea"'+((B.type==="textarea")?' selected="selected"':"")+'">'+esc_html(g("textarea"))+"</option>";t+='<option value="select"'+((B.type==="select")?' selected="selected"':"")+'">'+esc_html(g("select"))+"</option>";t+='<option value="selects"'+((B.type==="selects")?' selected="selected"':"")+'">'+esc_html(g("selects"))+"</option>";t+='<option value="checkbox"'+((B.type==="checkbox")?' selected="selected"':"")+'">'+esc_html(g("checkbox"))+"</option>";t+='<option value="pre_checkbox"'+((B.type==="pre_checkbox")?' selected="selected"':"")+'">'+esc_html(g("pre_checkbox"))+"</option>";t+='<option value="checkboxes"'+((B.type==="checkboxes")?' selected="selected"':"")+'">'+esc_html(g("checkboxes"))+"</option>";t+='<option value="radios"'+((B.type==="radios")?' selected="selected"':"")+'">'+esc_html(g("radios"))+"</option>";t+="</select>";t+="</td>";t+="</tr>";t+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-spacer"><td colspan="2">&nbsp;</td></tr>';t+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-label">';t+='<td colspan="2">';t+='<label for="ws-plugin--s2member-custom-reg-field-configuration-tools-form-label">Field Label/Desc: *</label>';t+="</td>";t+="</tr>";t+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-label">';t+='<td colspan="2">';t+='<input type="text" property="label" value="'+a(B.label)+'" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-label" /><br />';t+="<small>Examples: <code>Choose Country</code>, <code>Street Address</code></small>";t+="</td>";t+="</tr>";t+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-spacer"><td colspan="2">&nbsp;</td></tr>';t+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-id">';t+='<td colspan="2">';t+='<label for="ws-plugin--s2member-custom-reg-field-configuration-tools-form-id">Unique Field ID: *</label></label>';t+="</td>";t+="</tr>";t+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-id">';t+='<td colspan="2">';t+='<input type="text" property="id" value="'+a(B.id)+'" maxlength="25" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-id" /><br />';t+="<small>Examples: <code>country_code</code>, <code>street_address</code></small><br />";t+='<small>e.g. <code>[s2Get user_field="country_code" /]</code></small>';t+="</td>";t+="</tr>";t+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-spacer"><td colspan="2">&nbsp;</td></tr>';t+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-required">';t+='<td colspan="2">';t+='<label for="ws-plugin--s2member-custom-reg-field-configuration-tools-form-required">Field Required: *</label>';t+="</td>";t+="</tr>";t+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-required">';t+='<td colspan="2">';t+='<select property="required" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-required">';t+='<option value="yes"'+((B.required==="yes")?' selected="selected"':"")+'">Yes ( required )</option>';t+='<option value="no"'+((B.required==="no")?' selected="selected"':"")+'">No ( optional )</option>';t+="</select><br />";t+='<small>If <code>yes</code>, only Users/Members will be "required" to enter this field.</small><br />';t+="<small>* Administrators are exempt from this requirement.</small>";t+="</td>";t+="</tr>";t+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-spacer"'+((B.type.match(/^(text|textarea|checkbox|pre_checkbox)$/))?' style="display:none;"':"")+'><td colspan="2">&nbsp;</td></tr>';t+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-options"'+((B.type.match(/^(text|textarea|checkbox|pre_checkbox)$/))?' style="display:none;"':"")+">";t+='<td colspan="2">';t+='<label for="ws-plugin--s2member-custom-reg-field-configuration-tools-form-options">Option Configuration File: * ( one option per line )</label><br />';t+="<small>Use a pipe <code>|</code> delimited format: <code>option value|option label</code></small>";t+="</td>";t+="</tr>";t+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-options"'+((B.type.match(/^(text|textarea|checkbox|pre_checkbox)$/))?' style="display:none;"':"")+">";t+='<td colspan="2">';t+='<textarea property="options" rows="3" wrap="off" spellcheck="false" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-options">'+esc_html(B.options)+"</textarea><br />";t+="Here is a quick example:<br />";t+="<small>You can also specify a <em>default</em> option:</small><br />";t+="<code>US|United States|default</code><br />";t+="<code>CA|Canada</code><br />";t+="<code>VI|Virgin Islands (U.S.)</code>";t+="</td>";t+="</tr>";t+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-spacer"'+((B.type.match(/^(select|selects|checkboxes|radios)$/))?' style="display:none;"':"")+'><td colspan="2">&nbsp;</td></tr>';t+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-expected"'+((B.type.match(/^(select|selects|checkboxes|radios)$/))?' style="display:none;"':"")+">";t+='<td colspan="2">';t+='<label for="ws-plugin--s2member-custom-reg-field-configuration-tools-form-expected">Expected Format: *</label>';t+="</td>";t+="</tr>";t+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-expected"'+((B.type.match(/^(select|selects|checkboxes|radios)$/))?' style="display:none;"':"")+">";t+='<td colspan="2">';t+='<select property="expected" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-expected">';t+='<option value=""'+((B.expected==="")?' selected="selected"':"")+'">Anything Goes</option>';t+='<option disabled="disabled"></option>';t+='<optgroup label="Specific Input Types">';t+='<option value="numeric-wp-commas"'+((B.expected==="numeric-wp-commas")?' selected="selected"':"")+'">Numeric ( with or without decimals, commas allowed )</option>';t+='<option value="numeric"'+((B.expected==="numeric")?' selected="selected"':"")+'">Numeric ( with or without decimals, no commas )</option>';t+='<option value="integer"'+((B.expected==="integer")?' selected="selected"':"")+'">Integer ( whole number, without any decimals )</option>';t+='<option value="integer-gt-0"'+((B.expected==="integer-gt-0")?' selected="selected"':"")+'">Integer > 0 ( whole number, no decimals, greater than 0 )</option>';t+='<option value="float"'+((B.expected==="float")?' selected="selected"':"")+'">Float ( floating point number, decimals required )</option>';t+='<option value="float-gt-0"'+((B.expected==="float-gt-0")?' selected="selected"':"")+'">Float > 0 ( floating point number, decimals required, greater than 0 )</option>';t+='<option value="date"'+((B.expected==="date")?' selected="selected"':"")+'">Date ( required date format: dd/mm/yyyy )</option>';t+='<option value="email"'+((B.expected==="email")?' selected="selected"':"")+'">Email ( require valid email )</option>';t+='<option value="url"'+((B.expected==="url")?' selected="selected"':"")+'">Full URL ( starting with http or https )</option>';t+='<option value="domain"'+((B.expected==="domain")?' selected="selected"':"")+'">Domain Name ( domain name only, without http )</option>';t+='<option value="phone"'+((B.expected==="phone")?' selected="selected"':"")+'">Phone # ( 10 digits w/possible hyphens,spaces,brackets )</option>';t+='<option value="uszip"'+((B.expected==="uszip")?' selected="selected"':"")+'">US Zipcode ( 5-9 digits w/possible hyphen )</option>';t+='<option value="cazip"'+((B.expected==="cazip")?' selected="selected"':"")+'">Canadian Zipcode ( 6 alpha-numerics w/possible space )</option>';t+='<option value="uczip"'+((B.expected==="uczip")?' selected="selected"':"")+'">US/Canadian Zipcode ( either a US or Canadian zipcode )</option>';t+="</optgroup>";t+='<option disabled="disabled"></option>';t+='<optgroup label="Any Character Combination">';for(x=1;x<=25;x++){t+='<option value="any-'+x+'"'+((B.expected==="any-"+x)?' selected="selected"':"")+'">Any Character Combination ( '+x+" character minimum )</option>";t+='<option value="any-'+x+'-e"'+((B.expected==="any-"+x+"-e")?' selected="selected"':"")+'">Any Character Combination ( exactly '+x+" character"+((x>1)?"s":"")+" )</option>"}t+="</optgroup>";t+='<option disabled="disabled"></option>';t+='<optgroup label="Alphanumerics, Spaces &amp; Punctuation Only">';for(x=1;x<=25;x++){t+='<option value="alphanumerics-spaces-punctuation-'+x+'"'+((B.expected==="alphanumerics-spaces-punctuation-"+x)?' selected="selected"':"")+'">Alphanumerics, Spaces &amp; Punctuation ( '+x+" character minimum )</option>";t+='<option value="alphanumerics-spaces-punctuation-'+x+'-e"'+((B.expected==="alphanumerics-spaces-punctuation-"+x+"-e")?' selected="selected"':"")+'">Alphanumerics, Spaces &amp; Punctuation ( exactly '+x+" character"+((x>1)?"s":"")+" )</option>"}t+="</optgroup>";t+='<option disabled="disabled"></option>';t+='<optgroup label="Alphanumerics &amp; Spaces Only">';for(x=1;x<=25;x++){t+='<option value="alphanumerics-spaces-'+x+'"'+((B.expected==="alphanumerics-spaces-"+x)?' selected="selected"':"")+'">Alphanumerics &amp; Spaces ( '+x+" character minimum )</option>";t+='<option value="alphanumerics-spaces-'+x+'-e"'+((B.expected==="alphanumerics-spaces-"+x+"-e")?' selected="selected"':"")+'">Alphanumerics &amp; Spaces ( exactly '+x+" character"+((x>1)?"s":"")+" )</option>"}t+="</optgroup>";t+='<option disabled="disabled"></option>';t+='<optgroup label="Alphanumerics &amp; Punctuation Only">';for(x=1;x<=25;x++){t+='<option value="alphanumerics-punctuation-'+x+'"'+((B.expected==="alphanumerics-punctuation-"+x)?' selected="selected"':"")+'">Alphanumerics &amp; Punctuation ( '+x+" character minimum )</option>";t+='<option value="alphanumerics-punctuation-'+x+'-e"'+((B.expected==="alphanumerics-punctuation-"+x+"-e")?' selected="selected"':"")+'">Alphanumerics &amp; Punctuation ( exactly '+x+" character"+((x>1)?"s":"")+" )</option>"}t+="</optgroup>";t+='<option disabled="disabled"></option>';t+='<optgroup label="Alphanumerics Only">';for(x=1;x<=25;x++){t+='<option value="alphanumerics-'+x+'"'+((B.expected==="alphanumerics-"+x)?' selected="selected"':"")+'">Alphanumerics ( '+x+" character minimum )</option>";t+='<option value="alphanumerics-'+x+'-e"'+((B.expected==="alphanumerics-"+x+"-e")?' selected="selected"':"")+'">Alphanumerics ( exactly '+x+" character"+((x>1)?"s":"")+" )</option>"}t+="</optgroup>";t+='<option disabled="disabled"></option>';t+='<optgroup label="Alphabetics Only">';for(x=1;x<=25;x++){t+='<option value="alphabetics-'+x+'"'+((B.expected==="alphabetics-"+x)?' selected="selected"':"")+'">Alphabetics ( '+x+" character minimum )</option>";t+='<option value="alphabetics-'+x+'-e"'+((B.expected==="alphabetics-"+x+"-e")?' selected="selected"':"")+'">Alphabetics ( exactly '+x+" character"+((x>1)?"s":"")+" )</option>"}t+="</optgroup>";t+='<option disabled="disabled"></option>';t+='<optgroup label="Numeric Digits Only">';for(x=1;x<=25;x++){t+='<option value="numerics-'+x+'"'+((B.expected==="numerics-"+x)?' selected="selected"':"")+'">Numeric Digits ( '+x+" digit minimum )</option>";t+='<option value="numerics-'+x+'-e"'+((B.expected==="numerics-"+x+"-e")?' selected="selected"':"")+'">Numeric Digits ( exactly '+x+" digit"+((x>1)?"s":"")+" )</option>"}t+="</optgroup>";t+="</select><br />";t+="<small>Only Users/Members will be required to meet this criteria.</small><br />";t+="<small>* Administrators are exempt from this.</small>";t+="</td>";t+="</tr>";t+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-spacer"><td colspan="2">&nbsp;</td></tr>';t+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-levels">';t+='<td colspan="2">';t+='<label for="ws-plugin--s2member-custom-reg-field-configuration-tools-form-levels">Applicable Membership Levels: *</label>';t+="</td>";t+="</tr>";t+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-levels">';t+='<td colspan="2">';t+='<input type="text" property="levels" value="'+a(B.levels)+'" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-levels" /><br />';t+="<small>Please use comma-delimited Level #'s: <code>0,1,2,3,4</code> or type: <code>all</code>.</small><br />";t+="<small>This allows you to enable this field - only at specific Membership Levels.</small>";t+="</td>";t+="</tr>";t+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-spacer"><td colspan="2">&nbsp;</td></tr>';t+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-editable">';t+='<td colspan="2">';t+='<label for="ws-plugin--s2member-custom-reg-field-configuration-tools-form-editable">Allow Profile Edits: *</label>';t+="</td>";t+="</tr>";t+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-editable">';t+='<td colspan="2">';t+='<select property="editable" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-editable">';t+='<option value="yes"'+((B.editable==="yes")?' selected="selected"':"")+'">Yes ( editable )</option>';t+='<option value="no"'+((B.editable==="no")?' selected="selected"':"")+'">No ( uneditable after registration )</option>';t+='<option value="no-invisible"'+((B.editable==="no-invisible")?' selected="selected"':"")+'">No ( uneditable &amp; totally invisible )</option>';t+="</select><br />";t+="<small>If <code>No</code>, this field will be un-editable after registration.</small><br />";t+="<small>* Administrators are exempt from this.</small>";t+="</td>";t+="</tr>";t+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-spacer"><td colspan="2">&nbsp;</td></tr>';t+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-classes">';t+='<td colspan="2">';t+='<label for="ws-plugin--s2member-custom-reg-field-configuration-tools-form-classes">CSS Classes: ( optional )</label>';t+="</td>";t+="</tr>";t+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-classes">';t+='<td colspan="2">';t+='<input type="text" property="classes" value="'+a(B.classes)+'" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-classes" /><br />';t+="<small>Example: <code>my-style-1 my-style-2</code></small>";t+="</td>";t+="</tr>";t+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-spacer"><td colspan="2">&nbsp;</td></tr>';t+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-styles">';t+='<td colspan="2">';t+='<label for="ws-plugin--s2member-custom-reg-field-configuration-tools-form-styles">CSS Styles: ( optional )</label>';t+="</td>";t+="</tr>";t+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-styles">';t+='<td colspan="2">';t+='<input type="text" property="styles" value="'+a(B.styles)+'" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-styles" /><br />';t+="<small>Example: <code>color:#000000; background:#FFFFFF;</code></small>";t+="</td>";t+="</tr>";t+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-spacer"><td colspan="2">&nbsp;</td></tr>';t+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-attrs">';t+='<td colspan="2">';t+='<label for="ws-plugin--s2member-custom-reg-field-configuration-tools-form-attrs">Other Attributes: ( optional )</label>';t+="</td>";t+="</tr>";t+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-attrs">';t+='<td colspan="2">';t+='<input type="text" property="attrs" value="'+a(B.attrs)+'" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-attrs" /><br />';t+='<small>Example: <code>onkeyup="" onblur=""</code></small>';t+="</td>";t+="</tr>";t+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-spacer"><td colspan="2">&nbsp;</td></tr>';t+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-buttons">';t+='<td align="left">';t+='<input type="button" value="Cancel" onclick="ws_plugin__s2member_customRegFieldCancel();" />';t+="</td>";t+='<td align="right">';t+='<input type="button" value="'+((u)?"Update This Field":"Create Registration Field")+'" onclick="'+((u)?"ws_plugin__s2member_customRegFieldUpdate("+A+");":"ws_plugin__s2member_customRegFieldCreate();")+'" />';t+="</td>";t+="</tr>";t+="</tbody>";t+="</table>";t+="<div>";b("body").append(t);tb_show(((u)?"Editing Registration Field":"New Custom Registration Field"),"#TB_inline?inlineId=ws-plugin--s2member-custom-reg-field-configuration-thickbox-tools-form");b(window).trigger("resize"),b("table#ws-plugin--s2member-custom-reg-field-configuration-tools-form").show()}i.html(z)};var e=function(){b(window).resize(function(){var s,t;s=b(window).width(),t=b(window).height(),s=(s>720)?720:s;b("#TB_ajaxContent").css({width:s-50,height:t-75,margin:0,padding:0})})};var p=function(){var s=l.length,v=0,w,u="",t="o";u+="<tbody>";u+="<tr>";u+="<th>Order</th>";u+="<th>Field Type</th>";u+="<th>Unique ID</th>";u+="<th>Required</th>";u+="<th>Levels</th>";u+="<th>- Tools -</th>";u+="</tr>";if(l.length>0){for(v=0;v<l.length;v++){t=(t==="o")?"e":"o";w=l[v];u+='<tr class="'+a(t)+" ws-plugin--s2member-custom-reg-field-configuration-table-row-"+v+'">';u+='<td nowrap="nowrap"><a class="ws-plugin--s2member-custom-reg-field-configuration-move-up" href="#" onclick="ws_plugin__s2member_customRegFieldMoveUp('+v+'); return false;"></a><a class="ws-plugin--s2member-custom-reg-field-configuration-move-down" href="#" onclick="ws_plugin__s2member_customRegFieldMoveDown('+v+'); return false;"></a></td>';u+='<td nowrap="nowrap">'+esc_html(g(w.type))+"</td>";u+='<td nowrap="nowrap">'+esc_html(w.id)+"</td>";u+='<td nowrap="nowrap">'+esc_html(w.required)+"</td>";u+='<td nowrap="nowrap">'+esc_html(w.levels)+"</td>";u+='<td nowrap="nowrap"><a class="ws-plugin--s2member-custom-reg-field-configuration-edit" href="#" onclick="ws_plugin__s2member_customRegFieldEdit('+v+'); return false;"></a><a class="ws-plugin--s2member-custom-reg-field-configuration-delete" href="#" onclick="ws_plugin__s2member_customRegFieldDelete('+v+'); return false;"></a></td>';u+="</tr>"}}else{u+="<tr>";u+='<td colspan="6">No Custom Fields are configured.</td>';u+="</tr>"}u+="</tbody>";o.html(u)};j(),e(),p()})()}b("input#ws-plugin--s2member-brute-force-restrictions-reset-button").click(function(){var c=b(this);c.val("one moment please ...");b.post(ajaxurl,{action:"ws_plugin__s2member_delete_reset_all_ip_restrictions_via_ajax",ws_plugin__s2member_delete_reset_all_ip_restrictions_via_ajax:'<?php echo c_ws_plugin__s2member_utils_strings::esc_sq (wp_create_nonce ("ws-plugin--s2member-delete-reset-all-ip-restrictions-via-ajax")); ?>'},function(d){alert("s2Member's Brute Force Restriction Logs have all been reset."),c.val("Reset Brute Force Logs")});return false});b("input#ws-plugin--s2member-ip-restrictions-reset-button").click(function(){var c=b(this);c.val("one moment please ...");b.post(ajaxurl,{action:"ws_plugin__s2member_delete_reset_all_ip_restrictions_via_ajax",ws_plugin__s2member_delete_reset_all_ip_restrictions_via_ajax:'<?php echo c_ws_plugin__s2member_utils_strings::esc_sq (wp_create_nonce ("ws-plugin--s2member-delete-reset-all-ip-restrictions-via-ajax")); ?>'},function(d){alert("s2Member's IP Restriction Logs have all been reset."),c.val("Reset IP Restriction Logs")});return false})}else{if(location.href.match(/page\=ws-plugin--s2member-paypal-ops/)){b("select#ws-plugin--s2member-auto-eot-system-enabled").change(function(){var d=b(this),e=d.val();var c=b("p#ws-plugin--s2member-auto-eot-system-enabled-via-cron");if(e==2){c.show()}else{c.hide()}})}else{if(location.href.match(/page\=ws-plugin--s2member-els-ops/)){b("select#ws-plugin--s2member-custom-reg-opt-in").change(function(){var e=b(this),f=e.val();var d=b("tr.ws-plugin--s2member-custom-reg-opt-in-label-row");var c=b("img.ws-plugin--s2member-custom-reg-opt-in-label-prev-img");if(f<=0){d.css("display","none"),c.attr("src",c.attr("src").replace(/\/checked\.png$/,"/unchecked.png"))}else{if(f==1){d.css("display",""),c.attr("src",c.attr("src").replace(/\/unchecked\.png$/,"/checked.png"))}else{if(f==2){d.css("display",""),c.attr("src",c.attr("src").replace(/\/checked\.png$/,"/unchecked.png"))}}}})}else{if(location.href.match(/page\=ws-plugin--s2member-paypal-buttons/)){b("select#ws-plugin--s2member-level1-term, select#ws-plugin--s2member-level2-term, select#ws-plugin--s2member-level3-term, select#ws-plugin--s2member-level4-term, select#ws-plugin--s2member-modification-term").change(function(){var d=this.id.replace(/^ws-plugin--s2member-(.+?)-term$/g,"$1");var c=(b(this).val().split("-")[2].replace(/[^0-1BN]/g,"")==="BN")?1:0;b("p#ws-plugin--s2member-"+d+"-trial-line").css("display",(c?"none":""));b("span#ws-plugin--s2member-"+d+"-trial-then").css("display",(c?"none":""));b("span#ws-plugin--s2member-"+d+"-20p-rule").css("display",(c?"none":""));(c)?b("input#ws-plugin--s2member-"+form+"-trial-period").val(0):null;(c)?b("input#ws-plugin--s2member-"+form+"-trial-amount").val("0.00"):null});b("input#ws-plugin--s2member-level1-ccaps, input#ws-plugin--s2member-level2-ccaps, input#ws-plugin--s2member-level3-ccaps, input#ws-plugin--s2member-level4-ccaps, input#ws-plugin--s2member-modification-ccaps").keyup(function(){var c=this.value.replace(/^\+/,""),d=(this.value.match(/^\+/))?"+":"";if(c.match(/[^a-z_0-9,]/)){this.value=d+b.trim(b.trim(c).replace(/[ \-]/g,"_").replace(/[^A-Z_0-9,]/gi,"").toLowerCase())}});ws_plugin__s2member_paypalButtonGenerate=function(f){var c='[s2Member-PayPal-Button %%attrs%% image="default" output="button" /]',r="",v={};v.level0='<?php echo c_ws_plugin__s2member_utils_strings::esc_sq ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level0_label"]); ?>';v.level1='<?php echo c_ws_plugin__s2member_utils_strings::esc_sq ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_label"]); ?>';v.level2='<?php echo c_ws_plugin__s2member_utils_strings::esc_sq ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_label"]); ?>';v.level3='<?php echo c_ws_plugin__s2member_utils_strings::esc_sq ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_label"]); ?>';v.level4='<?php echo c_ws_plugin__s2member_utils_strings::esc_sq ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_label"]); ?>';var o=b("input#ws-plugin--s2member-"+f+"-shortcode");var g=b("textarea#ws-plugin--s2member-"+f+"-button");var k=b("select#ws-plugin--s2member-modification-level");var h=(f==="modification")?k.val().split(":",2)[1]:f.replace(/^level/,"");var l=v["level"+h].replace(/"/g,"");var s=b.trim(b("input#ws-plugin--s2member-"+f+"-desc").val().replace(/"/g,""));var p=b("input#ws-plugin--s2member-"+f+"-trial-amount").val().replace(/[^0-9\.]/g,"");var e=b("input#ws-plugin--s2member-"+f+"-trial-period").val().replace(/[^0-9]/g,"");var j=b("select#ws-plugin--s2member-"+f+"-trial-term").val().replace(/[^A-Z]/g,"");var m=b("input#ws-plugin--s2member-"+f+"-amount").val().replace(/[^0-9\.]/g,"");var u=b("select#ws-plugin--s2member-"+f+"-term").val().split("-")[0].replace(/[^0-9]/g,"");var w=b("select#ws-plugin--s2member-"+f+"-term").val().split("-")[1].replace(/[^A-Z]/g,"");var t=b("select#ws-plugin--s2member-"+f+"-term").val().split("-")[2].replace(/[^0-1BN]/g,"");var d=b.trim(b("input#ws-plugin--s2member-"+f+"-page-style").val().replace(/"/g,""));var i=b("select#ws-plugin--s2member-"+f+"-currency").val().replace(/[^A-Z]/g,"");var n=b.trim(b.trim(b("input#ws-plugin--s2member-"+f+"-ccaps").val()).replace(/[ \-]/g,"_").replace(/[^A-Z_0-9,]/gi,"").toLowerCase());n=(b.trim(b("input#ws-plugin--s2member-"+f+"-ccaps").val()).match(/^\+/))?"+"+n.toLowerCase():n.toLowerCase();e=(t==="BN")?"0":e;p=(!p||isNaN(p)||p<0.01||e<=0)?"0":p;var q=(t==="BN"&&w!=="L")?h+":"+n+":"+u+" "+w:h+":"+n;q=q.replace(/\:+$/g,"");if(p!=="0"&&(isNaN(p)||p<0)){alert("Oops, a slight problem:\n\nWhen provided, Trial Amount must be >= 0.00");return false}else{if(p!=="0"&&p>10000){alert("Oops, a slight problem:\n\nMaximum Trial Amount is: 10000.00");return false}else{if(j==="D"&&e>7){alert("Oops, a slight problem:\n\nMaximum Trial Days is: 7.\nIf you want to offer more than 7 days, please choose Weeks or Months from the drop-down.");return false}else{if(j==="W"&&e>52){alert("Oops, a slight problem:\n\nMaximum Trial Weeks is: 52.\nIf you want to offer more than 52 weeks, please choose Months from the drop-down.");return false}else{if(j==="M"&&e>12){alert("Oops, a slight problem:\n\nMaximum Trial Months is: 12.\nIf you want to offer more than 12 months, please choose Years from the drop-down.");return false}else{if(j==="Y"&&e>1){alert("Oops, a slight problem:\n\nMax Trial Period Years is: 1.");return false}else{if(!m||isNaN(m)||m<0.01){alert("Oops, a slight problem:\n\nAmount must be >= 0.01");return false}else{if(m>10000){alert("Oops, a slight problem:\n\nMaximum Amount is: 10000.00");return false}else{if(!s){alert("Oops, a slight problem:\n\nPlease type a Description for this Button.");return false}}}}}}}}}g.html(g.val().replace(/ \<\!--(\<input type\="hidden" name\="(amount|src|sra|a1|p1|t1|a3|p3|t3)" value\="(.*?)" \/\>)--\>/g," $1"));(parseInt(e)<=0)?g.html(g.val().replace(/ (\<input type\="hidden" name\="(a1|p1|t1)" value\="(.*?)" \/\>)/g," <!--$1-->")):null;(t==="BN")?g.html(g.val().replace(/ (\<input type\="hidden" name\="cmd" value\=")(.*?)(" \/\>)/g," $1_xclick$3")):null;(t==="BN")?g.html(g.val().replace(/ (\<input type\="hidden" name\="(src|sra|a1|p1|t1|a3|p3|t3)" value\="(.*?)" \/\>)/g," <!--$1-->")):null;(t!=="BN")?g.html(g.val().replace(/ (\<input type\="hidden" name\="cmd" value\=")(.*?)(" \/\>)/g," $1_xclick-subscriptions$3")):null;(t!=="BN")?g.html(g.val().replace(/ (\<input type\="hidden" name\="amount" value\="(.*?)" \/\>)/g," <!--$1-->")):null;r+='level="'+a(h)+'" ccaps="'+a(n)+'" desc="'+a(s)+'" ps="'+a(d)+'" cc="'+a(i)+'" ns="1" custom="<?php echo c_ws_plugin__s2member_utils_strings::esc_sq (esc_attr ($_SERVER["HTTP_HOST"])); ?>"';r+=' ta="'+a(p)+'" tp="'+a(e)+'" tt="'+a(j)+'" ra="'+a(m)+'" rp="'+a(u)+'" rt="'+a(w)+'" rr="'+a(t)+'"';r+=(f==="modification")?' modify="1"':"";o.val(c.replace(/%%attrs%%/,r));g.html(g.val().replace(/ name\="item_name" value\="(.*?)"/,' name="item_name" value="'+a(s)+'"'));g.html(g.val().replace(/ name\="item_number" value\="(.*?)"/,' name="item_number" value="'+a(q)+'"'));g.html(g.val().replace(/ name\="page_style" value\="(.*?)"/,' name="page_style" value="'+a(d)+'"'));g.html(g.val().replace(/ name\="currency_code" value\="(.*?)"/,' name="currency_code" value="'+a(i)+'"'));g.html(g.val().replace(/ name\="custom" value\="(.*?)"/,' name="custom" value="<?php echo c_ws_plugin__s2member_utils_strings::esc_sq (esc_attr ($_SERVER["HTTP_HOST"])); ?>"'));g.html(g.val().replace(/ name\="modify" value\="(.*?)"/,' name="modify" value="'+((f==="modification")?"1":"0")+'"'));g.html(g.val().replace(/ name\="amount" value\="(.*?)"/,' name="amount" value="'+a(m)+'"'));g.html(g.val().replace(/ name\="src" value\="(.*?)"/,' name="src" value="'+a(t)+'"'));g.html(g.val().replace(/ name\="a1" value\="(.*?)"/,' name="a1" value="'+a(p)+'"'));g.html(g.val().replace(/ name\="p1" value\="(.*?)"/,' name="p1" value="'+a(e)+'"'));g.html(g.val().replace(/ name\="t1" value\="(.*?)"/,' name="t1" value="'+a(j)+'"'));g.html(g.val().replace(/ name\="a3" value\="(.*?)"/,' name="a3" value="'+a(m)+'"'));g.html(g.val().replace(/ name\="p3" value\="(.*?)"/,' name="p3" value="'+a(u)+'"'));g.html(g.val().replace(/ name\="t3" value\="(.*?)"/,' name="t3" value="'+a(w)+'"'));b("div#ws-plugin--s2member-"+f+"-button-prev").html(g.val().replace(/\<form/,'<form target="_blank"').replace(/\<\?php echo S2MEMBER_CURRENT_USER_VALUE_FOR_PP_(ON0|OS0); \?\>/g,""));(f==="modification")?alert("Your Modification Button has been generated.\nPlease copy/paste the Shortcode Format into your Login Welcome Page, or wherever you feel it would be most appropriate."):alert("Your Button has been generated.\nPlease copy/paste the Shortcode Format into your Membership Options Page.");o.each(function(){this.focus(),this.select()});return false};ws_plugin__s2member_paypalSpButtonGenerate=function(){var q='[s2Member-PayPal-Button %%attrs%% image="default" output="button" /]',p="";var n=b("input#ws-plugin--s2member-sp-shortcode");var e=b("textarea#ws-plugin--s2member-sp-button");var f=b("select#ws-plugin--s2member-sp-leading-id").val().replace(/[^0-9]/g,"");var h=b("select#ws-plugin--s2member-sp-additional-ids").val()||[];var o=b("select#ws-plugin--s2member-sp-hours").val().replace(/[^0-9]/g,"");var k=b("input#ws-plugin--s2member-sp-amount").val().replace(/[^0-9\.]/g,"");var j=b.trim(b("input#ws-plugin--s2member-sp-desc").val().replace(/"/g,""));var m=b.trim(b("input#ws-plugin--s2member-sp-page-style").val().replace(/"/g,""));var d=b("select#ws-plugin--s2member-sp-currency").val().replace(/[^A-Z]/g,"");if(!f){alert("Oops, a slight problem:\n\nPlease select a Leading Post/Page.\n\n*Tip* If there are no Posts/Pages in the menu, it's because you've not configured s2Member for Specific Post/Page Access yet. See: s2Member -> General Options -> Specific Post/Page Access Restrictions.");return false}else{if(!k||isNaN(k)||k<0.01){alert("Oops, a slight problem:\n\nAmount must be >= 0.01");return false}else{if(k>10000){alert("Oops, a slight problem:\n\nMaximum Amount is: 10000.00");return false}else{if(!j){alert("Oops, a slight problem:\n\nPlease type a Description for this Button.");return false}}}}for(var g=0,c=f;g<h.length;g++){if(h[g]&&h[g]!==f){c+=","+h[g]}}var l="sp:"+c+":"+o;p+='ids="'+a(c)+'" exp="'+a(o)+'" desc="'+a(j)+'" ps="'+a(m)+'" cc="'+a(d)+'" ns="1"';p+=' custom="<?php echo c_ws_plugin__s2member_utils_strings::esc_sq (esc_attr ($_SERVER["HTTP_HOST"])); ?>" ra="'+a(k)+'" sp="1"';n.val(q.replace(/%%attrs%%/,p));e.html(e.val().replace(/ name\="item_name" value\="(.*?)"/,' name="item_name" value="'+a(j)+'"'));e.html(e.val().replace(/ name\="item_number" value\="(.*?)"/,' name="item_number" value="'+a(l)+'"'));e.html(e.val().replace(/ name\="page_style" value\="(.*?)"/,' name="page_style" value="'+a(m)+'"'));e.html(e.val().replace(/ name\="currency_code" value\="(.*?)"/,' name="currency_code" value="'+a(d)+'"'));e.html(e.val().replace(/ name\="custom" value\="(.*?)"/,' name="custom" value="<?php echo c_ws_plugin__s2member_utils_strings::esc_sq (esc_attr ($_SERVER["HTTP_HOST"])); ?>"'));e.html(e.val().replace(/ name\="amount" value\="(.*?)"/,' name="amount" value="'+a(k)+'"'));b("div#ws-plugin--s2member-sp-button-prev").html(e.val().replace(/\<form/,'<form target="_blank"'));alert("Your Button has been generated.\nPlease copy/paste the Shortcode Format into your Membership Options Page.");n.each(function(){this.focus(),this.select()});return false};ws_plugin__s2member_paypalRegLinkGenerate=function(){var j=b("select#ws-plugin--s2member-reg-link-level").val().replace(/[^0-9]/g,"");var i=b.trim(b("input#ws-plugin--s2member-reg-link-subscr-id").val());var h=b.trim(b("input#ws-plugin--s2member-reg-link-custom").val());var d=b.trim(b.trim(b("input#ws-plugin--s2member-reg-link-ccaps").val()).replace(/[ \-]/g,"_").replace(/[^A-Z_0-9,]/gi,"").toLowerCase());var f=b.trim(b("input#ws-plugin--s2member-reg-link-fixed-term").val().replace(/[^A-Z 0-9]/gi,"").toUpperCase());var c=b("p#ws-plugin--s2member-reg-link"),g=b("img#ws-plugin--s2member-reg-link-loading");var e=(f&&!f.match(/L$/))?j+":"+d+":"+f:j+":"+d;e=e.replace(/\:+$/g,"");if(!i){alert("Oops, a slight problem:\n\nPaid Subscr. ID is a required value.");return false}else{if(!h||h.indexOf('<?php echo c_ws_plugin__s2member_utils_strings::esc_sq ($_SERVER["HTTP_HOST"]); ?>')!==0){alert("Oops, a slight problem:\n\nThe Custom Value MUST start with your domain name.");return false}else{if(f&&!f.match(/^[1-9]+ (D|W|M|Y|L)$/)){alert("Oops, a slight problem:\n\nThe Fixed Term Length is not formatted properly.");return false}}}c.hide(),g.show(),b.post(ajaxurl,{action:"ws_plugin__s2member_reg_access_link_via_ajax",ws_plugin__s2member_reg_access_link_via_ajax:'<?php echo c_ws_plugin__s2member_utils_strings::esc_sq (wp_create_nonce ("ws-plugin--s2member-reg-access-link-via-ajax")); ?>',s2member_reg_access_link_subscr_gateway:"paypal",s2member_reg_access_link_subscr_id:i,s2member_reg_access_link_custom:h,s2member_reg_access_link_item_number:e},function(k){c.show().html('<a href="'+a(k)+'" target="_blank" rel="external">'+esc_html(k)+"</a>"),g.hide()});return false};ws_plugin__s2member_paypalSpLinkGenerate=function(){var j=b("select#ws-plugin--s2member-sp-link-leading-id").val().replace(/[^0-9]/g,"");var h=b("select#ws-plugin--s2member-sp-link-additional-ids").val()||[];var c=b("select#ws-plugin--s2member-sp-link-hours").val().replace(/[^0-9]/g,"");var d=b("p#ws-plugin--s2member-sp-link"),g=b("img#ws-plugin--s2member-sp-link-loading");if(!j){alert("Oops, a slight problem:\n\nPlease select a Leading Post/Page.\n\n*Tip* If there are no Posts/Pages in the menu, it's because you've not configured s2Member for Specific Post/Page Access yet. See: s2Member -> General Options -> Specific Post/Page Access Restrictions.");return false}for(var e=0,f=j;e<h.length;e++){if(h[e]&&h[e]!==j){f+=","+h[e]}}d.hide(),g.show(),b.post(ajaxurl,{action:"ws_plugin__s2member_sp_access_link_via_ajax",ws_plugin__s2member_sp_access_link_via_ajax:'<?php echo c_ws_plugin__s2member_utils_strings::esc_sq (wp_create_nonce ("ws-plugin--s2member-sp-access-link-via-ajax")); ?>',s2member_sp_access_link_ids:f,s2member_sp_access_link_hours:c},function(i){d.show().html('<a href="'+a(i)+'" target="_blank" rel="external">'+esc_html(i)+"</a>"),g.hide()});return false}}}}}}}});
1
+ jQuery(document).ready(function(b){var a=esc_html=function(c){return String(c).replace(/"/g,"&quot;").replace(/\</g,"&lt;").replace(/\>/g,"&gt;")};if(location.href.match(/page\=ws-plugin--s2member-mms-options/)){b("select#ws-plugin--s2member-mms-registration-file").change(function(){if(b(this).val()==="wp-signup"){b("div#ws-plugin--s2member-mms-registration-support-package-details-wrapper").show(),b("div.ws-plugin--s2member-mms-registration-wp-login, table.ws-plugin--s2member-mms-registration-wp-login").hide(),b("div.ws-plugin--s2member-mms-registration-wp-signup, table.ws-plugin--s2member-mms-registration-wp-signup").show();b("div.ws-plugin--s2member-mms-registration-wp-signup-blogs-level0, table.ws-plugin--s2member-mms-registration-wp-signup-blogs-level0")[((b("select#ws-plugin--s2member-mms-registration-grants").val()==="all")?"show":"hide")](),b("input#ws-plugin--s2member-mms-registration-blogs-level0").val(((b("select#ws-plugin--s2member-mms-registration-grants").val()==="all")?"1":"0"))}else{if(b(this).val()==="wp-login"){b("div#ws-plugin--s2member-mms-registration-support-package-details-wrapper").hide(),b("div.ws-plugin--s2member-mms-registration-wp-login, table.ws-plugin--s2member-mms-registration-wp-login").show(),b("div.ws-plugin--s2member-mms-registration-wp-signup, table.ws-plugin--s2member-mms-registration-wp-signup").hide(),b("input#ws-plugin--s2member-mms-registration-blogs-level0").val("0")}}}).trigger("change");b("select#ws-plugin--s2member-mms-registration-grants").change(function(){b("select#ws-plugin--s2member-mms-registration-file").trigger("change")})}else{if(location.href.match(/page\=ws-plugin--s2member-bridges/)){b("select#ws-plugin--s2member-bbpress-ovg").change(function(){if(b(this).val()==="0"){b("span#ws-plugin--s2member-bbpress-ovg-off-note").css("display","inline");var c='form#ws-plugin--s2member-bridge-bbpress-form label[for="ws_plugin--s2member-bridge-bbpress-min-level"]';b(c).text(b(c).text().replace(/to (read\/)?participate/i,"to read/participate")),b("select#ws-plugin--s2member-bbpress-min-level option").each(function(){b(this).text(b(this).text().replace(/\( to( read and)? participate \)/i,"( to read and participate )"))})}else{if(b(this).val()==="1"){b("span#ws-plugin--s2member-bbpress-ovg-off-note").css("display","none");var c='form#ws-plugin--s2member-bridge-bbpress-form label[for="ws_plugin--s2member-bridge-bbpress-min-level"]';b(c).text(b(c).text().replace(/to (read\/)?participate/i,"to participate")),b("select#ws-plugin--s2member-bbpress-min-level option").each(function(){b(this).text(b(this).text().replace(/\( to( read and)? participate \)/i,"( to participate )"))})}}}).trigger("change")}else{if(location.href.match(/page\=ws-plugin--s2member-options/)){ws_plugin__s2member_generateSecurityKey=function(){var f=function(h,g){h=(arguments.length<1)?0:h;g=(arguments.length<2)?2147483647:g;return Math.floor(Math.random()*(g-h+1))+h};var e="ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()";for(var d=0,c="";d<56;d++){c+=e.substr(f(0,e.length-1),1)}b("input#ws-plugin--s2member-sec-encryption-key").val(c);return false};ws_plugin__s2member_enableSecurityKey=function(){if(confirm("Edit Key? Are you sure?\nThis could break your installation!\n\n*Note* If you've been testing s2Member, feel free to change this Key before you go live. Just don't go live, and then change it. You'll have some very unhappy Customers. Data corruption WILL occur!\n\nFor your safety, s2Member keeps a history of the last 10 Keys that you've used. If you get yourself into a real situation, s2Member will let you revert back to a previous Key.")){b("input#ws-plugin--s2member-sec-encryption-key").attr("disabled",false)}return false};ws_plugin__s2member_securityKeyHistory=function(){b("div#ws-plugin--s2member-sec-encryption-key-history").toggle();return false};if(b("input#ws-plugin--s2member-custom-reg-fields").length&&b("div#ws-plugin--s2member-custom-reg-field-configuration").length){(function(){var c=b("input#ws-plugin--s2member-custom-reg-fields");var f=b("div#ws-plugin--s2member-custom-reg-field-configuration");var l=(c.val())?b.JSON.parse(c.val()):[];l=(l instanceof Array)?l:[];var k='<div id="ws-plugin--s2member-custom-reg-field-configuration-tools"></div>';var r='<table id="ws-plugin--s2member-custom-reg-field-configuration-table"></table>';f.html(k+r);var i=b("div#ws-plugin--s2member-custom-reg-field-configuration-tools");var o=b("table#ws-plugin--s2member-custom-reg-field-configuration-table");ws_plugin__s2member_customRegFieldTypeChange=function(t){var s,v,u=b(t).val();s="tr.ws-plugin--s2member-custom-reg-field-configuration-tools-form-options";v="tr.ws-plugin--s2member-custom-reg-field-configuration-tools-form-expected";if(u.match(/^(text|textarea|checkbox|pre_checkbox)$/)){b(s).css("display","none"),b(s).prev("tr").css("display","none")}else{b(s).css("display",""),b(s).prev("tr").css("display","")}if(u.match(/^(select|selects|checkboxes|radios)$/)){b(v).css("display","none"),b(v).prev("tr").css("display","none")}else{b(v).css("display",""),b(v).prev("tr").css("display","")}};ws_plugin__s2member_customRegFieldDelete=function(t){var s=new Array();for(var u=0;u<l.length;u++){if(u!==t){s.push(l[u])}}l=s,q(),p()};ws_plugin__s2member_customRegFieldMoveUp=function(u){if(typeof l[u]==="object"&&typeof l[u-1]==="object"){var t=l[u-1],s=l[u];l[u-1]=s,l[u]=t;q(),p()}};ws_plugin__s2member_customRegFieldMoveDown=function(u){if(typeof l[u]==="object"&&typeof l[u+1]==="object"){var s=l[u+1],t=l[u];l[u+1]=t,l[u]=s;q(),p()}};ws_plugin__s2member_customRegFieldCreate=function(){var s=b("table#ws-plugin--s2member-custom-reg-field-configuration-tools-form"),t={};b(":input[property]",s).each(function(){var v=b(this),u=v.attr("property"),w=b.trim(v.val());t[u]=w});if((t=d(t))){l.push(t),q(),j(),p(),n();setTimeout(function(){var u="tr.ws-plugin--s2member-custom-reg-field-configuration-table-row-"+(l.length-1);alert('Field created successfully.\n* Remember to "Save Changes".');b(u).effect("highlight",1000)},500)}};ws_plugin__s2member_customRegFieldUpdate=function(t){var s=b("table#ws-plugin--s2member-custom-reg-field-configuration-tools-form"),u={};b(":input[property]",s).each(function(){var x=b(this),w=x.attr("property"),y=b.trim(x.val());u[w]=y});if((u=d(u,t))){l[t]=u,q(),j(),p(),n();var v="tr.ws-plugin--s2member-custom-reg-field-configuration-table-row-"+t;b(v).effect("highlight",1000)}};ws_plugin__s2member_customRegFieldAdd=function(){j(true)};ws_plugin__s2member_customRegFieldEdit=function(s){j(false,s),n()};ws_plugin__s2member_customRegFieldCancel=function(){j(),n()};var d=function(w,u){var s=(typeof u==="number"&&typeof l[u]==="object")?true:false,x=[],t,v;if(typeof w!=="object"){x.push("Invalid field object. Please try again.")}else{if(!w.id){x.push("Unique Field ID:\nThis is required. Please try again.")}else{if(h(w.id)&&(!s||w.id!==l[u].id)){x.push("Unique Field ID:\nThat Field ID already exists. Please try again.")}}if(!w.label){x.push("Field Label/Description:\nThis is required. Please try again.")}if(w.type.match(/^(select|selects|checkboxes|radios)$/)){w.expected="";if(!w.options){x.push("Option Configuration File:\nThis is required. Please try again.")}else{t=w.options.split(/[\r\n]+/);for(v=0;v<t.length;v++){t[v]=b.trim(t[v]);if(!t[v].match(/^([^\|]*)(\|)([^\|]*)(\|default)?$/)){x.push("Option Configuration File:\nInvalid configuration at line #"+(v+1)+".");break}}w.options=b.trim(t.join("\n"))}}else{w.options=""}if(!(w.levels=w.levels.replace(/ /g,""))){x.push("Applicable Levels:\nThis is required. Please try again.")}else{if(!w.levels.match(/^(all|[0-9,]+)$/)){x.push("Applicable Levels:\nShould be comma-delimited Levels, or just type: all.\n( examples: 0,1,2,3,4 or type the word: all )")}}if(w.classes&&w.classes.match(/[^a-z 0-9 _ \-]/i)){x.push("CSS Classes:\nContains invalid characters. Please try again.\n( only: alphanumerics, underscores, hyphens, spaces )")}if(w.styles&&w.styles.match(/["\=\>\<]/)){x.push('CSS Styles:\nContains invalid characters. Please try again.\n( do NOT use these characters: = " < > )')}if(w.attrs&&w.attrs.match(/[\>\<]/)){x.push("Other Attributes:\nContains invalid characters. Please try again.\n( do NOT use these characters: < > )")}}if(x.length>0){alert(x.join("\n\n"));return false}else{return w}};var q=function(){c.val(((l.length>0)?b.JSON.stringify(l):""))};var m=function(s){return(typeof s==="string")?b.trim(s).toLowerCase().replace(/[^a-z0-9]/g,"_"):""};var g=function(t){var s={text:"Text ( single line )",textarea:"Textarea ( multi-line )",select:"Select Menu ( drop-down )",selects:"Select Menu ( multi-option )",checkbox:"Checkbox ( single )",pre_checkbox:"Checkbox ( pre-checked )",checkboxes:"Checkboxes ( multi-option )",radios:"Radio Buttons ( multi-option )"};if(typeof s[t]==="string"){return s[t]}return""};var h=function(s){for(var t=0;t<l.length;t++){if(l[t].id===s){return true}}};var n=function(){scrollTo(0,b("div.ws-plugin--s2member-custom-reg-fields-section").offset()["top"]-100)};var j=function(s,A){var x=0,z="",t="",D=0,y=0,v={id:"",label:"",type:"text",options:"",expected:"",required:"yes",levels:"all",editable:"yes",classes:"",styles:"",attrs:""};var u=(typeof A==="number"&&typeof l[A]==="object")?true:false,C=(s||u)?true:false,B=(u)?l[A]:v;z+='<a href="#" onclick="ws_plugin__s2member_customRegFieldAdd(); return false;">Add New Field</a>';tb_remove(),b("div#ws-plugin--s2member-custom-reg-field-configuration-thickbox-tools-form").remove();if(C){t+='<div id="ws-plugin--s2member-custom-reg-field-configuration-thickbox-tools-form">';t+='<table id="ws-plugin--s2member-custom-reg-field-configuration-tools-form">';t+="<tbody>";t+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-type">';t+='<td colspan="2">';t+='<label for="ws-plugin--s2member-custom-reg-field-configuration-tools-form-type">Form Field Type: *</label>';t+="</td>";t+="</tr>";t+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-type">';t+='<td colspan="2">';t+='<select property="type" onchange="ws_plugin__s2member_customRegFieldTypeChange(this);" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-type">';t+='<option value="text"'+((B.type==="text")?' selected="selected"':"")+'">'+esc_html(g("text"))+"</option>";t+='<option value="textarea"'+((B.type==="textarea")?' selected="selected"':"")+'">'+esc_html(g("textarea"))+"</option>";t+='<option value="select"'+((B.type==="select")?' selected="selected"':"")+'">'+esc_html(g("select"))+"</option>";t+='<option value="selects"'+((B.type==="selects")?' selected="selected"':"")+'">'+esc_html(g("selects"))+"</option>";t+='<option value="checkbox"'+((B.type==="checkbox")?' selected="selected"':"")+'">'+esc_html(g("checkbox"))+"</option>";t+='<option value="pre_checkbox"'+((B.type==="pre_checkbox")?' selected="selected"':"")+'">'+esc_html(g("pre_checkbox"))+"</option>";t+='<option value="checkboxes"'+((B.type==="checkboxes")?' selected="selected"':"")+'">'+esc_html(g("checkboxes"))+"</option>";t+='<option value="radios"'+((B.type==="radios")?' selected="selected"':"")+'">'+esc_html(g("radios"))+"</option>";t+="</select>";t+="</td>";t+="</tr>";t+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-spacer"><td colspan="2">&nbsp;</td></tr>';t+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-label">';t+='<td colspan="2">';t+='<label for="ws-plugin--s2member-custom-reg-field-configuration-tools-form-label">Field Label/Desc: *</label>';t+="</td>";t+="</tr>";t+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-label">';t+='<td colspan="2">';t+='<input type="text" property="label" value="'+a(B.label)+'" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-label" /><br />';t+="<small>Examples: <code>Choose Country</code>, <code>Street Address</code></small>";t+="</td>";t+="</tr>";t+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-spacer"><td colspan="2">&nbsp;</td></tr>';t+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-id">';t+='<td colspan="2">';t+='<label for="ws-plugin--s2member-custom-reg-field-configuration-tools-form-id">Unique Field ID: *</label></label>';t+="</td>";t+="</tr>";t+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-id">';t+='<td colspan="2">';t+='<input type="text" property="id" value="'+a(B.id)+'" maxlength="25" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-id" /><br />';t+="<small>Examples: <code>country_code</code>, <code>street_address</code></small><br />";t+='<small>e.g. <code>[s2Get user_field="country_code" /]</code></small>';t+="</td>";t+="</tr>";t+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-spacer"><td colspan="2">&nbsp;</td></tr>';t+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-required">';t+='<td colspan="2">';t+='<label for="ws-plugin--s2member-custom-reg-field-configuration-tools-form-required">Field Required: *</label>';t+="</td>";t+="</tr>";t+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-required">';t+='<td colspan="2">';t+='<select property="required" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-required">';t+='<option value="yes"'+((B.required==="yes")?' selected="selected"':"")+'">Yes ( required )</option>';t+='<option value="no"'+((B.required==="no")?' selected="selected"':"")+'">No ( optional )</option>';t+="</select><br />";t+='<small>If <code>yes</code>, only Users/Members will be "required" to enter this field.</small><br />';t+="<small>* Administrators are exempt from this requirement.</small>";t+="</td>";t+="</tr>";t+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-spacer"'+((B.type.match(/^(text|textarea|checkbox|pre_checkbox)$/))?' style="display:none;"':"")+'><td colspan="2">&nbsp;</td></tr>';t+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-options"'+((B.type.match(/^(text|textarea|checkbox|pre_checkbox)$/))?' style="display:none;"':"")+">";t+='<td colspan="2">';t+='<label for="ws-plugin--s2member-custom-reg-field-configuration-tools-form-options">Option Configuration File: * ( one option per line )</label><br />';t+="<small>Use a pipe <code>|</code> delimited format: <code>option value|option label</code></small>";t+="</td>";t+="</tr>";t+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-options"'+((B.type.match(/^(text|textarea|checkbox|pre_checkbox)$/))?' style="display:none;"':"")+">";t+='<td colspan="2">';t+='<textarea property="options" rows="3" wrap="off" spellcheck="false" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-options">'+esc_html(B.options)+"</textarea><br />";t+="Here is a quick example:<br />";t+="<small>You can also specify a <em>default</em> option:</small><br />";t+="<code>US|United States|default</code><br />";t+="<code>CA|Canada</code><br />";t+="<code>VI|Virgin Islands (U.S.)</code>";t+="</td>";t+="</tr>";t+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-spacer"'+((B.type.match(/^(select|selects|checkboxes|radios)$/))?' style="display:none;"':"")+'><td colspan="2">&nbsp;</td></tr>';t+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-expected"'+((B.type.match(/^(select|selects|checkboxes|radios)$/))?' style="display:none;"':"")+">";t+='<td colspan="2">';t+='<label for="ws-plugin--s2member-custom-reg-field-configuration-tools-form-expected">Expected Format: *</label>';t+="</td>";t+="</tr>";t+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-expected"'+((B.type.match(/^(select|selects|checkboxes|radios)$/))?' style="display:none;"':"")+">";t+='<td colspan="2">';t+='<select property="expected" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-expected">';t+='<option value=""'+((B.expected==="")?' selected="selected"':"")+'">Anything Goes</option>';t+='<option disabled="disabled"></option>';t+='<optgroup label="Specific Input Types">';t+='<option value="numeric-wp-commas"'+((B.expected==="numeric-wp-commas")?' selected="selected"':"")+'">Numeric ( with or without decimals, commas allowed )</option>';t+='<option value="numeric"'+((B.expected==="numeric")?' selected="selected"':"")+'">Numeric ( with or without decimals, no commas )</option>';t+='<option value="integer"'+((B.expected==="integer")?' selected="selected"':"")+'">Integer ( whole number, without any decimals )</option>';t+='<option value="integer-gt-0"'+((B.expected==="integer-gt-0")?' selected="selected"':"")+'">Integer > 0 ( whole number, no decimals, greater than 0 )</option>';t+='<option value="float"'+((B.expected==="float")?' selected="selected"':"")+'">Float ( floating point number, decimals required )</option>';t+='<option value="float-gt-0"'+((B.expected==="float-gt-0")?' selected="selected"':"")+'">Float > 0 ( floating point number, decimals required, greater than 0 )</option>';t+='<option value="date"'+((B.expected==="date")?' selected="selected"':"")+'">Date ( required date format: dd/mm/yyyy )</option>';t+='<option value="email"'+((B.expected==="email")?' selected="selected"':"")+'">Email ( require valid email )</option>';t+='<option value="url"'+((B.expected==="url")?' selected="selected"':"")+'">Full URL ( starting with http or https )</option>';t+='<option value="domain"'+((B.expected==="domain")?' selected="selected"':"")+'">Domain Name ( domain name only, without http )</option>';t+='<option value="phone"'+((B.expected==="phone")?' selected="selected"':"")+'">Phone # ( 10 digits w/possible hyphens,spaces,brackets )</option>';t+='<option value="uszip"'+((B.expected==="uszip")?' selected="selected"':"")+'">US Zipcode ( 5-9 digits w/possible hyphen )</option>';t+='<option value="cazip"'+((B.expected==="cazip")?' selected="selected"':"")+'">Canadian Zipcode ( 6 alpha-numerics w/possible space )</option>';t+='<option value="uczip"'+((B.expected==="uczip")?' selected="selected"':"")+'">US/Canadian Zipcode ( either a US or Canadian zipcode )</option>';t+="</optgroup>";t+='<option disabled="disabled"></option>';t+='<optgroup label="Any Character Combination">';for(x=1;x<=25;x++){t+='<option value="any-'+x+'"'+((B.expected==="any-"+x)?' selected="selected"':"")+'">Any Character Combination ( '+x+" character minimum )</option>";t+='<option value="any-'+x+'-e"'+((B.expected==="any-"+x+"-e")?' selected="selected"':"")+'">Any Character Combination ( exactly '+x+" character"+((x>1)?"s":"")+" )</option>"}t+="</optgroup>";t+='<option disabled="disabled"></option>';t+='<optgroup label="Alphanumerics, Spaces &amp; Punctuation Only">';for(x=1;x<=25;x++){t+='<option value="alphanumerics-spaces-punctuation-'+x+'"'+((B.expected==="alphanumerics-spaces-punctuation-"+x)?' selected="selected"':"")+'">Alphanumerics, Spaces &amp; Punctuation ( '+x+" character minimum )</option>";t+='<option value="alphanumerics-spaces-punctuation-'+x+'-e"'+((B.expected==="alphanumerics-spaces-punctuation-"+x+"-e")?' selected="selected"':"")+'">Alphanumerics, Spaces &amp; Punctuation ( exactly '+x+" character"+((x>1)?"s":"")+" )</option>"}t+="</optgroup>";t+='<option disabled="disabled"></option>';t+='<optgroup label="Alphanumerics &amp; Spaces Only">';for(x=1;x<=25;x++){t+='<option value="alphanumerics-spaces-'+x+'"'+((B.expected==="alphanumerics-spaces-"+x)?' selected="selected"':"")+'">Alphanumerics &amp; Spaces ( '+x+" character minimum )</option>";t+='<option value="alphanumerics-spaces-'+x+'-e"'+((B.expected==="alphanumerics-spaces-"+x+"-e")?' selected="selected"':"")+'">Alphanumerics &amp; Spaces ( exactly '+x+" character"+((x>1)?"s":"")+" )</option>"}t+="</optgroup>";t+='<option disabled="disabled"></option>';t+='<optgroup label="Alphanumerics &amp; Punctuation Only">';for(x=1;x<=25;x++){t+='<option value="alphanumerics-punctuation-'+x+'"'+((B.expected==="alphanumerics-punctuation-"+x)?' selected="selected"':"")+'">Alphanumerics &amp; Punctuation ( '+x+" character minimum )</option>";t+='<option value="alphanumerics-punctuation-'+x+'-e"'+((B.expected==="alphanumerics-punctuation-"+x+"-e")?' selected="selected"':"")+'">Alphanumerics &amp; Punctuation ( exactly '+x+" character"+((x>1)?"s":"")+" )</option>"}t+="</optgroup>";t+='<option disabled="disabled"></option>';t+='<optgroup label="Alphanumerics Only">';for(x=1;x<=25;x++){t+='<option value="alphanumerics-'+x+'"'+((B.expected==="alphanumerics-"+x)?' selected="selected"':"")+'">Alphanumerics ( '+x+" character minimum )</option>";t+='<option value="alphanumerics-'+x+'-e"'+((B.expected==="alphanumerics-"+x+"-e")?' selected="selected"':"")+'">Alphanumerics ( exactly '+x+" character"+((x>1)?"s":"")+" )</option>"}t+="</optgroup>";t+='<option disabled="disabled"></option>';t+='<optgroup label="Alphabetics Only">';for(x=1;x<=25;x++){t+='<option value="alphabetics-'+x+'"'+((B.expected==="alphabetics-"+x)?' selected="selected"':"")+'">Alphabetics ( '+x+" character minimum )</option>";t+='<option value="alphabetics-'+x+'-e"'+((B.expected==="alphabetics-"+x+"-e")?' selected="selected"':"")+'">Alphabetics ( exactly '+x+" character"+((x>1)?"s":"")+" )</option>"}t+="</optgroup>";t+='<option disabled="disabled"></option>';t+='<optgroup label="Numeric Digits Only">';for(x=1;x<=25;x++){t+='<option value="numerics-'+x+'"'+((B.expected==="numerics-"+x)?' selected="selected"':"")+'">Numeric Digits ( '+x+" digit minimum )</option>";t+='<option value="numerics-'+x+'-e"'+((B.expected==="numerics-"+x+"-e")?' selected="selected"':"")+'">Numeric Digits ( exactly '+x+" digit"+((x>1)?"s":"")+" )</option>"}t+="</optgroup>";t+="</select><br />";t+="<small>Only Users/Members will be required to meet this criteria.</small><br />";t+="<small>* Administrators are exempt from this.</small>";t+="</td>";t+="</tr>";t+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-spacer"><td colspan="2">&nbsp;</td></tr>';t+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-levels">';t+='<td colspan="2">';t+='<label for="ws-plugin--s2member-custom-reg-field-configuration-tools-form-levels">Applicable Membership Levels: *</label>';t+="</td>";t+="</tr>";t+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-levels">';t+='<td colspan="2">';t+='<input type="text" property="levels" value="'+a(B.levels)+'" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-levels" /><br />';t+="<small>Please use comma-delimited Level #'s: <code>0,1,2,3,4</code> or type: <code>all</code>.</small><br />";t+="<small>This allows you to enable this field - only at specific Membership Levels.</small>";t+="</td>";t+="</tr>";t+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-spacer"><td colspan="2">&nbsp;</td></tr>';t+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-editable">';t+='<td colspan="2">';t+='<label for="ws-plugin--s2member-custom-reg-field-configuration-tools-form-editable">Allow Profile Edits: *</label>';t+="</td>";t+="</tr>";t+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-editable">';t+='<td colspan="2">';t+='<select property="editable" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-editable">';t+='<option value="yes"'+((B.editable==="yes")?' selected="selected"':"")+'">Yes ( editable )</option>';t+='<option value="no"'+((B.editable==="no")?' selected="selected"':"")+'">No ( uneditable after registration )</option>';t+='<option value="no-invisible"'+((B.editable==="no-invisible")?' selected="selected"':"")+'">No ( uneditable &amp; totally invisible after registration )</option>';t+='<option value="yes-invisible"'+((B.editable==="yes-invisible")?' selected="selected"':"")+'">Yes ( editable after registration / invisible during registration )</option>';t+="</select><br />";t+="<small>If <code>No</code>, this field will be un-editable after registration.</small><br />";t+="<small>* Administrators are exempt from this.</small>";t+="</td>";t+="</tr>";t+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-spacer"><td colspan="2">&nbsp;</td></tr>';t+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-classes">';t+='<td colspan="2">';t+='<label for="ws-plugin--s2member-custom-reg-field-configuration-tools-form-classes">CSS Classes: ( optional )</label>';t+="</td>";t+="</tr>";t+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-classes">';t+='<td colspan="2">';t+='<input type="text" property="classes" value="'+a(B.classes)+'" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-classes" /><br />';t+="<small>Example: <code>my-style-1 my-style-2</code></small>";t+="</td>";t+="</tr>";t+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-spacer"><td colspan="2">&nbsp;</td></tr>';t+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-styles">';t+='<td colspan="2">';t+='<label for="ws-plugin--s2member-custom-reg-field-configuration-tools-form-styles">CSS Styles: ( optional )</label>';t+="</td>";t+="</tr>";t+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-styles">';t+='<td colspan="2">';t+='<input type="text" property="styles" value="'+a(B.styles)+'" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-styles" /><br />';t+="<small>Example: <code>color:#000000; background:#FFFFFF;</code></small>";t+="</td>";t+="</tr>";t+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-spacer"><td colspan="2">&nbsp;</td></tr>';t+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-attrs">';t+='<td colspan="2">';t+='<label for="ws-plugin--s2member-custom-reg-field-configuration-tools-form-attrs">Other Attributes: ( optional )</label>';t+="</td>";t+="</tr>";t+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-attrs">';t+='<td colspan="2">';t+='<input type="text" property="attrs" value="'+a(B.attrs)+'" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-attrs" /><br />';t+='<small>Example: <code>onkeyup="" onblur=""</code></small>';t+="</td>";t+="</tr>";t+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-spacer"><td colspan="2">&nbsp;</td></tr>';t+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-buttons">';t+='<td align="left">';t+='<input type="button" value="Cancel" onclick="ws_plugin__s2member_customRegFieldCancel();" />';t+="</td>";t+='<td align="right">';t+='<input type="button" value="'+((u)?"Update This Field":"Create Registration Field")+'" onclick="'+((u)?"ws_plugin__s2member_customRegFieldUpdate("+A+");":"ws_plugin__s2member_customRegFieldCreate();")+'" />';t+="</td>";t+="</tr>";t+="</tbody>";t+="</table>";t+="<div>";b("body").append(t);tb_show(((u)?"Editing Registration Field":"New Custom Registration Field"),"#TB_inline?inlineId=ws-plugin--s2member-custom-reg-field-configuration-thickbox-tools-form");b(window).trigger("resize"),b("table#ws-plugin--s2member-custom-reg-field-configuration-tools-form").show()}i.html(z)};var e=function(){b(window).resize(function(){var s,t;s=b(window).width(),t=b(window).height(),s=(s>720)?720:s;b("#TB_ajaxContent").css({width:s-50,height:t-75,margin:0,padding:0})})};var p=function(){var s=l.length,v=0,w,u="",t="o";u+="<tbody>";u+="<tr>";u+="<th>Order</th>";u+="<th>Field Type</th>";u+="<th>Unique ID</th>";u+="<th>Required</th>";u+="<th>Levels</th>";u+="<th>- Tools -</th>";u+="</tr>";if(l.length>0){for(v=0;v<l.length;v++){t=(t==="o")?"e":"o";w=l[v];u+='<tr class="'+a(t)+" ws-plugin--s2member-custom-reg-field-configuration-table-row-"+v+'">';u+='<td nowrap="nowrap"><a class="ws-plugin--s2member-custom-reg-field-configuration-move-up" href="#" onclick="ws_plugin__s2member_customRegFieldMoveUp('+v+'); return false;"></a><a class="ws-plugin--s2member-custom-reg-field-configuration-move-down" href="#" onclick="ws_plugin__s2member_customRegFieldMoveDown('+v+'); return false;"></a></td>';u+='<td nowrap="nowrap">'+esc_html(g(w.type))+"</td>";u+='<td nowrap="nowrap">'+esc_html(w.id)+"</td>";u+='<td nowrap="nowrap">'+esc_html(w.required)+"</td>";u+='<td nowrap="nowrap">'+esc_html(w.levels)+"</td>";u+='<td nowrap="nowrap"><a class="ws-plugin--s2member-custom-reg-field-configuration-edit" href="#" onclick="ws_plugin__s2member_customRegFieldEdit('+v+'); return false;"></a><a class="ws-plugin--s2member-custom-reg-field-configuration-delete" href="#" onclick="ws_plugin__s2member_customRegFieldDelete('+v+'); return false;"></a></td>';u+="</tr>"}}else{u+="<tr>";u+='<td colspan="6">No Custom Fields are configured.</td>';u+="</tr>"}u+="</tbody>";o.html(u)};j(),e(),p()})()}b("input#ws-plugin--s2member-brute-force-restrictions-reset-button").click(function(){var c=b(this);c.val("one moment please ...");b.post(ajaxurl,{action:"ws_plugin__s2member_delete_reset_all_ip_restrictions_via_ajax",ws_plugin__s2member_delete_reset_all_ip_restrictions_via_ajax:'<?php echo c_ws_plugin__s2member_utils_strings::esc_sq (wp_create_nonce ("ws-plugin--s2member-delete-reset-all-ip-restrictions-via-ajax")); ?>'},function(d){alert("s2Member's Brute Force Restriction Logs have all been reset."),c.val("Reset Brute Force Logs")});return false});b("input#ws-plugin--s2member-ip-restrictions-reset-button").click(function(){var c=b(this);c.val("one moment please ...");b.post(ajaxurl,{action:"ws_plugin__s2member_delete_reset_all_ip_restrictions_via_ajax",ws_plugin__s2member_delete_reset_all_ip_restrictions_via_ajax:'<?php echo c_ws_plugin__s2member_utils_strings::esc_sq (wp_create_nonce ("ws-plugin--s2member-delete-reset-all-ip-restrictions-via-ajax")); ?>'},function(d){alert("s2Member's IP Restriction Logs have all been reset."),c.val("Reset IP Restriction Logs")});return false})}else{if(location.href.match(/page\=ws-plugin--s2member-paypal-ops/)){b("select#ws-plugin--s2member-auto-eot-system-enabled").change(function(){var d=b(this),e=d.val();var c=b("p#ws-plugin--s2member-auto-eot-system-enabled-via-cron");if(e==2){c.show()}else{c.hide()}})}else{if(location.href.match(/page\=ws-plugin--s2member-els-ops/)){b("select#ws-plugin--s2member-custom-reg-opt-in").change(function(){var e=b(this),f=e.val();var d=b("tr.ws-plugin--s2member-custom-reg-opt-in-label-row");var c=b("img.ws-plugin--s2member-custom-reg-opt-in-label-prev-img");if(f<=0){d.css("display","none"),c.attr("src",c.attr("src").replace(/\/checked\.png$/,"/unchecked.png"))}else{if(f==1){d.css("display",""),c.attr("src",c.attr("src").replace(/\/unchecked\.png$/,"/checked.png"))}else{if(f==2){d.css("display",""),c.attr("src",c.attr("src").replace(/\/checked\.png$/,"/unchecked.png"))}}}})}else{if(location.href.match(/page\=ws-plugin--s2member-paypal-buttons/)){b("select#ws-plugin--s2member-level1-term, select#ws-plugin--s2member-level2-term, select#ws-plugin--s2member-level3-term, select#ws-plugin--s2member-level4-term, select#ws-plugin--s2member-modification-term").change(function(){var d=this.id.replace(/^ws-plugin--s2member-(.+?)-term$/g,"$1");var c=(b(this).val().split("-")[2].replace(/[^0-1BN]/g,"")==="BN")?1:0;b("p#ws-plugin--s2member-"+d+"-trial-line").css("display",(c?"none":""));b("span#ws-plugin--s2member-"+d+"-trial-then").css("display",(c?"none":""));b("span#ws-plugin--s2member-"+d+"-20p-rule").css("display",(c?"none":""));(c)?b("input#ws-plugin--s2member-"+form+"-trial-period").val(0):null;(c)?b("input#ws-plugin--s2member-"+form+"-trial-amount").val("0.00"):null});b("input#ws-plugin--s2member-level1-ccaps, input#ws-plugin--s2member-level2-ccaps, input#ws-plugin--s2member-level3-ccaps, input#ws-plugin--s2member-level4-ccaps, input#ws-plugin--s2member-modification-ccaps").keyup(function(){var c=this.value.replace(/^\+/,""),d=(this.value.match(/^\+/))?"+":"";if(c.match(/[^a-z_0-9,]/)){this.value=d+b.trim(b.trim(c).replace(/[ \-]/g,"_").replace(/[^A-Z_0-9,]/gi,"").toLowerCase())}});ws_plugin__s2member_paypalButtonGenerate=function(f){var c='[s2Member-PayPal-Button %%attrs%% image="default" output="button" /]',r="",v={};v.level0='<?php echo c_ws_plugin__s2member_utils_strings::esc_sq ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level0_label"]); ?>';v.level1='<?php echo c_ws_plugin__s2member_utils_strings::esc_sq ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_label"]); ?>';v.level2='<?php echo c_ws_plugin__s2member_utils_strings::esc_sq ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_label"]); ?>';v.level3='<?php echo c_ws_plugin__s2member_utils_strings::esc_sq ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_label"]); ?>';v.level4='<?php echo c_ws_plugin__s2member_utils_strings::esc_sq ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_label"]); ?>';var o=b("input#ws-plugin--s2member-"+f+"-shortcode");var g=b("textarea#ws-plugin--s2member-"+f+"-button");var k=b("select#ws-plugin--s2member-modification-level");var h=(f==="modification")?k.val().split(":",2)[1]:f.replace(/^level/,"");var l=v["level"+h].replace(/"/g,"");var s=b.trim(b("input#ws-plugin--s2member-"+f+"-desc").val().replace(/"/g,""));var p=b("input#ws-plugin--s2member-"+f+"-trial-amount").val().replace(/[^0-9\.]/g,"");var e=b("input#ws-plugin--s2member-"+f+"-trial-period").val().replace(/[^0-9]/g,"");var j=b("select#ws-plugin--s2member-"+f+"-trial-term").val().replace(/[^A-Z]/g,"");var m=b("input#ws-plugin--s2member-"+f+"-amount").val().replace(/[^0-9\.]/g,"");var u=b("select#ws-plugin--s2member-"+f+"-term").val().split("-")[0].replace(/[^0-9]/g,"");var w=b("select#ws-plugin--s2member-"+f+"-term").val().split("-")[1].replace(/[^A-Z]/g,"");var t=b("select#ws-plugin--s2member-"+f+"-term").val().split("-")[2].replace(/[^0-1BN]/g,"");var d=b.trim(b("input#ws-plugin--s2member-"+f+"-page-style").val().replace(/"/g,""));var i=b("select#ws-plugin--s2member-"+f+"-currency").val().replace(/[^A-Z]/g,"");var n=b.trim(b.trim(b("input#ws-plugin--s2member-"+f+"-ccaps").val()).replace(/[ \-]/g,"_").replace(/[^A-Z_0-9,]/gi,"").toLowerCase());n=(b.trim(b("input#ws-plugin--s2member-"+f+"-ccaps").val()).match(/^\+/))?"+"+n.toLowerCase():n.toLowerCase();e=(t==="BN")?"0":e;p=(!p||isNaN(p)||p<0.01||e<=0)?"0":p;var q=(t==="BN"&&w!=="L")?h+":"+n+":"+u+" "+w:h+":"+n;q=q.replace(/\:+$/g,"");if(p!=="0"&&(isNaN(p)||p<0)){alert("Oops, a slight problem:\n\nWhen provided, Trial Amount must be >= 0.00");return false}else{if(p!=="0"&&p>10000){alert("Oops, a slight problem:\n\nMaximum Trial Amount is: 10000.00");return false}else{if(j==="D"&&e>7){alert("Oops, a slight problem:\n\nMaximum Trial Days is: 7.\nIf you want to offer more than 7 days, please choose Weeks or Months from the drop-down.");return false}else{if(j==="W"&&e>52){alert("Oops, a slight problem:\n\nMaximum Trial Weeks is: 52.\nIf you want to offer more than 52 weeks, please choose Months from the drop-down.");return false}else{if(j==="M"&&e>12){alert("Oops, a slight problem:\n\nMaximum Trial Months is: 12.\nIf you want to offer more than 12 months, please choose Years from the drop-down.");return false}else{if(j==="Y"&&e>1){alert("Oops, a slight problem:\n\nMax Trial Period Years is: 1.");return false}else{if(!m||isNaN(m)||m<0.01){alert("Oops, a slight problem:\n\nAmount must be >= 0.01");return false}else{if(m>10000){alert("Oops, a slight problem:\n\nMaximum Amount is: 10000.00");return false}else{if(!s){alert("Oops, a slight problem:\n\nPlease type a Description for this Button.");return false}}}}}}}}}g.html(g.val().replace(/ \<\!--(\<input type\="hidden" name\="(amount|src|sra|a1|p1|t1|a3|p3|t3)" value\="(.*?)" \/\>)--\>/g," $1"));(parseInt(e)<=0)?g.html(g.val().replace(/ (\<input type\="hidden" name\="(a1|p1|t1)" value\="(.*?)" \/\>)/g," <!--$1-->")):null;(t==="BN")?g.html(g.val().replace(/ (\<input type\="hidden" name\="cmd" value\=")(.*?)(" \/\>)/g," $1_xclick$3")):null;(t==="BN")?g.html(g.val().replace(/ (\<input type\="hidden" name\="(src|sra|a1|p1|t1|a3|p3|t3)" value\="(.*?)" \/\>)/g," <!--$1-->")):null;(t!=="BN")?g.html(g.val().replace(/ (\<input type\="hidden" name\="cmd" value\=")(.*?)(" \/\>)/g," $1_xclick-subscriptions$3")):null;(t!=="BN")?g.html(g.val().replace(/ (\<input type\="hidden" name\="amount" value\="(.*?)" \/\>)/g," <!--$1-->")):null;r+='level="'+a(h)+'" ccaps="'+a(n)+'" desc="'+a(s)+'" ps="'+a(d)+'" cc="'+a(i)+'" ns="1" custom="<?php echo c_ws_plugin__s2member_utils_strings::esc_sq (esc_attr ($_SERVER["HTTP_HOST"])); ?>"';r+=' ta="'+a(p)+'" tp="'+a(e)+'" tt="'+a(j)+'" ra="'+a(m)+'" rp="'+a(u)+'" rt="'+a(w)+'" rr="'+a(t)+'"';r+=(f==="modification")?' modify="1"':"";o.val(c.replace(/%%attrs%%/,r));g.html(g.val().replace(/ name\="item_name" value\="(.*?)"/,' name="item_name" value="'+a(s)+'"'));g.html(g.val().replace(/ name\="item_number" value\="(.*?)"/,' name="item_number" value="'+a(q)+'"'));g.html(g.val().replace(/ name\="page_style" value\="(.*?)"/,' name="page_style" value="'+a(d)+'"'));g.html(g.val().replace(/ name\="currency_code" value\="(.*?)"/,' name="currency_code" value="'+a(i)+'"'));g.html(g.val().replace(/ name\="custom" value\="(.*?)"/,' name="custom" value="<?php echo c_ws_plugin__s2member_utils_strings::esc_sq (esc_attr ($_SERVER["HTTP_HOST"])); ?>"'));g.html(g.val().replace(/ name\="modify" value\="(.*?)"/,' name="modify" value="'+((f==="modification")?"1":"0")+'"'));g.html(g.val().replace(/ name\="amount" value\="(.*?)"/,' name="amount" value="'+a(m)+'"'));g.html(g.val().replace(/ name\="src" value\="(.*?)"/,' name="src" value="'+a(t)+'"'));g.html(g.val().replace(/ name\="a1" value\="(.*?)"/,' name="a1" value="'+a(p)+'"'));g.html(g.val().replace(/ name\="p1" value\="(.*?)"/,' name="p1" value="'+a(e)+'"'));g.html(g.val().replace(/ name\="t1" value\="(.*?)"/,' name="t1" value="'+a(j)+'"'));g.html(g.val().replace(/ name\="a3" value\="(.*?)"/,' name="a3" value="'+a(m)+'"'));g.html(g.val().replace(/ name\="p3" value\="(.*?)"/,' name="p3" value="'+a(u)+'"'));g.html(g.val().replace(/ name\="t3" value\="(.*?)"/,' name="t3" value="'+a(w)+'"'));b("div#ws-plugin--s2member-"+f+"-button-prev").html(g.val().replace(/\<form/,'<form target="_blank"').replace(/\<\?php echo S2MEMBER_CURRENT_USER_VALUE_FOR_PP_(ON0|OS0); \?\>/g,""));(f==="modification")?alert("Your Modification Button has been generated.\nPlease copy/paste the Shortcode Format into your Login Welcome Page, or wherever you feel it would be most appropriate."):alert("Your Button has been generated.\nPlease copy/paste the Shortcode Format into your Membership Options Page.");o.each(function(){this.focus(),this.select()});return false};ws_plugin__s2member_paypalSpButtonGenerate=function(){var q='[s2Member-PayPal-Button %%attrs%% image="default" output="button" /]',p="";var n=b("input#ws-plugin--s2member-sp-shortcode");var e=b("textarea#ws-plugin--s2member-sp-button");var f=b("select#ws-plugin--s2member-sp-leading-id").val().replace(/[^0-9]/g,"");var h=b("select#ws-plugin--s2member-sp-additional-ids").val()||[];var o=b("select#ws-plugin--s2member-sp-hours").val().replace(/[^0-9]/g,"");var k=b("input#ws-plugin--s2member-sp-amount").val().replace(/[^0-9\.]/g,"");var j=b.trim(b("input#ws-plugin--s2member-sp-desc").val().replace(/"/g,""));var m=b.trim(b("input#ws-plugin--s2member-sp-page-style").val().replace(/"/g,""));var d=b("select#ws-plugin--s2member-sp-currency").val().replace(/[^A-Z]/g,"");if(!f){alert("Oops, a slight problem:\n\nPlease select a Leading Post/Page.\n\n*Tip* If there are no Posts/Pages in the menu, it's because you've not configured s2Member for Specific Post/Page Access yet. See: s2Member -> General Options -> Specific Post/Page Access Restrictions.");return false}else{if(!k||isNaN(k)||k<0.01){alert("Oops, a slight problem:\n\nAmount must be >= 0.01");return false}else{if(k>10000){alert("Oops, a slight problem:\n\nMaximum Amount is: 10000.00");return false}else{if(!j){alert("Oops, a slight problem:\n\nPlease type a Description for this Button.");return false}}}}for(var g=0,c=f;g<h.length;g++){if(h[g]&&h[g]!==f){c+=","+h[g]}}var l="sp:"+c+":"+o;p+='ids="'+a(c)+'" exp="'+a(o)+'" desc="'+a(j)+'" ps="'+a(m)+'" cc="'+a(d)+'" ns="1"';p+=' custom="<?php echo c_ws_plugin__s2member_utils_strings::esc_sq (esc_attr ($_SERVER["HTTP_HOST"])); ?>" ra="'+a(k)+'" sp="1"';n.val(q.replace(/%%attrs%%/,p));e.html(e.val().replace(/ name\="item_name" value\="(.*?)"/,' name="item_name" value="'+a(j)+'"'));e.html(e.val().replace(/ name\="item_number" value\="(.*?)"/,' name="item_number" value="'+a(l)+'"'));e.html(e.val().replace(/ name\="page_style" value\="(.*?)"/,' name="page_style" value="'+a(m)+'"'));e.html(e.val().replace(/ name\="currency_code" value\="(.*?)"/,' name="currency_code" value="'+a(d)+'"'));e.html(e.val().replace(/ name\="custom" value\="(.*?)"/,' name="custom" value="<?php echo c_ws_plugin__s2member_utils_strings::esc_sq (esc_attr ($_SERVER["HTTP_HOST"])); ?>"'));e.html(e.val().replace(/ name\="amount" value\="(.*?)"/,' name="amount" value="'+a(k)+'"'));b("div#ws-plugin--s2member-sp-button-prev").html(e.val().replace(/\<form/,'<form target="_blank"'));alert("Your Button has been generated.\nPlease copy/paste the Shortcode Format into your Membership Options Page.");n.each(function(){this.focus(),this.select()});return false};ws_plugin__s2member_paypalRegLinkGenerate=function(){var j=b("select#ws-plugin--s2member-reg-link-level").val().replace(/[^0-9]/g,"");var i=b.trim(b("input#ws-plugin--s2member-reg-link-subscr-id").val());var h=b.trim(b("input#ws-plugin--s2member-reg-link-custom").val());var d=b.trim(b.trim(b("input#ws-plugin--s2member-reg-link-ccaps").val()).replace(/[ \-]/g,"_").replace(/[^A-Z_0-9,]/gi,"").toLowerCase());var f=b.trim(b("input#ws-plugin--s2member-reg-link-fixed-term").val().replace(/[^A-Z 0-9]/gi,"").toUpperCase());var c=b("p#ws-plugin--s2member-reg-link"),g=b("img#ws-plugin--s2member-reg-link-loading");var e=(f&&!f.match(/L$/))?j+":"+d+":"+f:j+":"+d;e=e.replace(/\:+$/g,"");if(!i){alert("Oops, a slight problem:\n\nPaid Subscr. ID is a required value.");return false}else{if(!h||h.indexOf('<?php echo c_ws_plugin__s2member_utils_strings::esc_sq ($_SERVER["HTTP_HOST"]); ?>')!==0){alert("Oops, a slight problem:\n\nThe Custom Value MUST start with your domain name.");return false}else{if(f&&!f.match(/^[1-9]+ (D|W|M|Y|L)$/)){alert("Oops, a slight problem:\n\nThe Fixed Term Length is not formatted properly.");return false}}}c.hide(),g.show(),b.post(ajaxurl,{action:"ws_plugin__s2member_reg_access_link_via_ajax",ws_plugin__s2member_reg_access_link_via_ajax:'<?php echo c_ws_plugin__s2member_utils_strings::esc_sq (wp_create_nonce ("ws-plugin--s2member-reg-access-link-via-ajax")); ?>',s2member_reg_access_link_subscr_gateway:"paypal",s2member_reg_access_link_subscr_id:i,s2member_reg_access_link_custom:h,s2member_reg_access_link_item_number:e},function(k){c.show().html('<a href="'+a(k)+'" target="_blank" rel="external">'+esc_html(k)+"</a>"),g.hide()});return false};ws_plugin__s2member_paypalSpLinkGenerate=function(){var j=b("select#ws-plugin--s2member-sp-link-leading-id").val().replace(/[^0-9]/g,"");var h=b("select#ws-plugin--s2member-sp-link-additional-ids").val()||[];var c=b("select#ws-plugin--s2member-sp-link-hours").val().replace(/[^0-9]/g,"");var d=b("p#ws-plugin--s2member-sp-link"),g=b("img#ws-plugin--s2member-sp-link-loading");if(!j){alert("Oops, a slight problem:\n\nPlease select a Leading Post/Page.\n\n*Tip* If there are no Posts/Pages in the menu, it's because you've not configured s2Member for Specific Post/Page Access yet. See: s2Member -> General Options -> Specific Post/Page Access Restrictions.");return false}for(var e=0,f=j;e<h.length;e++){if(h[e]&&h[e]!==j){f+=","+h[e]}}d.hide(),g.show(),b.post(ajaxurl,{action:"ws_plugin__s2member_sp_access_link_via_ajax",ws_plugin__s2member_sp_access_link_via_ajax:'<?php echo c_ws_plugin__s2member_utils_strings::esc_sq (wp_create_nonce ("ws-plugin--s2member-sp-access-link-via-ajax")); ?>',s2member_sp_access_link_ids:f,s2member_sp_access_link_hours:c},function(i){d.show().html('<a href="'+a(i)+'" target="_blank" rel="external">'+esc_html(i)+"</a>"),g.hide()});return false}}}}}}}});
includes/menu-pages/menu-pages-s.js CHANGED
@@ -600,7 +600,8 @@ jQuery (document).ready (function($)
600
  form += '<select property="editable" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-editable">';
601
  form += '<option value="yes"' + ( (field.editable === 'yes') ? ' selected="selected"' : '') + '">Yes ( editable )</option>';
602
  form += '<option value="no"' + ( (field.editable === 'no') ? ' selected="selected"' : '') + '">No ( uneditable after registration )</option>';
603
- form += '<option value="no-invisible"' + ( (field.editable === 'no-invisible') ? ' selected="selected"' : '') + '">No ( uneditable &amp; totally invisible )</option>';
 
604
  form += '</select><br />';
605
  form += '<small>If <code>No</code>, this field will be un-editable after registration.</small><br />';
606
  form += '<small>* Administrators are exempt from this.</small>';
600
  form += '<select property="editable" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-editable">';
601
  form += '<option value="yes"' + ( (field.editable === 'yes') ? ' selected="selected"' : '') + '">Yes ( editable )</option>';
602
  form += '<option value="no"' + ( (field.editable === 'no') ? ' selected="selected"' : '') + '">No ( uneditable after registration )</option>';
603
+ form += '<option value="no-invisible"' + ( (field.editable === 'no-invisible') ? ' selected="selected"' : '') + '">No ( uneditable &amp; totally invisible after registration )</option>';
604
+ form += '<option value="yes-invisible"' + ( (field.editable === 'yes-invisible') ? ' selected="selected"' : '') + '">Yes ( editable after registration / invisible during registration )</option>';
605
  form += '</select><br />';
606
  form += '<small>If <code>No</code>, this field will be un-editable after registration.</small><br />';
607
  form += '<small>* Administrators are exempt from this.</small>';
includes/profile.inc.php CHANGED
@@ -158,7 +158,7 @@ if (apply_filters ("ws_plugin__s2member_during_profile_during_fields_display_dis
158
  if (apply_filters ("ws_plugin__s2member_during_profile_during_fields_display_custom_fields", true, get_defined_vars ()))
159
  {
160
  if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"]) /* Now, do we have Custom Fields? */
161
- if ($fields_applicable = c_ws_plugin__s2member_custom_reg_fields::custom_fields_configured_at_level ("auto-detection"))
162
  {
163
  $fields = get_user_option ("s2member_custom_fields", $current_user->ID); /* Existing fields. */
164
  /**/
@@ -174,25 +174,22 @@ if (apply_filters ("ws_plugin__s2member_during_profile_during_fields_display_cus
174
  /**/
175
  if (in_array ($field["id"], $fields_applicable)) /* Field applicable? */
176
  {
177
- if ($field["editable"] !== "no-invisible") /* Uneditable/invisible? */
 
 
 
 
178
  {
179
- $field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field["id"]));
180
- $field_id_class = preg_replace ("/_/", "-", $field_var);
181
- /**/
182
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
183
- if (apply_filters ("ws_plugin__s2member_during_profile_during_fields_during_custom_fields_display", true, get_defined_vars ()))
184
- {
185
- echo '<tr>' . "\n";
186
- echo '<td>' . "\n";
187
- echo '<label>' . "\n";
188
- echo '<strong' . ( (preg_match ("/^(checkbox|pre_checkbox)$/", $field["type"])) ? ' style="display:none;"' : '') . '>' . $field["label"] . ( ($field["required"] === "yes") ? ' *' : '') . '</strong>' . ( (preg_match ("/^(checkbox|pre_checkbox)$/", $field["type"])) ? '' : '<br />') . "\n";
189
- echo c_ws_plugin__s2member_custom_reg_fields::custom_field_gen ("ws_plugin__s2member_profile", $field, "ws_plugin__s2member_profile_", "ws-plugin--s2member-profile-", "", ( (preg_match ("/^(select|selects)$/", $field["type"])) ? "width:100%;" : ( (preg_match ("/^(text|textarea)$/", $field["type"])) ? "width:99%;" : "")), ($tabindex = $tabindex + 10), "", $fields, $fields[$field_var], true);
190
- echo '</label>' . "\n";
191
- echo '</td>' . "\n";
192
- echo '</tr>' . "\n";
193
- }
194
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
195
  }
 
196
  }
197
  /**/
198
  eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
158
  if (apply_filters ("ws_plugin__s2member_during_profile_during_fields_display_custom_fields", true, get_defined_vars ()))
159
  {
160
  if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"]) /* Now, do we have Custom Fields? */
161
+ if ($fields_applicable = c_ws_plugin__s2member_custom_reg_fields::custom_fields_configured_at_level ("auto-detection", "profile"))
162
  {
163
  $fields = get_user_option ("s2member_custom_fields", $current_user->ID); /* Existing fields. */
164
  /**/
174
  /**/
175
  if (in_array ($field["id"], $fields_applicable)) /* Field applicable? */
176
  {
177
+ $field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field["id"]));
178
+ $field_id_class = preg_replace ("/_/", "-", $field_var);
179
+ /**/
180
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
181
+ if (apply_filters ("ws_plugin__s2member_during_profile_during_fields_during_custom_fields_display", true, get_defined_vars ()))
182
  {
183
+ echo '<tr>' . "\n";
184
+ echo '<td>' . "\n";
185
+ echo '<label>' . "\n";
186
+ echo '<strong' . ( (preg_match ("/^(checkbox|pre_checkbox)$/", $field["type"])) ? ' style="display:none;"' : '') . '>' . $field["label"] . ( ($field["required"] === "yes") ? ' *' : '') . '</strong>' . ( (preg_match ("/^(checkbox|pre_checkbox)$/", $field["type"])) ? '' : '<br />') . "\n";
187
+ echo c_ws_plugin__s2member_custom_reg_fields::custom_field_gen ("ws_plugin__s2member_profile", $field, "ws_plugin__s2member_profile_", "ws-plugin--s2member-profile-", "", ( (preg_match ("/^(select|selects)$/", $field["type"])) ? "width:100%;" : ( (preg_match ("/^(text|textarea)$/", $field["type"])) ? "width:99%;" : "")), ($tabindex = $tabindex + 10), "", $fields,$fields[$field_var], true);
188
+ echo '</label>' . "\n";
189
+ echo '</td>' . "\n";
190
+ echo '</tr>' . "\n";
 
 
 
 
 
 
 
 
191
  }
192
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
193
  }
194
  /**/
195
  eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
readme.txt CHANGED
@@ -1,7 +1,7 @@
1
  === s2Member ( Membership w/ PayPal® ) ===
2
 
3
- Version: 3.5.4
4
- Stable tag: 3.5.4
5
  Framework: WS-P-3.5
6
 
7
  SSL Compatible: yes
@@ -169,11 +169,19 @@ Yes and no. We've left this feature out of the plugin intentionally, because man
169
 
170
  == Upgrade Notice ==
171
 
172
- = 3.5.4+ =
173
  * Upgrade highly recommended. Many new features, WordPress® 3.1 compatible, speed optimizations, and several bug fixes.
174
 
175
  == Changelog ==
176
 
 
 
 
 
 
 
 
 
177
  = 3.5.4 =
178
  * **(s2Member). Bug fix.** When `s2member_force_ssl = yes`, the s2Member SSL/non-SSL Filters applied to `content_url` and `plugins_url` are now off by default. These two specific areas prevent clashes with some themes.
179
 
1
  === s2Member ( Membership w/ PayPal® ) ===
2
 
3
+ Version: 3.5.5
4
+ Stable tag: 3.5.5
5
  Framework: WS-P-3.5
6
 
7
  SSL Compatible: yes
169
 
170
  == Upgrade Notice ==
171
 
172
+ = 3.5.5+ =
173
  * Upgrade highly recommended. Many new features, WordPress® 3.1 compatible, speed optimizations, and several bug fixes.
174
 
175
  == Changelog ==
176
 
177
+ = 3.5.5 =
178
+ * **(s2Member). New feature.** It is now possible to configure Custom Registration Fields with s2Member that are NOT actually visible during the registration process. Instead, they will only be visible after registration ( i.e. during a Profile edit ). In order to accomplish this, you will need to choose this option from the dropdown menu for a specific Custom Registration Field that you configure with s2Member. This option is in the dropdown menu entitled: `Allow Profile Edits?`. You can choose: `Yes ( editable after registration / invisible during registration )`.
179
+ * **(s2Member Pro). Feature Improvement.** The display of the Coupon Code field on Pro Forms has been improved ( i.e. enhanced with an icon and the "Apply Coupon" button is now floated to the right to save space ).
180
+ * **(s2Member Pro). Compatibility / Bug fix.** This is related to some bug reports regarding `500 Internal Server Errors`. s2Member is now compatible ( i.e. capable of running in concert with ) other plugins that attempt actions dealing with `$current_user` on the `plugins_loaded` Hook for WordPress®. In an ideal world, other plugins should NOT be doing this, because the WordPress® core framework does not initialize `$current_user` until just before the `init` Hook is fired, which comes after the `plugins_loaded` Hook. However, in an effort to maximize s2Member's compatibility, s2Member has been modified to work around this potential bug, by delaying the initialization of its Filter against `user_has_cap` just a bit. If you were experiencing `500 Internal Server Errors` in previous releases of s2Member, you will want to upgrade to this version for improved compatibility with other plugin combinations.
181
+ * **(s2Member Pro). Bug fix.** s2Member Pro Forms for Free Registration were not picking up Custom Registration Fields configured at specific Membership Levels; other than Level #0. This has been resolved in s2Member Pro v1.5.5+.
182
+ * **(s2Member Pro). Feature Improvement.** This change is related to the basic ( default ) CSS rules applied to Pro Forms generated by s2Member Pro. In this release, Pro Forms now utilize the CSS3 `box-sizing` specification to correct slight imperfections in the width of forms fields ( i.e. the difference between `select` and `input` ). This specification is supported by all modern browsers, including IE8. s2Member also degrades with a "best guess" workaround for IE 7 browsers. Reference article [here](http://css-tricks.com/box-sizing/).
183
+ * **(s2Member/s2Member Pro). Roadmap.** Barring any serious bug reports, this will be the last release in the 3.5.x series of s2Member and the 1.5.x series of s2Member Pro. The next releases will include substantial changes ( internally ) related to the handling of variables; further optimizing the entire codebase. In addition, there are plans to integrate some new functionality for Content Dripping in the next release. The next releases should be ready around the end of April 2011.
184
+
185
  = 3.5.4 =
186
  * **(s2Member). Bug fix.** When `s2member_force_ssl = yes`, the s2Member SSL/non-SSL Filters applied to `content_url` and `plugins_url` are now off by default. These two specific areas prevent clashes with some themes.
187
 
s2member.php CHANGED
@@ -9,8 +9,8 @@ along with this software. In the main directory, see: /licensing/
9
  If not, see: <http://www.gnu.org/licenses/>.
10
  */
11
  /*
12
- Version: 3.5.4
13
- Stable tag: 3.5.4
14
  Framework: WS-P-3.5
15
 
16
  SSL Compatible: yes
@@ -54,10 +54,10 @@ if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
54
  /*
55
  Define versions.
56
  */
57
- define ("WS_PLUGIN__S2MEMBER_VERSION", "3.5.4");
58
- define ("WS_PLUGIN__S2MEMBER_MIN_PHP_VERSION", "5.2");
59
- define ("WS_PLUGIN__S2MEMBER_MIN_WP_VERSION", "3.0");
60
- define ("WS_PLUGIN__S2MEMBER_MIN_PRO_VERSION", "1.5.3");
61
  /*
62
  Compatibility checks.
63
  */
@@ -83,8 +83,8 @@ if (version_compare (PHP_VERSION, WS_PLUGIN__S2MEMBER_MIN_PHP_VERSION, ">=") &&
83
  /*
84
  Load a possible Pro module, if/when available.
85
  */
86
- if (apply_filters ("ws_plugin__s2member_load_pro", true))
87
- @include_once dirname (__FILE__) . "-pro/pro-module.php";
88
  /*
89
  Configure options and their defaults.
90
  */
9
  If not, see: <http://www.gnu.org/licenses/>.
10
  */
11
  /*
12
+ Version: 3.5.5
13
+ Stable tag: 3.5.5
14
  Framework: WS-P-3.5
15
 
16
  SSL Compatible: yes
54
  /*
55
  Define versions.
56
  */
57
+ @define ("WS_PLUGIN__S2MEMBER_VERSION", "3.5.5");
58
+ @define ("WS_PLUGIN__S2MEMBER_MIN_PHP_VERSION", "5.2");
59
+ @define ("WS_PLUGIN__S2MEMBER_MIN_WP_VERSION", "3.0");
60
+ @define ("WS_PLUGIN__S2MEMBER_MIN_PRO_VERSION", "1.5.5");
61
  /*
62
  Compatibility checks.
63
  */
83
  /*
84
  Load a possible Pro module, if/when available.
85
  */
86
+ if (apply_filters ("ws_plugin__s2member_load_pro", true) && file_exists (dirname (__FILE__) . "-pro/pro-module.php"))
87
+ include_once dirname (__FILE__) . "-pro/pro-module.php";
88
  /*
89
  Configure options and their defaults.
90
  */