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

Version Description

  • Custom Fields ( new features ). s2Member is now equipped with a VERY powerful set of features; designed to extend the functionality of Custom Fields. s2Member now supports Text Fields ( single/multi-line ), Checkboxes ( single/multi-option ), Radio Buttons ( single/multi-option ), and Dropdowns ( single/multi-option ). In addition, with s2Member it is now possible to configure Custom Fields differently for each Membership Level. Other tools: including Validation Formats and Visibility are also available. For full details, check your Dashboard under: s2Member -> General Options -> Custom Fields.
  • Attn Developers ( before upgrading ). Hooks/Filters ( e.g. those related to Custom Fields ) have been modified in ways that may break custom scripts you've created to work with previous versions of s2Member. We suggest dropping all of your Hooks/Filters related to Custom Fields. Instead, use the NEW improved tools w/s2Member v3.2.7+. Please see: s2Member -> General Options -> Custom Fields.
  • BuddyPress/Multisite. A plugin conflict was resolved between BuddyPress/s2Member when both of these plugins were installed on a Multisite Network together. BuddyPress bypasses the default Filter ( pre_site_option_registration ) and instead, it uses: bp_core_get_site_options(). This has been resolved in s2Member v3.2.6+.
  • Bug fix. A bug was found in s2Member's handling of Custom Fields columns. This minor bug was conflicting with other plugins that attempt to create User-based columns. This was been resolved in s2Member v3.2.7+.
  • New Shortcode attribute. s2Member's PayPal Button Shortcode now accepts a new attribute ( ta="0.00", Trial Amount ). In the past, if you intended to offer a "paid" initial period at a different price, you had to use the Full Button Code. Now you can just change the ta="0.00" attribute ( which is easier ).
  • More informative. s2Member now generates warnings for newbies that create conflicts between their Membership Options Page and Login Welcome Page. s2Member is now capable of detecting the most common conflicts, in order to produce informative messages that assist site owners.
  • Login/Registration Design. s2Member v3.2.7+ includes additional customization tools that allow font sizes and font families to be configured for the Login/Registration system. In your Dashboard, go to: s2Member -> General Options -> Login/Registration Design.
  • Bug fix. The Default Profile Editing Panel ( e.g. /wp-admin/profile.php ) was NOT validating Custom Fields. s2Member v3.2.7 resolves this for Users/Members. Administrators are exempt ( the intended functionality ).
  • Better instructions inside in the General Options panel for s2Member. Just a few subtle improvements based on User feedback. Hopefully these will make life a little easier for newbies.
Download this release

Release Info

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

Code changes from version 3.2.5 to 3.2.7

Files changed (52) hide show
  1. images/add-icon.fla +0 -0
  2. images/add-icon.png +0 -0
  3. images/arrow-down-icon.fla +0 -0
  4. images/arrow-down-icon.png +0 -0
  5. images/arrow-up-icon.fla +0 -0
  6. images/arrow-up-icon.png +0 -0
  7. images/delete-icon.png +0 -0
  8. images/edit-icon.png +0 -0
  9. includes/dropins/bridges/_s2member-bbpress-bridge.php +1 -1
  10. includes/functions/activate-deactivate.inc.php +6 -0
  11. includes/functions/api-functions.inc.php +12 -0
  12. includes/functions/config-user-registration.inc.php +598 -0
  13. includes/functions/css-js-w-globals.inc.php +8 -8
  14. includes/functions/custom-reg-fields.inc.php +453 -0
  15. includes/functions/demo-users.inc.php +39 -0
  16. includes/functions/demotions.inc.php +0 -29
  17. includes/functions/email-configs.inc.php +19 -1
  18. includes/functions/force-options.inc.php +271 -0
  19. includes/functions/list-servers.inc.php +21 -21
  20. includes/functions/login-customizations.inc.php +32 -15
  21. includes/functions/menu-pages.inc.php +72 -74
  22. includes/functions/meta-boxes.inc.php +5 -7
  23. includes/functions/page-level-access.inc.php +2 -2
  24. includes/functions/passwords.inc.php +47 -0
  25. includes/functions/paypal-button.inc.php +4 -8
  26. includes/functions/post-level-access.inc.php +2 -2
  27. includes/functions/profile-modifications.inc.php +23 -24
  28. includes/functions/register-access.inc.php +0 -1387
  29. includes/functions/sc-get-details.inc.php +8 -30
  30. includes/functions/separates/paypal-notify.inc.php +2 -0
  31. includes/functions/separates/paypal-return.inc.php +1 -0
  32. includes/functions/user-new.inc.php +249 -0
  33. includes/functions/users-list.inc.php +209 -209
  34. includes/functions/utilities.inc.php +44 -10
  35. includes/hooks.inc.php +1 -0
  36. includes/menu-pages/code-samples/sc-s2-conditional-supplements-1.php +3 -0
  37. includes/menu-pages/info.inc.php +1 -1
  38. includes/menu-pages/jquery-ui-effects.js +220 -0
  39. includes/menu-pages/json-functions.js +1 -0
  40. includes/menu-pages/menu-pages-s-min.js +1 -1
  41. includes/menu-pages/menu-pages-s.css +110 -0
  42. includes/menu-pages/menu-pages-s.js +652 -3
  43. includes/menu-pages/options.inc.php +72 -14
  44. includes/menu-pages/paypal-buttons.inc.php +17 -17
  45. includes/profile.inc.php +67 -66
  46. includes/s2member-min.js +1 -1
  47. includes/s2member.css +13 -3
  48. includes/s2member.js +211 -35
  49. includes/syscon.inc.php +388 -379
  50. includes/templates/shortcodes/paypal-checkout-button-shortcode.html +1 -1
  51. readme.txt +20 -9
  52. s2member.php +6 -6
images/add-icon.fla ADDED
Binary file
images/add-icon.png ADDED
Binary file
images/arrow-down-icon.fla ADDED
Binary file
images/arrow-down-icon.png ADDED
Binary file
images/arrow-up-icon.fla ADDED
Binary file
images/arrow-up-icon.png ADDED
Binary file
images/delete-icon.png ADDED
Binary file
images/edit-icon.png ADDED
Binary file
includes/dropins/bridges/_s2member-bbpress-bridge.php CHANGED
@@ -18,8 +18,8 @@ Donate link: http://www.primothemes.com/donate/
18
Plugin Name: s2Member Bridge
19
Pro Module / Prices: http://www.s2member.com/prices/
20
Forum URI: http://www.primothemes.com/forums/viewforum.php?f=4
21
- Plugin URI: http://www.primothemes.com/post/s2member-membership-plugin-with-paypal/
22
Professional Installation URI: http://www.primothemes.com/forums/viewtopic.php?f=4&t=107
23
Description: Blocks all non-Member access to bbPress® forums. Only the login-page is available. Forum registration is redirected to your Membership Options Page for s2Member ( on your main WordPress® installation ). This way, a visitor can signup on your site, and gain Membership Access to your forums. This plugin will NOT work, until you've successfully integrated WordPress® into bbPress®. See: `bbPress® -> Settings -> WordPress® Integration`.
24
Tags: membership, members, member, register, signup, paypal, pay pal, s2member, subscriber, members only, bbpress, bb press, forums, forum, buddypress, buddy press, buddy press compatible, shopping cart, checkout, api, options panel included, websharks framework, w3c validated code, multi widget support, includes extensive documentation, highly extensible
25
*/
18
Plugin Name: s2Member Bridge
19
Pro Module / Prices: http://www.s2member.com/prices/
20
Forum URI: http://www.primothemes.com/forums/viewforum.php?f=4
21
Professional Installation URI: http://www.primothemes.com/forums/viewtopic.php?f=4&t=107
22
+ Plugin URI: http://www.primothemes.com/post/product/s2member-membership-plugin-with-paypal/
23
Description: Blocks all non-Member access to bbPress® forums. Only the login-page is available. Forum registration is redirected to your Membership Options Page for s2Member ( on your main WordPress® installation ). This way, a visitor can signup on your site, and gain Membership Access to your forums. This plugin will NOT work, until you've successfully integrated WordPress® into bbPress®. See: `bbPress® -> Settings -> WordPress® Integration`.
24
Tags: membership, members, member, register, signup, paypal, pay pal, s2member, subscriber, members only, bbpress, bb press, forums, forum, buddypress, buddy press, buddy press compatible, shopping cart, checkout, api, options panel included, websharks framework, w3c validated code, multi widget support, includes extensive documentation, highly extensible
25
*/
includes/functions/activate-deactivate.inc.php CHANGED
@@ -184,6 +184,12 @@ if (!function_exists ("ws_plugin__s2member_activate"))
184
$wpdb->query ("DELETE FROM `" . $wpdb->options . "` WHERE `option_name` LIKE '\_transient\_%'");
185
}
186
/**/
187
$notice = '<strong>s2Member</strong> has been <strong>re-activated</strong>, with the latest version.<br />';
188
$notice .= 'You now have version ' . WS_PLUGIN__S2MEMBER_VERSION . '. Your existing configuration remains.';
189
/**/
184
$wpdb->query ("DELETE FROM `" . $wpdb->options . "` WHERE `option_name` LIKE '\_transient\_%'");
185
}
186
/**/
187
+ if (!$v || !version_compare ($v, "3.2.6", ">=")) /* Needs to be upgraded? */
188
+ /* Version 3.2.6 fixed `s2member_ccaps_req` being stored empty and/or w/ one empty element in the array. */
189
+ {
190
+ $wpdb->query ("DELETE FROM `" . $wpdb->postmeta . "` WHERE `meta_key` = 's2member_ccaps_req' AND `meta_value` IN('','a:0:{}','a:1:{i:0;s:0:\"\";}')");
191
+ }
192
+ /**/
193
$notice = '<strong>s2Member</strong> has been <strong>re-activated</strong>, with the latest version.<br />';
194
$notice .= 'You now have version ' . WS_PLUGIN__S2MEMBER_VERSION . '. Your existing configuration remains.';
195
/**/
includes/functions/api-functions.inc.php CHANGED
@@ -429,4 +429,16 @@ if (!function_exists ("s2member_file_download_key"))
429
return ws_plugin__s2member_file_download_key ($file, $cache_compatible);
430
}
431
}
432
?>
429
return ws_plugin__s2member_file_download_key ($file, $cache_compatible);
430
}
431
}
432
+ /*
433
+ Retrieves a Custom Field value.
434
+ $field_id - required argument.
435
+ $user_id - defaults to current user.
436
+ */
437
+ if (!function_exists ("get_user_field"))
438
+ {
439
+ function get_user_field ($field_id = FALSE, $user_id = FALSE)
440
+ {
441
+ return ws_plugin__s2member_get_user_field ($field_id, $user_id);
442
+ }
443
+ }
444
?>
includes/functions/config-user-registration.inc.php ADDED
@@ -0,0 +1,598 @@
1
+ <?php
2
+ /*
3
+ Copyright: © 2009 WebSharks, Inc. ( coded in the USA )
4
+ <mailto:support@websharks-inc.com> <http://www.websharks-inc.com/>
5
+
6
+ Released under the terms of the GNU General Public License.
7
+ You should have received a copy of the GNU General Public License,
8
+ along with this software. In the main directory, see: /licensing/
9
+ If not, see: <http://www.gnu.org/licenses/>.
10
+ */
11
+ /*
12
+ Direct access denial.
13
+ */
14
+ if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit ("Do not access this file directly.");
16
+ /*
17
+ Function that adds hidden fields to POST vars on signup.
18
+ Attach to: add_filter("signup_hidden_fields");
19
+
20
+ This can ONLY be fired through wp-signup.php on the front-side.
21
+ */
22
+ if (!function_exists ("ws_plugin__s2member_ms_process_signup_hidden_fields"))
23
+ {
24
+ function ws_plugin__s2member_ms_process_signup_hidden_fields ()
25
+ {
26
+ do_action ("ws_plugin__s2member_before_ms_process_signup_hidden_fields", get_defined_vars ());
27
+ /**/
28
+ if (is_multisite ()) /* This event should ONLY be processed with Multisite Networking, on a Blog Farm. */
29
+ if (ws_plugin__s2member_is_multisite_farm () && is_main_site () && preg_match ("/\/wp-signup\.php/", $_SERVER["REQUEST_URI"]) && $_POST["stage"] === "validate-user-signup")
30
+ {
31
+ foreach ((array)ws_plugin__s2member_trim_deep (stripslashes_deep ($_POST)) as $key => $value)
32
+ if (preg_match ("/^ws_plugin__s2member_(custom_reg_field|user_new)_/", $key))
33
+ if ($key = preg_replace ("/_user_new_/", "_custom_reg_field_", $key))
34
+ echo '<input type="hidden" name="' . esc_attr ($key) . '" value="' . esc_attr (maybe_serialize ($value)) . '" />' . "\n";
35
+ /**/
36
+ do_action ("ws_plugin__s2member_during_ms_process_signup_hidden_fields", get_defined_vars ());
37
+ }
38
+ /**/
39
+ do_action ("ws_plugin__s2member_after_ms_process_signup_hidden_fields", get_defined_vars ());
40
+ }
41
+ }
42
+ /*
43
+ Function that adds customs fields to $meta on signup.
44
+ Attach to: add_filter("add_signup_meta");
45
+
46
+ This can be fired through wp-signup.php on the front-side,
47
+ or possibly through user-new.php in the admin.
48
+ */
49
+ if (!function_exists ("ws_plugin__s2member_ms_process_signup_meta"))
50
+ {
51
+ function ws_plugin__s2member_ms_process_signup_meta ($meta = FALSE)
52
+ {
53
+ global $pagenow; /* Need this to detect the current admin page. */
54
+ /**/
55
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
56
+ do_action ("ws_plugin__s2member_before_ms_process_signup_meta", get_defined_vars ());
57
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
58
+ /**/
59
+ if (is_multisite ()) /* This event should ONLY be processed with Multisite Networking. Either in the admin, or on a Blog Farm through wp-signup.php. */
60
+ if ((is_admin () && $pagenow === "user-new.php") || (ws_plugin__s2member_is_multisite_farm () && is_main_site () && preg_match ("/\/wp-signup\.php/", $_SERVER["REQUEST_URI"]) && preg_match ("/^validate-(user|blog)-signup#x2F;", $_POST["stage"])))
61
+ {
62
+ ws_plugin__s2member_email_config (); /* Configures From: header that will be used in notifications. */
63
+ /**/
64
+ foreach ((array)ws_plugin__s2member_trim_deep (stripslashes_deep ($_POST)) as $key => $value)
65
+ if (preg_match ("/^ws_plugin__s2member_(custom_reg_field|user_new)_/", $key))
66
+ if ($key = preg_replace ("/_user_new_/", "_custom_reg_field_", $key))
67
+ $meta["s2member_ms_signup_meta"][$key] = maybe_unserialize ($value);
68
+ }
69
+ /**/
70
+ return apply_filters ("ws_plugin__s2member_ms_process_signup_meta", $meta, get_defined_vars ());
71
+ }
72
+ }
73
+ /*
74
+ Function for configuring new users.
75
+ Attach to: add_action("wpmu_activate_user");
76
+
77
+ This does NOT fire for a Super Admin managing Network Users.
78
+ Which is good. A Super Admin will NOT trigger this event.
79
+ ~ They fire wpmu_create_user(), bypassing activation.
80
+ - through ms-edit.php.
81
+
82
+ However, a Super Admin CAN trigger this event by adding a new User through the Users -> Add New menu.
83
+ ~ If they choose to bypass activation; an activation IS fired immediately. Otherwise, it's delayed.
84
+ - via user-new.php.
85
+
86
+ So this function may get fired inside the admin panel ( user-new.php ).
87
+ Or also during an actual activation; through wp-activate.php.
88
+ */
89
+ if (!function_exists ("ws_plugin__s2member_configure_user_on_ms_user_activation"))
90
+ {
91
+ function ws_plugin__s2member_configure_user_on_ms_user_activation ($user_id = FALSE, $password = FALSE, $meta = FALSE)
92
+ {
93
+ global $pagenow; /* Need this to detect the current admin page. */
94
+ /**/
95
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
96
+ do_action ("ws_plugin__s2member_before_configure_user_on_ms_user_activation", get_defined_vars ());
97
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
98
+ /**/
99
+ if (is_multisite ()) /* This event should ONLY be processed with Multisite Networking. */
100
+ if ((is_admin () && $pagenow === "user-new.php") || (!is_admin () && preg_match ("/\/wp-activate\.php/", $_SERVER["REQUEST_URI"])))
101
+ {
102
+ ws_plugin__s2member_configure_user_registration ($user_id, $password, $meta["s2member_ms_signup_meta"]);
103
+ delete_user_meta ($user_id, "s2member_ms_signup_meta");
104
+ }
105
+ /**/
106
+ do_action ("ws_plugin__s2member_after_configure_user_on_ms_user_activation", get_defined_vars ());
107
+ /**/
108
+ return;
109
+ }
110
+ }
111
+ /*
112
+ Function for configuring new users.
113
+ Attach to: add_action("wpmu_activate_blog");
114
+
115
+ This does NOT fire for a Super Admin managing Network Blogs.
116
+ ~ Actually they do; BUT it's blocked by the routine below.
117
+ Which is good. A Super Admin should NOT trigger this event.
118
+
119
+ This function should ONLY be fired through wp-activate.php.
120
+ */
121
+ if (!function_exists ("ws_plugin__s2member_configure_user_on_ms_blog_activation"))
122
+ {
123
+ function ws_plugin__s2member_configure_user_on_ms_blog_activation ($blog_id = FALSE, $user_id = FALSE, $password = FALSE, $title = FALSE, $meta = FALSE)
124
+ {
125
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
126
+ do_action ("ws_plugin__s2member_before_configure_user_on_ms_blog_activation", get_defined_vars ());
127
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
128
+ /**/
129
+ if (is_multisite ()) /* This event should ONLY be processed with Multisite Networking. */
130
+ if (!is_admin () && preg_match ("/\/wp-activate\.php/", $_SERVER["REQUEST_URI"])) /* ONLY `wp-activate.php`. */
131
+ {
132
+ ws_plugin__s2member_configure_user_registration ($user_id, $password, $meta["s2member_ms_signup_meta"]);
133
+ delete_user_meta ($user_id, "s2member_ms_signup_meta");
134
+ }
135
+ /**/
136
+ do_action ("ws_plugin__s2member_after_configure_user_on_ms_blog_activation", get_defined_vars ());
137
+ /**/
138
+ return;
139
+ }
140
+ }
141
+ /*
142
+ Function for configuring new users.
143
+ Attach to: add_action("user_register");
144
+
145
+ This also receives Multisite events.
146
+ Attach to: add_action("wpmu_activate_user");
147
+ Attach to: add_action("wpmu_activate_blog");
148
+
149
+ The Hook `user_register` is also fired by calling:
150
+ wpmu_create_user()
151
+
152
+ This function also receives simulated events from s2Member Pro.
153
+ */
154
+ if (!function_exists ("ws_plugin__s2member_configure_user_registration"))
155
+ {
156
+ function ws_plugin__s2member_configure_user_registration ($user_id = FALSE, $password = FALSE, $meta = FALSE)
157
+ {
158
+ global $wpdb; /* Global database object may be required for this routine. */
159
+ global $pagenow; /* Need this to detect the current admin page. */
160
+ global $current_site, $current_blog; /* Multisite Networking. */
161
+ static $email_config, $processed; /* No duplicate processing. */
162
+ /**/
163
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
164
+ do_action ("ws_plugin__s2member_before_configure_user_registration", get_defined_vars ());
165
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
166
+ /**/
167
+ /* With Multisite Networking, we need this to run on `user_register` ahead of `wpmu_activate_user|blog`. */
168
+ if (!$email_config && ($email_config = true)) /* Anytime this routine is fired; we config email; no exceptions. */
169
+ ws_plugin__s2member_email_config (); /* Configures From: header that will be used in new user notifications. */
170
+ /**/
171
+ if (!$processed /* Process only once. Safeguard this routine against duplicate processing via plugins ( or even WordPress® itself ). */
172
+ && (is_array ($_POST = ws_plugin__s2member_trim_deep (stripslashes_deep ($_POST))) || is_array (ws_plugin__s2member_trim_deep (stripslashes_deep ($meta))))/**/
173
+ /**/
174
+ /* 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. */
175
+ && ! (is_admin () && is_multisite () && $pagenow === "user-new.php" && isset ($_POST["noconfirmation"]) && is_super_admin () && empty ($meta))/**/
176
+ && ! (preg_match ("/\/wp-activate\.php/", $_SERVER["REQUEST_URI"]) && empty ($meta)) /* If activating; we MUST have a meta array. */
177
+ /* The $meta array is ONLY filled by hand-offs from `wpmu_activate_user|blog`. So this is how we check for these events. */
178
+ /**/
179
+ && $user_id && is_object ($user = new WP_User ($user_id)) && $user->ID && ($processed = true)) /* Process only once. */
180
+ {
181
+ foreach ((array)$_POST as $key => $value) /* Scan $_POST vars; adding `custom_reg_field` uniformity keys. */
182
+ if (preg_match ("/^ws_plugin__s2member_user_new_/", $key)) /* Looking for `user_new` keys here. */
183
+ if ($key = preg_replace ("/_user_new_/", "_custom_reg_field_", $key))
184
+ $_POST[$key] = $value; /* Add these keys for uniformity. */
185
+ unset ($key, $value); /* Prevents bleeding vars into Hooks/Filters. */
186
+ /**/
187
+ if (!is_admin () && ($_POST["ws_plugin__s2member_custom_reg_field_s2member_custom"] || $_POST["ws_plugin__s2member_custom_reg_field_s2member_subscr_id"] || $_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"]))
188
+ exit ("s2Member security violation. You attempted to POST variables that will NOT be trusted!");
189
+ /**/
190
+ $_pm = array_merge ((array)$_POST, (array)$meta); /* Merge these two data sources together now. However, ALWAYS after the security routine above ^. */
191
+ /**/
192
+ if (!is_admin () /* Only run this particular routine whenever a Member [1-4] is registering themselves with cookies. */
193
+ && ($subscr_id = ws_plugin__s2member_decrypt ($_COOKIE["s2member_subscr_id"])) && preg_match ("/^" . preg_quote (preg_replace ("/\:([0-9]+)#x2F;", "", $_SERVER["HTTP_HOST"]), "/") . "/i", ($custom = ws_plugin__s2member_decrypt ($_COOKIE["s2member_custom"]))) && preg_match ("/^[1-4](\:|$)([a-z_0-9,]+)?(\:)?([0-9]+ [A-Z])?#x2F;", ($level = ws_plugin__s2member_decrypt ($_COOKIE["s2member_level"])))/**/
194
+ && (!$usermeta = $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")))
195
+ /* ^ This is for security ^ It checks the database to make sure the User/Member has not already registered in the past, with the same Paid Subscr. ID. */
196
+ { /*
197
+ This routine could be processed through `wp-login.php?action=register` - OR - through `wp-activate.php`.
198
+ If processed through `wp-activate.php`, it could've originated inside the admin, via `user-new.php`.
199
+ This may also be processed through BuddyPress, or another plugin calling `user_register`.
200
+ */
201
+ $processed = "yes"; /* Mark this as yes, to indicate that a routine was processed. */
202
+ /**/
203
+ list ($level, $ccaps, $eotper) = preg_split ("/\:/", $level, 3);
204
+ $role = "s2member_level" . $level; /* Level 1-4. */
205
+ /**/
206
+ $email = $user->user_email;
207
+ $login = $user->user_login;
208
+ $ip = $_SERVER["REMOTE_ADDR"];
209
+ $cv = preg_split ("/\|/", $custom);
210
+ /**/
211
+ if ($eotper) /* If a specific EOT Period has been attached; we need to calculate that now. */
212
+ $auto_eot_time = ws_plugin__s2member_paypal_auto_eot_time (0, 0, 0, $eotper);
213
+ /**/
214
+ $notes = $_pm["ws_plugin__s2member_custom_reg_field_s2member_notes"];
215
+ /**/
216
+ $opt_in = (!$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in"]) ? true : false;
217
+ $opt_in = (!$opt_in && $_pm["ws_plugin__s2member_custom_reg_field_opt_in"]) ? true : $opt_in;
218
+ /**/
219
+ if (! ($fname = $user->first_name))
220
+ if ($_pm["ws_plugin__s2member_custom_reg_field_first_name"])
221
+ $fname = $_pm["ws_plugin__s2member_custom_reg_field_first_name"];
222
+ /**/
223
+ if (!$fname) /* Also try BuddyPress. */
224
+ if ($_pm["field_1"]) /* BuddyPress. */
225
+ $fname = trim (preg_replace ("/ (.*)#x2F;", "", $_pm["field_1"]));
226
+ /**/
227
+ if (! ($lname = $user->last_name))
228
+ if ($_pm["ws_plugin__s2member_custom_reg_field_last_name"])
229
+ $lname = $_pm["ws_plugin__s2member_custom_reg_field_last_name"];
230
+ /**/
231
+ if (!$lname) /* Also try BuddyPress. */
232
+ if ($_pm["field_1"] && preg_match ("/^(.+?) (.+)#x2F;", $_pm["field_1"]))
233
+ $lname = trim (preg_replace ("/^(.+?) (.+)#x2F;", "$2", $_pm["field_1"]));
234
+ /**/
235
+ $name = trim ($fname . " " . $lname); /* Both names. */
236
+ /**/
237
+ if (! ($pass = $password)) /* Try s2Member's generator. */
238
+ if ($GLOBALS["ws_plugin__s2member_generate_password_return"])
239
+ $pass = $GLOBALS["ws_plugin__s2member_generate_password_return"];
240
+ /**/
241
+ if (!$pass) /* Also try BuddyPress password. */
242
+ if ($_pm["signup_password"]) /* BuddyPress. */
243
+ $pass = $_pm["signup_password"];
244
+ /**/
245
+ if ($pass) /* No password nag. Update this globally. */
246
+ {
247
+ delete_user_setting ("default_password_nag"); /* setcookie() */
248
+ update_user_option ($user_id, "default_password_nag", false, true);
249
+ }
250
+ /**/
251
+ update_user_option ($user_id, "s2member_auto_eot_time", $auto_eot_time);
252
+ update_user_option ($user_id, "s2member_subscr_id", $subscr_id);
253
+ update_user_option ($user_id, "s2member_custom", $custom);
254
+ update_user_option ($user_id, "s2member_notes", $notes);
255
+ /**/
256
+ if (!$user->first_name && $fname)
257
+ update_user_meta ($user_id, "first_name", $fname) ./**/
258
+ wp_update_user (array ("ID" => $user_id, "display_name" => $fname));
259
+ /**/
260
+ if (!$user->last_name && $lname)
261
+ update_user_meta ($user_id, "last_name", $lname);
262
+ /**/
263
+ if (is_multisite ()) /* Originating Blog ID#, and adjust Main Site permissions. */
264
+ {
265
+ (!is_main_site ()) ? remove_user_from_blog ($user_id, $current_site->blog_id) : null;
266
+ update_user_meta ($user_id, "s2member_originating_blog", $current_blog->blog_id);
267
+ }
268
+ /**/
269
+ $user->set_role ($role); /* s2Member. */
270
+ /**/
271
+ if ($ccaps) /* Add Custom Capabilities. */
272
+ foreach (preg_split ("/[\r\n\t\s;,]+/", $ccaps) as $ccap)
273
+ if (strlen ($ccap)) /* Don't add empty capabilities. */
274
+ $user->add_cap ("access_s2member_ccap_" . trim (strtolower ($ccap)));
275
+ /**/
276
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"])
277
+ foreach (json_decode ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"], true) as $field)
278
+ {
279
+ $field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field["id"]));
280
+ $field_id_class = preg_replace ("/_/", "-", $field_var);
281
+ /**/
282
+ if (isset ($_pm["ws_plugin__s2member_custom_reg_field_" . $field_var]))
283
+ $fields[$field_var] = $_pm["ws_plugin__s2member_custom_reg_field_" . $field_var];
284
+ }
285
+ /**/
286
+ update_user_option ($user_id, "s2member_custom_fields", $fields);
287
+ /**/
288
+ if (($transient = md5 ("s2member_transient_ipn_subscr_payment_" . $subscr_id)) && is_array ($subscr_payment = get_transient ($transient)))
289
+ {
290
+ $proxy = array ("s2member_paypal_notify" => "1", "s2member_paypal_proxy" => "s2member_transient_ipn_subscr_payment");
291
+ ws_plugin__s2member_remote (add_query_arg ($proxy, get_bloginfo ("wpurl")), stripslashes_deep ($subscr_payment), array ("timeout" => 20));
292
+ delete_transient($transient);
293
+ }
294
+ /**/
295
+ setcookie ("s2member_signup_tracking", ws_plugin__s2member_encrypt ($subscr_id), time () + 31556926, "/");
296
+ /**/
297
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
298
+ do_action ("ws_plugin__s2member_during_configure_user_registration_front_side", get_defined_vars ());
299
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
300
+ }
301
+ /**/
302
+ else if (!is_admin ()) /* Otherwise, if we are NOT inside the Dashboard during the creation of this account. */
303
+ { /*
304
+ This routine could be processed through `wp-login.php?action=register` - OR - through `wp-activate.php`.
305
+ If processed through `wp-activate.php`, it could've originated inside the admin, via `user-new.php`.
306
+ This may also be processed through BuddyPress, or another plugin calling `user_register`.
307
+ */
308
+ $processed = "yes"; /* Mark this as yes, to indicate that a routine was processed. */
309
+ /**/
310
+ $role = $role = $user->roles[0]; /* If they already have a Role, we can use it. */
311
+ $role = (!$role && is_multisite () && is_main_site ()) ? get_site_option ("default_user_role") : $role;
312
+ $role = (!$role) ? get_option ("default_role") : $role; /* Otherwise, the default role. */
313
+ /**/
314
+ $level = (preg_match ("/^(administrator|editor|author|contributor)#x2F;i", $role)) ? "4" : $level;
315
+ $level = (!$level && preg_match ("/^s2member_level[1-4]#x2F;i", $role)) ? preg_replace ("/^s2member_level/", "", $role) : $level;
316
+ $level = (!$level && preg_match ("/^subscriber#x2F;i", $role)) ? "0" : $level;
317
+ $level = (!$level) ? "0" : $level;
318
+ /**/
319
+ $ccaps = $_pm["ws_plugin__s2member_custom_reg_field_s2member_ccaps"];
320
+ /**/
321
+ $email = $user->user_email;
322
+ $login = $user->user_login;
323
+ $ip = $_SERVER["REMOTE_ADDR"];
324
+ $custom = $_pm["ws_plugin__s2member_custom_reg_field_s2member_custom"];
325
+ $subscr_id = $_pm["ws_plugin__s2member_custom_reg_field_s2member_subscr_id"];
326
+ $cv = preg_split ("/\|/", $_pm["ws_plugin__s2member_custom_reg_field_s2member_custom"]);
327
+ /**/
328
+ $auto_eot_time = ($eot = $_pm["ws_plugin__s2member_custom_reg_field_s2member_auto_eot_time"]) ? strtotime ($eot) : "";
329
+ $notes = $_pm["ws_plugin__s2member_custom_reg_field_s2member_notes"];
330
+ /**/
331
+ $opt_in = (!$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in"]) ? true : false;
332
+ $opt_in = (!$opt_in && $_pm["ws_plugin__s2member_custom_reg_field_opt_in"]) ? true : $opt_in;
333
+ /**/
334
+ if (! ($fname = $user->first_name))
335
+ if ($_pm["ws_plugin__s2member_custom_reg_field_first_name"])
336
+ $fname = $_pm["ws_plugin__s2member_custom_reg_field_first_name"];
337
+ /**/
338
+ if (!$fname) /* Also try BuddyPress. */
339
+ if ($_pm["field_1"]) /* BuddyPress. */
340
+ $fname = trim (preg_replace ("/ (.*)#x2F;", "", $_pm["field_1"]));
341
+ /**/
342
+ if (! ($lname = $user->last_name))
343
+ if ($_pm["ws_plugin__s2member_custom_reg_field_last_name"])
344
+ $lname = $_pm["ws_plugin__s2member_custom_reg_field_last_name"];
345
+ /**/
346
+ if (!$lname) /* Also try BuddyPress. */
347
+ if ($_pm["field_1"] && preg_match ("/^(.+?) (.+)#x2F;", $_pm["field_1"]))
348
+ $lname = trim (preg_replace ("/^(.+?) (.+)#x2F;", "$2", $_pm["field_1"]));
349
+ /**/
350
+ $name = trim ($fname . " " . $lname); /* Both names. */
351
+ /**/
352
+ if (! ($pass = $password)) /* Try s2Member's generator. */
353
+ if ($GLOBALS["ws_plugin__s2member_generate_password_return"])
354
+ $pass = $GLOBALS["ws_plugin__s2member_generate_password_return"];
355
+ /**/
356
+ if (!$pass) /* Also try BuddyPress password. */
357
+ if ($_pm["signup_password"]) /* BuddyPress. */
358
+ $pass = $_pm["signup_password"];
359
+ /**/
360
+ if ($pass) /* No password nag. Update this globally. */
361
+ {
362
+ delete_user_setting ("default_password_nag"); /* setcookie() */
363
+ update_user_option ($user_id, "default_password_nag", false, true);
364
+ }
365
+ /**/
366
+ update_user_option ($user_id, "s2member_auto_eot_time", $auto_eot_time);
367
+ update_user_option ($user_id, "s2member_subscr_id", $subscr_id);
368
+ update_user_option ($user_id, "s2member_custom", $custom);
369
+ update_user_option ($user_id, "s2member_notes", $notes);
370
+ /**/
371
+ if (!$user->first_name && $fname)
372
+ update_user_meta ($user_id, "first_name", $fname) ./**/
373
+ wp_update_user (array ("ID" => $user_id, "display_name" => $fname));
374
+ /**/
375
+ if (!$user->last_name && $lname)
376
+ update_user_meta ($user_id, "last_name", $lname);
377
+ /**/
378
+ if (is_multisite ()) /* Originating Blog ID#, and adjust Main Site permissions. */
379
+ {
380
+ (!is_main_site ()) ? remove_user_from_blog ($user_id, $current_site->blog_id) : null;
381
+ update_user_meta ($user_id, "s2member_originating_blog", $current_blog->blog_id);
382
+ }
383
+ /**/
384
+ $user->set_role ($role); /* s2Member. */
385
+ /**/
386
+ if ($ccaps) /* Add Custom Capabilities. */
387
+ foreach (preg_split ("/[\r\n\t\s;,]+/", $ccaps) as $ccap)
388
+ if (strlen ($ccap)) /* Don't add empty capabilities. */
389
+ $user->add_cap ("access_s2member_ccap_" . trim (strtolower ($ccap)));
390
+ /**/
391
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"])
392
+ foreach (json_decode ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"], true) as $field)
393
+ {
394
+ $field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field["id"]));
395
+ $field_id_class = preg_replace ("/_/", "-", $field_var);
396
+ /**/
397
+ if (isset ($_pm["ws_plugin__s2member_custom_reg_field_" . $field_var]))
398
+ $fields[$field_var] = $_pm["ws_plugin__s2member_custom_reg_field_" . $field_var];
399
+ }
400
+ /**/
401
+ update_user_option ($user_id, "s2member_custom_fields", $fields);
402
+ /**/
403
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
404
+ do_action ("ws_plugin__s2member_during_configure_user_registration_front_side", get_defined_vars ());
405
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
406
+ }
407
+ /**/
408
+ else if (is_admin () && $pagenow === "user-new.php") /* Else, if we're on this page. */
409
+ { /*
410
+ This routine can ONLY be processed through `user-new.php` inside the Dashboard.
411
+ */
412
+ $processed = "yes"; /* Mark this as yes, to indicate that a routine was processed. */
413
+ /**/
414
+ $role = $role = $user->roles[0]; /* If they already have a Role, we can use it. */
415
+ $role = (!$role && is_multisite () && is_main_site ()) ? get_site_option ("default_user_role") : $role;
416
+ $role = (!$role) ? get_option ("default_role") : $role; /* Otherwise, the default role. */
417
+ /**/
418
+ $level = (preg_match ("/^(administrator|editor|author|contributor)#x2F;i", $role)) ? "4" : $level;
419
+ $level = (!$level && preg_match ("/^s2member_level[1-4]#x2F;i", $role)) ? preg_replace ("/^s2member_level/", "", $role) : $level;
420
+ $level = (!$level && preg_match ("/^subscriber#x2F;i", $role)) ? "0" : $level;
421
+ $level = (!$level) ? "0" : $level;
422
+ /**/
423
+ $ccaps = $_pm["ws_plugin__s2member_custom_reg_field_s2member_ccaps"];
424
+ /**/
425
+ $email = $user->user_email;
426
+ $login = $user->user_login;
427
+ $ip = ""; /* N/Applicable. */
428
+ $custom = $_pm["ws_plugin__s2member_custom_reg_field_s2member_custom"];
429
+ $subscr_id = $_pm["ws_plugin__s2member_custom_reg_field_s2member_subscr_id"];
430
+ $cv = preg_split ("/\|/", $_pm["ws_plugin__s2member_custom_reg_field_s2member_custom"]);
431
+ /**/
432
+ $auto_eot_time = ($eot = $_pm["ws_plugin__s2member_custom_reg_field_s2member_auto_eot_time"]) ? strtotime ($eot) : "";
433
+ $notes = $_pm["ws_plugin__s2member_custom_reg_field_s2member_notes"];
434
+ /**/
435
+ $opt_in = (!$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in"]) ? true : false;
436
+ $opt_in = (!$opt_in && $_pm["ws_plugin__s2member_custom_reg_field_opt_in"]) ? true : $opt_in;
437
+ /**/
438
+ if (! ($fname = $user->first_name)) /* `Users -> Add New`. */
439
+ if ($_pm["ws_plugin__s2member_custom_reg_field_first_name"])
440
+ $fname = $_pm["ws_plugin__s2member_custom_reg_field_first_name"];
441
+ /**/
442
+ if (! ($lname = $user->last_name)) /* `Users -> Add New`. */
443
+ if ($_pm["ws_plugin__s2member_custom_reg_field_last_name"])
444
+ $lname = $_pm["ws_plugin__s2member_custom_reg_field_last_name"];
445
+ /**/
446
+ $name = trim ($fname . " " . $lname); /* Both names. */
447
+ /**/
448
+ if (! ($pass = $password)) /* Try s2Member's generator. */
449
+ if ($GLOBALS["ws_plugin__s2member_generate_password_return"])
450
+ $pass = $GLOBALS["ws_plugin__s2member_generate_password_return"];
451
+ /**/
452
+ if (!$pass) /* Also try the `Users -> Add New` form. */
453
+ if ($_pm["pass1"]) /* Field in user-new.php. */
454
+ $pass = $_pm["pass1"];
455
+ /**/
456
+ if ($pass) /* No password nag. Update this globally. */
457
+ {
458
+ delete_user_setting ("default_password_nag"); /* setcookie() */
459
+ update_user_option ($user_id, "default_password_nag", false, true);
460
+ }
461
+ /**/
462
+ update_user_option ($user_id, "s2member_auto_eot_time", $auto_eot_time);
463
+ update_user_option ($user_id, "s2member_subscr_id", $subscr_id);
464
+ update_user_option ($user_id, "s2member_custom", $custom);
465
+ update_user_option ($user_id, "s2member_notes", $notes);
466
+ /**/
467
+ if (!$user->first_name && $fname)
468
+ update_user_meta ($user_id, "first_name", $fname) ./**/
469
+ wp_update_user (array ("ID" => $user_id, "display_name" => $fname));
470
+ /**/
471
+ if (!$user->last_name && $lname)
472
+ update_user_meta ($user_id, "last_name", $lname);
473
+ /**/
474
+ if (is_multisite ()) /* Originating Blog ID#, and adjust Main Site permissions. */
475
+ {
476
+ (!is_main_site ()) ? remove_user_from_blog ($user_id, $current_site->blog_id) : null;
477
+ update_user_meta ($user_id, "s2member_originating_blog", $current_blog->blog_id);
478
+ }
479
+ /**/
480
+ $user->set_role ($role); /* s2Member. */
481
+ /**/
482
+ foreach (preg_split ("/[\r\n\t\s;,]+/", $ccaps) as $ccap)
483
+ if (strlen ($ccap)) /* Don't add empty capabilities. */
484
+ $user->add_cap ("access_s2member_ccap_" . trim (strtolower ($ccap)));
485
+ /**/
486
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"])
487
+ foreach (json_decode ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"], true) as $field)
488
+ {
489
+ $field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field["id"]));
490
+ $field_id_class = preg_replace ("/_/", "-", $field_var);
491
+ /**/
492
+ if (isset ($_pm["ws_plugin__s2member_custom_reg_field_" . $field_var]))
493
+ $fields[$field_var] = $_pm["ws_plugin__s2member_custom_reg_field_" . $field_var];
494
+ }
495
+ /**/
496
+ update_user_option ($user_id, "s2member_custom_fields", $fields);
497
+ /**/
498
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
499
+ do_action ("ws_plugin__s2member_during_configure_user_registration_admin_side", get_defined_vars ());
500
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
501
+ }
502
+ /**/
503
+ if ($processed === "yes") /* If registration was processed by one of the routines above. */
504
+ {
505
+ ws_plugin__s2member_process_list_servers ($level, $email, $fname, $lname, $ip, $opt_in);
506
+ /**/
507
+ if ($urls = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["registration_notification_urls"])
508
+ /**/
509
+ foreach (preg_split ("/[\r\n\t]+/", $urls) as $url) /* Notify each of the urls. */
510
+ /**/
511
+ if (($url = preg_replace ("/%%cv([0-9]+)%%/ei", 'urlencode(trim($cv[$1]))', $url)))
512
+ if (($url = preg_replace ("/%%role%%/i", ws_plugin__s2member_esc_ds (urlencode ($role)), $url)))
513
+ if (($url = preg_replace ("/%%level%%/i", ws_plugin__s2member_esc_ds (urlencode ($level)), $url)))
514
+ if (($url = preg_replace ("/%%user_first_name%%/i", ws_plugin__s2member_esc_ds (urlencode ($fname)), $url)))
515
+ if (($url = preg_replace ("/%%user_last_name%%/i", ws_plugin__s2member_esc_ds (urlencode ($lname)), $url)))
516
+ if (($url = preg_replace ("/%%user_full_name%%/i", ws_plugin__s2member_esc_ds (urlencode ($name)), $url)))
517
+ if (($url = preg_replace ("/%%user_email%%/i", ws_plugin__s2member_esc_ds (urlencode ($email)), $url)))
518
+ if (($url = preg_replace ("/%%user_login%%/i", ws_plugin__s2member_esc_ds (urlencode ($login)), $url)))
519
+ if (($url = preg_replace ("/%%user_pass%%/i", ws_plugin__s2member_esc_ds (urlencode ($pass)), $url)))
520
+ if (($url = preg_replace ("/%%user_id%%/i", ws_plugin__s2member_esc_ds (urlencode ($user_id)), $url)))
521
+ /**/
522
+ if (($url = trim ($url))) /* Empty? */
523
+ ws_plugin__s2member_remote($url);
524
+ /**/
525
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["registration_notification_recipients"])
526
+ {
527
+ $msg = $sbj = "( s2Member / API Notification Email ) - Registration";
528
+ $msg .= "\n\n"; /* Spacing in the message body. */
529
+ $msg .= "role: %%role%%\n";
530
+ $msg .= "level: %%level%%\n";
531
+ $msg .= "user_first_name: %%user_first_name%%\n";
532
+ $msg .= "user_last_name: %%user_last_name%%\n";
533
+ $msg .= "user_full_name: %%user_full_name%%\n";
534
+ $msg .= "user_email: %%user_email%%\n";
535
+ $msg .= "user_login: %%user_login%%\n";
536
+ $msg .= "user_pass: %%user_pass%%\n";
537
+ $msg .= "user_id: %%user_id%%\n";
538
+ $msg .= "cv0: %%cv0%%\n";
539
+ $msg .= "cv1: %%cv1%%\n";
540
+ $msg .= "cv2: %%cv2%%\n";
541
+ $msg .= "cv3: %%cv3%%\n";
542
+ $msg .= "cv4: %%cv4%%\n";
543
+ $msg .= "cv5: %%cv5%%\n";
544
+ $msg .= "cv6: %%cv6%%\n";
545
+ $msg .= "cv7: %%cv7%%\n";
546
+ $msg .= "cv8: %%cv8%%\n";
547
+ $msg .= "cv9: %%cv9%%";
548
+ /**/
549
+ if (($msg = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim($cv[$1])', $msg)))
550
+ if (($msg = preg_replace ("/%%role%%/i", ws_plugin__s2member_esc_ds ($role), $msg)))
551
+ if (($msg = preg_replace ("/%%level%%/i", ws_plugin__s2member_esc_ds ($level), $msg)))
552
+ if (($msg = preg_replace ("/%%user_first_name%%/i", ws_plugin__s2member_esc_ds ($fname), $msg)))
553
+ if (($msg = preg_replace ("/%%user_last_name%%/i", ws_plugin__s2member_esc_ds ($lname), $msg)))
554
+ if (($msg = preg_replace ("/%%user_full_name%%/i", ws_plugin__s2member_esc_ds ($name), $msg)))
555
+ if (($msg = preg_replace ("/%%user_email%%/i", ws_plugin__s2member_esc_ds ($email), $msg)))
556
+ if (($msg = preg_replace ("/%%user_login%%/i", ws_plugin__s2member_esc_ds ($login), $msg)))
557
+ if (($msg = preg_replace ("/%%user_pass%%/i", ws_plugin__s2member_esc_ds ($pass), $msg)))
558
+ if (($msg = preg_replace ("/%%user_id%%/i", ws_plugin__s2member_esc_ds ($user_id), $msg)))
559
+ /**/
560
+ foreach (ws_plugin__s2member_trim_deep (preg_split ("/;+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["registration_notification_recipients"])) as $recipient)
561
+ /**/
562
+ ($recipient) ? mail ($recipient, $sbj, apply_filters ("ws_plugin__s2member_registration_notification_email_msg", $msg, get_defined_vars ()), "From: \"" . preg_replace ('/"/', "'", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_name"]) . "\" <" . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_email"] . ">\r\nContent-Type: text/plain; charset=utf-8") : null;
563
+ }
564
+ /**/
565
+ if ($url = $GLOBALS["ws_plugin__s2member_registration_return_url"])
566
+ /**/
567
+ if (($url = preg_replace ("/%%cv([0-9]+)%%/ei", 'urlencode(trim($cv[$1]))', $url)))
568
+ if (($url = preg_replace ("/%%role%%/i", ws_plugin__s2member_esc_ds (urlencode ($role)), $url)))
569
+ if (($url = preg_replace ("/%%level%%/i", ws_plugin__s2member_esc_ds (urlencode ($level)), $url)))
570
+ if (($url = preg_replace ("/%%user_first_name%%/i", ws_plugin__s2member_esc_ds (urlencode ($fname)), $url)))
571
+ if (($url = preg_replace ("/%%user_last_name%%/i", ws_plugin__s2member_esc_ds (urlencode ($lname)), $url)))
572
+ if (($url = preg_replace ("/%%user_full_name%%/i", ws_plugin__s2member_esc_ds (urlencode ($name)), $url)))
573
+ if (($url = preg_replace ("/%%user_email%%/i", ws_plugin__s2member_esc_ds (urlencode ($email)), $url)))
574
+ if (($url = preg_replace ("/%%user_login%%/i", ws_plugin__s2member_esc_ds (urlencode ($login)), $url)))
575
+ if (($url = preg_replace ("/%%user_pass%%/i", ws_plugin__s2member_esc_ds (urlencode ($pass)), $url)))
576
+ if (($url = preg_replace ("/%%user_id%%/i", ws_plugin__s2member_esc_ds (urlencode ($user_id)), $url)))
577
+ /**/
578
+ if (($url = trim ($url))) /* Empty? ... Otherwise, re-fill. */
579
+ $GLOBALS["ws_plugin__s2member_registration_return_url"] = $url;
580
+ /**/
581
+ setcookie ("s2member_subscr_id", "", time () + 31556926, "/");
582
+ setcookie ("s2member_custom", "", time () + 31556926, "/");
583
+ setcookie ("s2member_level", "", time () + 31556926, "/");
584
+ /**/
585
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
586
+ do_action ("ws_plugin__s2member_during_configure_user_registration", get_defined_vars ());
587
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
588
+ }
589
+ }
590
+ /**/
591
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
592
+ do_action ("ws_plugin__s2member_after_configure_user_registration", get_defined_vars ());
593
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
594
+ /**/
595
+ return;
596
+ }
597
+ }
598
+ ?>
includes/functions/css-js-w-globals.inc.php CHANGED
@@ -14,8 +14,7 @@ Direct access denial.
14
if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
exit ("Do not access this file directly.");
16
/*
17
- Function adds styles to the header.
18
- Do NOT enqueue styles in the admin area.
19
Attach to: add_action("wp_print_styles");
20
*/
21
if (!function_exists ("ws_plugin__s2member_add_css"))
@@ -37,7 +36,7 @@ if (!function_exists ("ws_plugin__s2member_add_css"))
37
}
38
}
39
/*
40
- Function for adding s2member.css.
41
Attach to: add_action("init");
42
*/
43
if (!function_exists ("ws_plugin__s2member_css"))
@@ -70,19 +69,20 @@ if (!function_exists ("ws_plugin__s2member_css"))
70
}
71
}
72
/*
73
- Function for adding scripts to the header.
74
- Do NOT enqueue scripts in the admin area.
75
Attach to: add_action("wp_print_scripts");
76
*/
77
if (!function_exists ("ws_plugin__s2member_add_js_w_globals"))
78
{
79
function ws_plugin__s2member_add_js_w_globals ()
80
{
81
do_action ("ws_plugin__s2member_before_add_js_w_globals", get_defined_vars ());
82
/**/
83
- if (!is_admin ()) /* Not in the admin. */
84
{
85
- if (is_user_logged_in ())
86
{
87
$md5 = WS_PLUGIN__S2MEMBER_API_CONSTANTS_MD5; /* An MD5 hash based on global key => values. */
88
/* The MD5 hash allows the script to be cached in the browser until the globals happen to change. */
@@ -103,7 +103,7 @@ if (!function_exists ("ws_plugin__s2member_add_js_w_globals"))
103
}
104
}
105
/*
106
- Function for adding s2member.js with globals.
107
Attach to: add_action("init");
108
*/
109
if (!function_exists ("ws_plugin__s2member_js_w_globals"))
14
if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
exit ("Do not access this file directly.");
16
/*
17
+ Adds CSS files.
18
Attach to: add_action("wp_print_styles");
19
*/
20
if (!function_exists ("ws_plugin__s2member_add_css"))
36
}
37
}
38
/*
39
+ Builds CSS files.
40
Attach to: add_action("init");
41
*/
42
if (!function_exists ("ws_plugin__s2member_css"))
69
}
70
}
71
/*
72
+ Adds JavaScript files.
73
Attach to: add_action("wp_print_scripts");
74
*/
75
if (!function_exists ("ws_plugin__s2member_add_js_w_globals"))
76
{
77
function ws_plugin__s2member_add_js_w_globals ()
78
{
79
+ global $pagenow; /* Need this for comparisons. */
80
+ /**/
81
do_action ("ws_plugin__s2member_before_add_js_w_globals", get_defined_vars ());
82
/**/
83
+ if (!is_admin () || ($pagenow === "profile.php" && !current_user_can ("edit_users")))
84
{
85
+ if (is_user_logged_in ()) /* Separate version for logged-in Users/Members. */
86
{
87
$md5 = WS_PLUGIN__S2MEMBER_API_CONSTANTS_MD5; /* An MD5 hash based on global key => values. */
88
/* The MD5 hash allows the script to be cached in the browser until the globals happen to change. */
103
}
104
}
105
/*
106
+ Builds JavaScript files.
107
Attach to: add_action("init");
108
*/
109
if (!function_exists ("ws_plugin__s2member_js_w_globals"))
includes/functions/custom-reg-fields.inc.php ADDED
@@ -0,0 +1,453 @@
1
+ <?php
2
+ /*
3
+ Copyright: © 2009 WebSharks, Inc. ( coded in the USA )
4
+ <mailto:support@websharks-inc.com> <http://www.websharks-inc.com/>
5
+
6
+ Released under the terms of the GNU General Public License.
7
+ You should have received a copy of the GNU General Public License,
8
+ along with this software. In the main directory, see: /licensing/
9
+ If not, see: <http://www.gnu.org/licenses/>.
10
+ */
11
+ /*
12
+ Direct access denial.
13
+ */
14
+ if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit ("Do not access this file directly.");
16
+ /*
17
+ Handles the creation of Custom Fields.
18
+ */
19
+ if (!function_exists ("ws_plugin__s2member_custom_field_gen"))
20
+ {
21
+ function ws_plugin__s2member_custom_field_gen ($_function = FALSE, $_field = FALSE, $_name_prefix = FALSE, $_id_prefix = FALSE, $_classes = FALSE, $_styles = FALSE, $_tabindex = FALSE, $_attrs = FALSE, $_submission = FALSE, $_value = FALSE, $_lock_uneditables = FALSE)
22
+ {
23
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
24
+ do_action ("ws_plugin__s2member_before_custom_field_gen", get_defined_vars ());
25
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
26
+ /**/
27
+ if ($_function && is_array ($field = $_field) && $field["type"] && $field["id"] && $_name_prefix && $_id_prefix)
28
+ {
29
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
30
+ do_action ("ws_plugin__s2member_during_custom_field_gen_before", get_defined_vars ());
31
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
32
+ /**/
33
+ $field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field["id"]));
34
+ $field_id_class = preg_replace ("/_/", "-", $field_var);
35
+ /**/
36
+ $name_suffix = (preg_match ("/\[#x2F;", $_name_prefix)) ? ']' : '';
37
+ $field_name = trim ($_name_prefix . $field_var . $name_suffix);
38
+ /**/
39
+ $common = ''; /* Common attribute configuration. */
40
+ $common .= ' name="' . esc_attr ($field_name) . '"';
41
+ $common .= ' id="' . esc_attr ($_id_prefix . $field_id_class) . '"';
42
+ $common .= ( ($field["required"] === "yes") ? ' aria-required="true"' : '');
43
+ $common .= ( (strlen ($_tabindex)) ? ' tabindex="' . esc_attr ($_tabindex) . '"' : '');
44
+ $common .= ( ($field["expected"]) ? ' data-expected="' . esc_attr ($field["expected"]) . '"' : '');
45
+ $common .= ( (preg_match ("/^no/", $field["editable"]) && $_lock_uneditables) ? ' disabled="disabled"' : '');
46
+ $common .= ( ($_classes || $field["classes"]) ? ' class="' . esc_attr (trim ($_classes . ( ($field["classes"]) ? ' ' . $field["classes"] : ''))) . '"' : '');
47
+ $common .= ( ($_styles || $field["styles"]) ? ' style="' . esc_attr (trim ($_styles . ( ($field["styles"]) ? ' ' . $field["styles"] : ''))) . '"' : '');
48
+ $common .= ( ($_attrs || $field["attrs"]) ? ' ' . trim ($_attrs . ( ($field["attrs"]) ? ' ' . $field["attrs"] : '')) : '');
49
+ /**/
50
+ if ($field["type"] === "text")
51
+ {
52
+ $gen = '<input type="text" maxlength="100"';
53
+ $gen .= ' value="' . format_to_edit ((string)$_value) . '"';
54
+ $gen .= $common . ' />';
55
+ }
56
+ /**/
57
+ else if ($field["type"] === "textarea")
58
+ {
59
+ $gen = '<textarea rows="3"' . $common . '>';
60
+ $gen .= format_to_edit ((string)$_value);
61
+ $gen .= '</textarea>';
62
+ }
63
+ /**/
64
+ else if ($field["type"] === "select" && $field["options"])
65
+ {
66
+ $gen = '<select' . $common . '>';
67
+ foreach (preg_split ("/[\r\n\t]+/", $field["options"]) as $option_line)
68
+ {
69
+ list ($option_value, $option_label, $option_default) = ws_plugin__s2member_trim_deep (preg_split ("/\|/", trim ($option_line)));
70
+ $gen .= '<option value="' . esc_attr ($option_value) . '"' . ( ( ($option_default && !$_submission) || $option_value === (string)$_value) ? ' selected="selected"' : '') . '>' . $option_label . '</option>';
71
+ }
72
+ $gen .= '</select>';
73
+ }
74
+ /**/
75
+ else if ($field["type"] === "selects" && $field["options"])
76
+ {
77
+ $common = preg_replace ('/ name\="(.+?)"/', ' name="$1[]"', $common);
78
+ $common = preg_replace ('/ style\="(.+?)"/', ' style="height:auto; $1"', $common);
79
+ /**/
80
+ $gen = '<select multiple="multiple" size="3"' . $common . '>';
81
+ foreach (preg_split ("/[\r\n\t]+/", $field["options"]) as $option_line)
82
+ {
83
+ list ($option_value, $option_label, $option_default) = ws_plugin__s2member_trim_deep (preg_split ("/\|/", trim ($option_line)));
84
+ $gen .= '<option value="' . esc_attr ($option_value) . '"' . ( ( ($option_default && !$_submission) || in_array ($option_value, (array)$_value)) ? ' selected="selected"' : '') . '>' . $option_label . '</option>';
85
+ }
86
+ $gen .= '</select>';
87
+ }
88
+ /**/
89
+ else if ($field["type"] === "checkbox")
90
+ {
91
+ $gen = '<input type="checkbox" value="1"';
92
+ $gen .= ( ((string)$_value) ? ' checked="checked"' : '');
93
+ $gen .= $common . ' /><label for="' . esc_attr ($_id_prefix . $field_id_class) . '" style="display:inline;">' . $field["label"] . '</label>';
94
+ }
95
+ /**/
96
+ else if ($field["type"] === "pre_checkbox")
97
+ {
98
+ $gen = '<input type="checkbox" value="1"';
99
+ $gen .= ( (!$_submission || (string)$_value) ? ' checked="checked"' : '');
100
+ $gen .= $common . ' /><label for="' . esc_attr ($_id_prefix . $field_id_class) . '" style="display:inline;">' . $field["label"] . '</label>';
101
+ }
102
+ /**/
103
+ else if ($field["type"] === "checkboxes" && $field["options"])
104
+ {
105
+ $gen = ""; /* Initialize generated field. */
106
+ /**/
107
+ $common = preg_replace ('/ name\="(.+?)"/', ' name="$1[]"', $common);
108
+ /**/
109
+ $sep = apply_filters ("ws_plugin__s2member_custom_field_gen_" . $field["type"] . "_sep", "&nbsp;&nbsp;", get_defined_vars ());
110
+ $opl = apply_filters ("ws_plugin__s2member_custom_field_gen_" . $field["type"] . "_opl", "ws-plugin--s2member-custom-reg-field-op-l", get_defined_vars ());
111
+ /**/
112
+ foreach (preg_split ("/[\r\n\t]+/", $field["options"]) as $i => $option_line)
113
+ {
114
+ $common_i = preg_replace ('/ id\="(.+?)"/', ' id="$1-' . ($i) . '"', $common);
115
+ /**/
116
+ list ($option_value, $option_label, $option_default) = ws_plugin__s2member_trim_deep (preg_split ("/\|/", trim ($option_line)));
117
+ /**/
118
+ $gen .= ($i > 0) ? $sep : ''; /* Separators can be filtered above. */
119
+ $gen .= '<input type="checkbox" value="' . esc_attr ($option_value) . '"';
120
+ $gen .= ( ( ($option_default && !$_submission) || in_array ($option_value, (array)$_value)) ? ' checked="checked"' : '');
121
+ $gen .= $common_i . ' /><label for="' . esc_attr ($_id_prefix . $field_id_class . "-" . $i) . '" class="' . esc_attr ($opl) . '" style="display:inline;">' . $option_label . '</label>';
122
+ }
123
+ }
124
+ /**/
125
+ else if ($field["type"] === "radios" && $field["options"])
126
+ {
127
+ $gen = ""; /* Initialize generated field. */
128
+ /**/
129
+ $sep = apply_filters ("ws_plugin__s2member_custom_field_gen_" . $field["type"] . "_sep", "&nbsp;&nbsp;", get_defined_vars ());
130
+ $opl = apply_filters ("ws_plugin__s2member_custom_field_gen_" . $field["type"] . "_opl", "ws-plugin--s2member-custom-reg-field-op-l", get_defined_vars ());
131
+ /**/
132
+ foreach (preg_split ("/[\r\n\t]+/", $field["options"]) as $i => $option_line)
133
+ {
134
+ $common_i = preg_replace ('/ id\="(.+?)"/', ' id="$1-' . ($i) . '"', $common);
135
+ /**/
136
+ list ($option_value, $option_label, $option_default) = ws_plugin__s2member_trim_deep (preg_split ("/\|/", trim ($option_line)));
137
+ /**/
138
+ $gen .= ($i > 0) ? $sep : ''; /* Separators can be filtered above. */
139
+ $gen .= '<input type="radio" value="' . esc_attr ($option_value) . '"';
140
+ $gen .= ( ( ($option_default && !$_submission) || $option_value === (string)$_value) ? ' checked="checked"' : '');
141
+ $gen .= $common_i . ' /><label for="' . esc_attr ($_id_prefix . $field_id_class . "-" . $i) . '" class="' . esc_attr ($opl) . '" style="display:inline;">' . $option_label . '</label>';
142
+ }
143
+ }
144
+ else /* Otherwise, we use a default text field. */
145
+ {
146
+ $gen = '<input type="text" maxlength="100"';
147
+ $gen .= ' value="' . format_to_edit ((string)$_value) . '"';
148
+ $gen .= $common . ' />';
149
+ }
150
+ /**/
151
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
152
+ do_action ("ws_plugin__s2member_during_custom_field_gen_after", get_defined_vars ());
153
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
154
+ }
155
+ /**/
156
+ return apply_filters ("ws_plugin__s2member_custom_field_gen", $gen, get_defined_vars ());
157
+ }
158
+ }
159
+ /*
160
+ Function determines whether or not Custom Fields apply to a specific Level.
161
+ The $level parameter defaults to the current User's Access Level number.
162
+ $level MUST be numeric >= 0.
163
+ */
164
+ if (!function_exists ("ws_plugin__s2member_custom_fields_configured_at_level"))
165
+ {
166
+ function ws_plugin__s2member_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 ());
170
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
171
+ /**/
172
+ $level = ($_level === "auto-detection") ? ws_plugin__s2member_user_access_level () : $_level;
173
+ if ($_level === "auto-detection" && $level < 0 && preg_match ("/^[1-4](\:|$)([a-z_0-9,]+)?(\:)?([0-9]+ [A-Z])?#x2F;", ($cookie = ws_plugin__s2member_decrypt ($_COOKIE["s2member_level"]))))
174
+ list ($level) = preg_split ("/\:/", $cookie, 3);
175
+ /**/
176
+ $level = (!is_numeric ($level) || $level < 0) ? 0 : $level; /* Always default to Level #0. */
177
+ /**/
178
+ if (is_numeric ($level) && $level >= 0 && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["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 ());
186
+ }
187
+ }
188
+ /*
189
+ This adds custom fields to `wp-signup.php`.
190
+ Attach to: add_action("signup_extra_fields");
191
+ ~ For Multisite Blog Farms.
192
+ */
193
+ if (!function_exists ("ws_plugin__s2member_ms_custom_registration_fields"))
194
+ {
195
+ function ws_plugin__s2member_ms_custom_registration_fields ()
196
+ {
197
+ do_action ("ws_plugin__s2member_before_ms_custom_registration_fields", get_defined_vars ());
198
+ /**/
199
+ if (is_multisite () && is_main_site ()) /* Must be Multisite / Main Site. */
200
+ {
201
+ $_POST = ws_plugin__s2member_trim_deep (stripslashes_deep ($_POST));
202
+ /**/
203
+ echo '<input type="hidden" name="ws_plugin__s2member_registration" value="' . esc_attr (wp_create_nonce ("ws-plugin--s2member-registration")) . '" />' . "\n";
204
+ /**/
205
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
206
+ do_action ("ws_plugin__s2member_during_ms_custom_registration_fields_before", get_defined_vars ());
207
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
208
+ /**/
209
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
210
+ do_action ("ws_plugin__s2member_during_ms_custom_registration_fields_before_first_name", get_defined_vars ());
211
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
212
+ /**/
213
+ echo '<label for="ws-plugin--s2member-custom-reg-field-first-name">First Name *</label>' . "\n";
214
+ 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";
215
+ echo '<br />' . "\n";
216
+ /**/
217
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
218
+ do_action ("ws_plugin__s2member_during_ms_custom_registration_fields_after_first_name", get_defined_vars ());
219
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
220
+ /**/
221
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
222
+ do_action ("ws_plugin__s2member_during_ms_custom_registration_fields_before_last_name", get_defined_vars ());
223
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
224
+ /**/
225
+ echo '<label for="ws-plugin--s2member-custom-reg-field-last-name">Last Name *</label>' . "\n";
226
+ 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";
227
+ echo '<br />' . "\n";
228
+ /**/
229
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
230
+ do_action ("ws_plugin__s2member_during_ms_custom_registration_fields_after_last_name", get_defined_vars ());
231
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
232
+ /**/
233
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"])
234
+ if ($fields_applicable = ws_plugin__s2member_custom_fields_configured_at_level ("auto-detection"))
235
+ foreach (json_decode ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"], true) as $field)
236
+ {
237
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
238
+ do_action ("ws_plugin__s2member_during_ms_custom_registration_fields_before_custom_fields", get_defined_vars ());
239
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
240
+ /**/
241
+ if (in_array ($field["id"], $fields_applicable)) /* Field applicable? */
242
+ {
243
+ $field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field["id"]));
244
+ $field_id_class = preg_replace ("/_/", "-", $field_var);
245
+ /**/
246
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
247
+ if (apply_filters ("ws_plugin__s2member_during_ms_custom_registration_fields_during_custom_fields_display", true, get_defined_vars ()))
248
+ {
249
+ echo '<label for="ws-plugin--s2member-custom-reg-field-' . $field_id_class . '"' . ( (preg_match ("/^(checkbox|pre_checkbox)#x2F;", $field["type"])) ? ' style="display:none;"' : '') . '>' . $field["label"] . ( ($field["required"] === "yes") ? ' *' : '') . '</label>' . "\n";
250
+ echo ws_plugin__s2member_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]);
251
+ echo '<br />' . "\n";
252
+ }
253
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
254
+ }
255
+ /**/
256
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
257
+ do_action ("ws_plugin__s2member_during_ms_custom_registration_fields_after_custom_fields", get_defined_vars ());
258
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
259
+ }
260
+ /**/
261
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in"] && ws_plugin__s2member_list_servers_integrated ())
262
+ {
263
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
264
+ do_action ("ws_plugin__s2member_during_ms_custom_registration_fields_before_opt_in", get_defined_vars ());
265
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
266
+ /**/
267
+ echo '<label for="ws-plugin--s2member-custom-reg-field-opt-in">' . "\n";
268
+ 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";
269
+ echo $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in_label"] . "\n";
270
+ echo '</label>' . "\n";
271
+ echo '<br />' . "\n";
272
+ /**/
273
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
274
+ do_action ("ws_plugin__s2member_during_ms_custom_registration_fields_after_opt_in", get_defined_vars ());
275
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
276
+ }
277
+ /**/
278
+ echo '<br />' . "\n"; /* Toss in one extra line break ( extra margin ). */
279
+ /**/
280
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
281
+ do_action ("ws_plugin__s2member_during_ms_custom_registration_fields_after", get_defined_vars ());
282
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
283
+ }
284
+ /**/
285
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
286
+ do_action ("ws_plugin__s2member_after_ms_custom_registration_fields", get_defined_vars ());
287
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
288
+ /**/
289
+ return; /* Return for uniformity. */
290
+ }
291
+ }
292
+ /*
293
+ This adds custom fields to `wp-login.php?action=register`.
294
+ Attach to: add_action("register_form");
295
+ */
296
+ if (!function_exists ("ws_plugin__s2member_custom_registration_fields"))
297
+ {
298
+ function ws_plugin__s2member_custom_registration_fields ()
299
+ {
300
+ do_action ("ws_plugin__s2member_before_custom_registration_fields", get_defined_vars ());
301
+ /**/
302
+ $_POST = ws_plugin__s2member_trim_deep (stripslashes_deep ($_POST));
303
+ /**/
304
+ echo '<input type="hidden" name="ws_plugin__s2member_registration" value="' . esc_attr (wp_create_nonce ("ws-plugin--s2member-registration")) . '" />' . "\n";
305
+ /**/
306
+ $tabindex = 20; /* Incremented tabindex starting with 20. */
307
+ /**/
308
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
309
+ do_action ("ws_plugin__s2member_during_custom_registration_fields_before", get_defined_vars ());
310
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
311
+ /**/
312
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_password"] && function_exists ("ws_plugin__s2member_generate_password"))
313
+ {
314
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
315
+ do_action ("ws_plugin__s2member_during_custom_registration_fields_before_user_pass", get_defined_vars ());
316
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
317
+ /**/
318
+ echo '<p>' . "\n";
319
+ echo '<label>' . "\n";
320
+ echo '<span>Password *</span><br />' . "\n";
321
+ 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";
322
+ echo '</label>' . "\n";
323
+ echo '</p>';
324
+ /**/
325
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
326
+ do_action ("ws_plugin__s2member_during_custom_registration_fields_after_user_pass", get_defined_vars ());
327
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
328
+ }
329
+ /**/
330
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
331
+ do_action ("ws_plugin__s2member_during_custom_registration_fields_before_first_name", get_defined_vars ());
332
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
333
+ /**/
334
+ echo '<p>' . "\n";
335
+ echo '<label>' . "\n";
336
+ echo '<span>First Name *</span><br />' . "\n";
337
+ 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";
338
+ echo '</label>' . "\n";
339
+ echo '</p>';
340
+ /**/
341
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
342
+ do_action ("ws_plugin__s2member_during_custom_registration_fields_after_first_name", get_defined_vars ());
343
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
344
+ /**/
345
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
346
+ do_action ("ws_plugin__s2member_during_custom_registration_fields_before_last_name", get_defined_vars ());
347
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
348
+ /**/
349
+ echo '<p>' . "\n";
350
+ echo '<label>' . "\n";
351
+ echo '<span>Last Name *</span><br />' . "\n";
352
+ 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";
353
+ echo '</label>' . "\n";
354
+ echo '</p>';
355
+ /**/
356
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
357
+ do_action ("ws_plugin__s2member_during_custom_registration_fields_after_last_name", get_defined_vars ());
358
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
359
+ /**/
360
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"])
361
+ if ($fields_applicable = ws_plugin__s2member_custom_fields_configured_at_level ("auto-detection"))
362
+ foreach (json_decode ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"], true) as $field)
363
+ {
364
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
365
+ do_action ("ws_plugin__s2member_during_custom_registration_fields_before_custom_fields", get_defined_vars ());
366
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
367
+ /**/
368
+ if (in_array ($field["id"], $fields_applicable)) /* Field applicable? */
369
+ {
370
+ $field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field["id"]));
371
+ $field_id_class = preg_replace ("/_/", "-", $field_var);
372
+ /**/
373
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
374
+ if (apply_filters ("ws_plugin__s2member_during_custom_registration_fields_during_custom_fields_display", true, get_defined_vars ()))
375
+ {
376
+ echo '<p>' . "\n";
377
+ echo '<label>' . "\n";
378
+ echo '<span' . ( (preg_match ("/^(checkbox|pre_checkbox)#x2F;", $field["type"])) ? ' style="display:none;"' : '') . '>' . $field["label"] . ( ($field["required"] === "yes") ? ' *' : '') . '</span>' . ( (preg_match ("/^(checkbox|pre_checkbox)#x2F;", $field["type"])) ? '' : '<br />') . "\n";
379
+ echo ws_plugin__s2member_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]);
380
+ echo '</label>' . "\n";
381
+ echo '</p>';
382
+ }
383
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
384
+ }
385
+ /**/
386
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
387
+ do_action ("ws_plugin__s2member_during_custom_registration_fields_after_custom_fields", get_defined_vars ());
388
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
389
+ }
390
+ /**/
391
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in"] && ws_plugin__s2member_list_servers_integrated ())
392
+ {
393
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
394
+ do_action ("ws_plugin__s2member_during_custom_registration_fields_before_opt_in", get_defined_vars ());
395
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
396
+ /**/
397
+ echo '<p>' . "\n";
398
+ echo '<label>' . "\n";
399
+ 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";
400
+ echo $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in_label"] . "\n";
401
+ echo '</label>' . "\n";
402
+ echo '</p>';
403
+ /**/
404
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
405
+ do_action ("ws_plugin__s2member_during_custom_registration_fields_after_opt_in", get_defined_vars ());
406
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
407
+ }
408
+ /**/
409
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
410
+ do_action ("ws_plugin__s2member_during_custom_registration_fields_after", get_defined_vars ());
411
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
412
+ /**/
413
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
414
+ do_action ("ws_plugin__s2member_after_custom_registration_fields", get_defined_vars ());
415
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
416
+ /**/
417
+ return;
418
+ }
419
+ }
420
+ /*
421
+ This adds an opt-in checkbox to the BuddyPress signup form.
422
+ Attach to: add_action("bp_before_registration_submit_buttons");
423
+ */
424
+ if (!function_exists ("ws_plugin__s2member_opt_in_4bp"))
425
+ {
426
+ function ws_plugin__s2member_opt_in_4bp ()
427
+ {
428
+ do_action ("ws_plugin__s2member_before_opt_in_4bp", get_defined_vars ());
429
+ /**/
430
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in"] && ws_plugin__s2member_list_servers_integrated ())
431
+ {
432
+ do_action ("ws_plugin__s2member_during_opt_in_4bp_before", get_defined_vars ());
433
+ /**/
434
+ 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";
435
+ /**/
436
+ echo '<p>' . "\n";
437
+ echo '<label>' . "\n";
438
+ 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";
439
+ echo $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in_label"] . "\n";
440
+ echo '</label>' . "\n";
441
+ echo '</p>';
442
+ /**/
443
+ echo '</div>' . "\n";
444
+ /**/
445
+ do_action ("ws_plugin__s2member_during_opt_in_4bp_after", get_defined_vars ());
446
+ }
447
+ /**/
448
+ do_action ("ws_plugin__s2member_after_opt_in_4bp", get_defined_vars ());
449
+ /**/
450
+ return;
451
+ }
452
+ }
453
+ ?>
includes/functions/demo-users.inc.php ADDED
@@ -0,0 +1,39 @@
1
+ <?php
2
+ /*
3
+ Copyright: © 2009 WebSharks, Inc. ( coded in the USA )
4
+ <mailto:support@websharks-inc.com> <http://www.websharks-inc.com/>
5
+
6
+ Released under the terms of the GNU General Public License.
7
+ You should have received a copy of the GNU General Public License,
8
+ along with this software. In the main directory, see: /licensing/
9
+ If not, see: <http://www.gnu.org/licenses/>.
10
+ */
11
+ /*
12
+ Direct access denial.
13
+ */
14
+ if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit ("Do not access this file directly.");
16
+ /*
17
+ Function hides password fields for demo users.
18
+
19
+ Demo accounts ( where the Username MUST be "demo" ), will NOT be allowed to change their password.
20
+ Any other restrictions you need to impose must be done through custom programming, using s2Member's Conditionals.
21
+ See `s2Member -> API Scripting`.
22
+
23
+ Attach to: add_filter("show_password_fields");
24
+ */
25
+ if (!function_exists ("ws_plugin__s2member_demo_hide_password_fields"))
26
+ {
27
+ function ws_plugin__s2member_demo_hide_password_fields ($show = TRUE, $profileuser = FALSE)
28
+ {
29
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
30
+ do_action ("ws_plugin__s2member_before_demo_hide_password_fields", get_defined_vars ());
31
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
32
+ /**/
33
+ if ($profileuser->user_login === "demo")
34
+ return ($show = false);
35
+ /**/
36
+ return $show;
37
+ }
38
+ }
39
+ ?>
includes/functions/demotions.inc.php DELETED
@@ -1,29 +0,0 @@
1
- <?php
2
- /*
3
- Copyright: © 2009 WebSharks, Inc. ( coded in the USA )
4
- <mailto:support@websharks-inc.com> <http://www.websharks-inc.com/>
5
-
6
- Released under the terms of the GNU General Public License.
7
- You should have received a copy of the GNU General Public License,
8
- along with this software. In the main directory, see: /licensing/
9
- If not, see: <http://www.gnu.org/licenses/>.
10
- */
11
- /*
12
- Direct access denial.
13
- */
14
- if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
- exit ("Do not access this file directly.");
16
- /*
17
- Forces a specific Role to demote to; whenever a Member is demoted in one way or another.
18
- Use by PayPal® IPN routines, and also by the Auto-EOT system.
19
- */
20
- if (!function_exists ("ws_plugin__s2member_force_demotion_role"))
21
- {
22
- function ws_plugin__s2member_force_demotion_role ($demotion_role = FALSE)
23
- {
24
- do_action ("ws_plugin__s2member_before_force_demotion_role", get_defined_vars ());
25
- /**/
26
- return apply_filters ("ws_plugin__s2member_force_demotion_role", ($demotion_role = "subscriber"), get_defined_vars ());
27
- }
28
- }
29
- ?>
includes/functions/email-configs.inc.php CHANGED
@@ -12,7 +12,7 @@ If not, see: <http://www.gnu.org/licenses/>.
12
Direct access denial.
13
*/
14
if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
- exit("Do not access this file directly.");
16
/*
17
Functions that modify the email From: name/address.
18
*/
@@ -50,4 +50,22 @@ if (!function_exists ("_ws_plugin__s2member_email_config_name"))
50
return apply_filters ("_ws_plugin__s2member_email_config_name", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_name"], get_defined_vars ());
51
}
52
}
53
?>
12
Direct access denial.
13
*/
14
if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit ("Do not access this file directly.");
16
/*
17
Functions that modify the email From: name/address.
18
*/
50
return apply_filters ("_ws_plugin__s2member_email_config_name", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_name"], get_defined_vars ());
51
}
52
}
53
+ /*
54
+ Convert primitive Role names in emails sent by WordPress®.
55
+ Attach to: add_filter("wpmu_signup_user_notification_email");
56
+ ~ Only necessary with this particular email.
57
+ */
58
+ if (!function_exists ("ws_plugin__s2member_ms_nice_email_roles"))
59
+ {
60
+ function ws_plugin__s2member_ms_nice_email_roles ($message = FALSE)
61
+ {
62
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
63
+ do_action ("ws_plugin__s2member_before_ms_nice_email_roles", get_defined_vars ());
64
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
65
+ /**/
66
+ $message = preg_replace ("/ as a (subscriber|s2member_level[1-4])/i", " as a Member", $message);
67
+ /**/
68
+ return apply_filters ("ws_plugin__s2member_ms_nice_email_roles", $message, get_defined_vars ());
69
+ }
70
+ }
71
?>
includes/functions/force-options.inc.php ADDED
@@ -0,0 +1,271 @@
1
+ <?php
2
+ /*
3
+ Copyright: © 2009 WebSharks, Inc. ( coded in the USA )
4
+ <mailto:support@websharks-inc.com> <http://www.websharks-inc.com/>
5
+
6
+ Released under the terms of the GNU General Public License.
7
+ You should have received a copy of the GNU General Public License,
8
+ along with this software. In the main directory, see: /licensing/
9
+ If not, see: <http://www.gnu.org/licenses/>.
10
+ */
11
+ /*
12
+ Direct access denial.
13
+ */
14
+ if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit ("Do not access this file directly.");
16
+ /*
17
+ Forces a default Role for new registrations, NOT tied to an incoming payment.
18
+ Attach to: add_filter("pre_option_default_role");
19
+ */
20
+ if (!function_exists ("ws_plugin__s2member_force_default_role"))
21
+ {
22
+ function ws_plugin__s2member_force_default_role ($default_role = FALSE)
23
+ {
24
+ do_action ("ws_plugin__s2member_before_force_default_role", get_defined_vars ());
25
+ /**/
26
+ return apply_filters ("ws_plugin__s2member_force_default_role", ($default_role = "subscriber"), get_defined_vars ());
27
+ }
28
+ }
29
+ /*
30
+ Forces a default Role for new Multisite registrations ( on the Main Site ) NOT tied to an incoming payment.
31
+ Attach to: add_filter("pre_site_option_default_user_role");
32
+ */
33
+ if (!function_exists ("ws_plugin__s2member_force_mms_default_role"))
34
+ {
35
+ function ws_plugin__s2member_force_mms_default_role ($default_role = FALSE)
36
+ {
37
+ do_action ("ws_plugin__s2member_before_force_mms_default_role", get_defined_vars ());
38
+ /**/
39
+ return apply_filters ("ws_plugin__s2member_force_mms_default_role", ($default_role = "subscriber"), get_defined_vars ());
40
+ }
41
+ }
42
+ /*
43
+ Forces a specific Role to demote to; whenever a Member is demoted in one way or another.
44
+ Use by PayPal® IPN routines, and also by the Auto-EOT system.
45
+ */
46
+ if (!function_exists ("ws_plugin__s2member_force_demotion_role"))
47
+ {
48
+ function ws_plugin__s2member_force_demotion_role ($demotion_role = FALSE)
49
+ {
50
+ do_action ("ws_plugin__s2member_before_force_demotion_role", get_defined_vars ());
51
+ /**/
52
+ return apply_filters ("ws_plugin__s2member_force_demotion_role", ($demotion_role = "subscriber"), get_defined_vars ());
53
+ }
54
+ }
55
+ /*
56
+ Allows new Users to be created on a Multisite Network.
57
+ Attach to: add_filter("pre_site_option_add_new_users");
58
+ */
59
+ if (!function_exists ("ws_plugin__s2member_mms_allow_new_users"))
60
+ {
61
+ function ws_plugin__s2member_mms_allow_new_users ($allow = FALSE)
62
+ {
63
+ do_action ("ws_plugin__s2member_before_mms_allow_new_users", get_defined_vars ());
64
+ /**/
65
+ return apply_filters ("ws_plugin__s2member_mms_allow_new_users", ($allow = "1"), get_defined_vars ());
66
+ }
67
+ }
68
+ /*
69
+ Forces a Multisite Dashboard Blog to be the Main Site.
70
+ Attach to: add_filter("pre_site_option_dashboard_blog");
71
+ */
72
+ if (!function_exists ("ws_plugin__s2member_mms_dashboard_blog"))
73
+ {
74
+ function ws_plugin__s2member_mms_dashboard_blog ($dashboard_blog = FALSE)
75
+ {
76
+ global $current_site, $current_blog; /* For Multisite support. */
77
+ /**/
78
+ do_action ("ws_plugin__s2member_before_mms_dashboard_blog", get_defined_vars ());
79
+ /**/
80
+ $main_site = ( (is_multisite ()) ? $current_site->blog_id : "1"); /* Forces the Main Site. */
81
+ /**/
82
+ return apply_filters ("ws_plugin__s2member_mms_dashboard_blog", ($dashboard_blog = $main_site), get_defined_vars ());
83
+ }
84
+ }
85
+ /*
86
+ Function for allowing access to the Registration Form.
87
+ This function has been further optimized to reduce DB queries.
88
+ Attach to: add_filter("pre_option_users_can_register");
89
+ */
90
+ if (!function_exists ("ws_plugin__s2member_check_register_access"))
91
+ {
92
+ function ws_plugin__s2member_check_register_access ($users_can_register = FALSE)
93
+ {
94
+ global $wpdb; /* Global database object reference */
95
+ /**/
96
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
97
+ do_action ("ws_plugin__s2member_before_check_register_access", get_defined_vars ());
98
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
99
+ /**/
100
+ $by_default = $users_can_register = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["allow_subscribers_in"];
101
+ /**/
102
+ if (is_multisite () && ws_plugin__s2member_is_multisite_farm () && is_main_site ())
103
+ return apply_filters ("ws_plugin__s2member_check_register_access", ($users_can_register = "0"), get_defined_vars ());
104
+ /**/
105
+ else if (!is_admin () && !$users_can_register) /* Do NOT run these security checks on option pages; it's confusing to a site owner. */
106
+ if (!is_multisite () || !ws_plugin__s2member_is_multisite_farm () || !is_main_site () || is_super_admin () || current_user_can ("create_users"))
107
+ {
108
+ if ((is_multisite () && is_super_admin ()) || current_user_can ("create_users") || ( ($subscr_id = ws_plugin__s2member_decrypt ($_COOKIE["s2member_subscr_id"])) && preg_match ("/^" . preg_quote (preg_replace ("/\:([0-9]+)#x2F;", "", $_SERVER["HTTP_HOST"]), "/") . "/i", ($custom = ws_plugin__s2member_decrypt ($_COOKIE["s2member_custom"]))) && preg_match ("/^[1-4](\:|$)([a-z_0-9,]+)?(\:)?([0-9]+ [A-Z])?#x2F;", ($level = ws_plugin__s2member_decrypt ($_COOKIE["s2member_level"]))) && ! ($exists = $wpdb->get_var ("SELECT `user_id` FROM `" . $wpdb->usermeta . "` WHERE `meta_key` = '" . $wpdb->prefix . "s2member_subscr_id' AND `meta_value` = '" . $wpdb->escape ($subscr_id) . "' LIMIT 1"))))
109
+ {
110
+ return apply_filters ("ws_plugin__s2member_check_register_access", ($users_can_register = "1"), get_defined_vars ());
111
+ }
112
+ }
113
+ /**/
114
+ return apply_filters ("ws_plugin__s2member_check_register_access", $users_can_register, get_defined_vars ());
115
+ }
116
+ }
117
+ /*
118
+ Function for allowing access to the main Multisite Registration Form.
119
+ This function has been further optimized to reduce DB queries.
120
+ Attach to: add_filter("pre_site_option_registration");
121
+ */
122
+ if (!function_exists ("ws_plugin__s2member_check_mms_register_access"))
123
+ {
124
+ function ws_plugin__s2member_check_mms_register_access ($users_can_register = FALSE)
125
+ {
126
+ global $wpdb; /* Global database object reference */
127
+ global $current_site, $current_blog; /* For Multisite support. */
128
+ /**/
129
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
130
+ do_action ("ws_plugin__s2member_before_check_register_access", get_defined_vars ());
131
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
132
+ /**/
133
+ $by_default = $users_can_register = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["mms_registration_grants"];
134
+ /**/
135
+ if (!is_multisite () || !ws_plugin__s2member_is_multisite_farm () || !is_main_site ()) /* NOT a Blog Farm. */
136
+ return apply_filters ("ws_plugin__s2member_check_mms_register_access", ($users_can_register = "none"), get_defined_vars ());
137
+ /**/
138
+ else if (!is_admin () && $users_can_register !== "all") /* Do NOT run these security checks on option pages; it's confusing to a site owner. */
139
+ {
140
+ if (is_super_admin () || current_user_can ("create_users") || ( ($subscr_id = ws_plugin__s2member_decrypt ($_COOKIE["s2member_subscr_id"])) && preg_match ("/^" . preg_quote (preg_replace ("/\:([0-9]+)#x2F;", "", $_SERVER["HTTP_HOST"]), "/") . "/i", ($custom = ws_plugin__s2member_decrypt ($_COOKIE["s2member_custom"]))) && preg_match ("/^[1-4](\:|$)([a-z_0-9,]+)?(\:)?([0-9]+ [A-Z])?#x2F;", ($level = ws_plugin__s2member_decrypt ($_COOKIE["s2member_level"]))) && ! ($exists = $wpdb->get_var ("SELECT `user_id` FROM `" . $wpdb->usermeta . "` WHERE `meta_key` = '" . $wpdb->prefix . "s2member_subscr_id' AND `meta_value` = '" . $wpdb->escape ($subscr_id) . "' LIMIT 1"))))
141
+ {
142
+ if (is_super_admin () || current_user_can ("create_users"))
143
+ {
144
+ return apply_filters ("ws_plugin__s2member_check_mms_register_access", ($users_can_register = "all"), get_defined_vars ());
145
+ }
146
+ else if ($subscr_id && $custom && $level) /* A paying Customer? Cookies have already been authenticated above. */
147
+ {
148
+ list ($level) = preg_split ("/\:/", $level, 1); /* Parse out the level now. */
149
+ /**/
150
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["mms_registration_blogs_level" . $level])
151
+ {
152
+ return apply_filters ("ws_plugin__s2member_check_mms_register_access", ($users_can_register = "all"), get_defined_vars ());
153
+ }
154
+ else /* Otherwise, we MUST allow them to create an account; they paid for it! */
155
+ {
156
+ return apply_filters ("ws_plugin__s2member_check_mms_register_access", ($users_can_register = "user"), get_defined_vars ());
157
+ }
158
+ }
159
+ }
160
+ /* --------------------> $users_can_register !== "all", so exclude Level #0. */
161
+ else if (is_user_logged_in () && current_user_can ("access_s2member_level1") && is_object ($current_user = wp_get_current_user ()))
162
+ {
163
+ $blogs_allowed = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["mms_registration_blogs_level" . ws_plugin__s2member_user_access_level ()];
164
+ $current_user_blogs = (is_array ($blogs = get_blogs_of_user ($current_user->ID))) ? count ($blogs) - 1 : 0;
165
+ $current_user_blogs = ($current_user_blogs >= 0) ? $current_user_blogs : 0;
166
+ $blogs_allowed = ($blogs_allowed >= 0) ? $blogs_allowed : 0;
167
+ /**/
168
+ if ($current_user_blogs < $blogs_allowed) /* Are they within their limit? */
169
+ {
170
+ return apply_filters ("ws_plugin__s2member_check_mms_register_access", ($users_can_register = "all"), get_defined_vars ());
171
+ }
172
+ }
173
+ }
174
+ /**/
175
+ else if (!is_admin () && $users_can_register === "all") /* Do NOT run these security checks on option pages; it's confusing to a site owner. */
176
+ {
177
+ if (is_user_logged_in () && is_object ($current_user = wp_get_current_user ()))
178
+ {
179
+ $blogs_allowed = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["mms_registration_blogs_level" . ws_plugin__s2member_user_access_level ()];
180
+ $current_user_blogs = (is_array ($blogs = get_blogs_of_user ($current_user->ID))) ? count ($blogs) - 1 : 0;
181
+ $current_user_blogs = ($current_user_blogs >= 0) ? $current_user_blogs : 0;
182
+ $blogs_allowed = ($blogs_allowed >= 0) ? $blogs_allowed : 0;
183
+ /**/
184
+ if ($current_user_blogs >= $blogs_allowed) /* Are they at their limit? */
185
+ {
186
+ return apply_filters ("ws_plugin__s2member_check_mms_register_access", ($users_can_register = "none"), get_defined_vars ());
187
+ }
188
+ }
189
+ }
190
+ /**/
191
+ return apply_filters ("ws_plugin__s2member_check_mms_register_access", $users_can_register, get_defined_vars ());
192
+ }
193
+ }
194
+ /*
195
+ This handles register access in BuddyPress - for Multisite compatibility.
196
+ Attach to: add_filter("bp_core_get_site_options");
197
+
198
+ BuddyPress bypasses the default Filter ( `pre_site_option_registration` )
199
+ and instead, it uses: bp_core_get_site_options()
200
+ */
201
+ if (!function_exists ("ws_plugin__s2member_check_bp_mms_register_access"))
202
+ {
203
+ function ws_plugin__s2member_check_bp_mms_register_access ($site_options = FALSE)
204
+ {
205
+ if (is_multisite ()) /* Only if Multisite Networking is enabled. Pointless otherwise. */
206
+ $site_options["registration"] = ws_plugin__s2member_check_mms_register_access ($site_options["registration"]);
207
+ /**/
208
+ return apply_filters ("ws_plugin__s2member_check_bp_mms_register_access", $site_options, get_defined_vars ());
209
+ }
210
+ }
211
+ /*
212
+ Function that describes the General Option overrides for clarity.
213
+ Attach to: add_action("admin_init");
214
+ */
215
+ if (!function_exists ("ws_plugin__s2member_general_ops_notice"))
216
+ {
217
+ function ws_plugin__s2member_general_ops_notice ()
218
+ {
219
+ global $pagenow; /* Need this. */
220
+ /**/
221
+ do_action ("ws_plugin__s2member_before_general_ops_notice", get_defined_vars ());
222
+ /**/
223
+ if (is_admin () && $pagenow === "options-general.php" && !isset ($_GET["page"]) && !is_multisite ()) /* Multisite does NOT provide these options. */
224
+ {
225
+ $notice = "<em>* Note: The s2Member plugin has control over two options on this page.<br /><code>Allow Open Registration = " . esc_html (get_option ("users_can_register")) . "</code>, and <code>Default Role = " . esc_html (get_option ("default_role")) . "</code>.<br />For further details, see: <code>s2Member -> General Options -> Open Registration</code>.";
226
+ /**/
227
+ $js = '<script type="text/javascript">';
228
+ $js .= "jQuery('input#users_can_register, select#default_role').attr('disabled', 'disabled');";
229
+ $js .= '</script>';
230
+ /**/
231
+ do_action ("ws_plugin__s2member_during_general_ops_notice", get_defined_vars ());
232
+ /**/
233
+ ws_plugin__s2member_enqueue_admin_notice ($notice . $js, $pagenow);
234
+ }
235
+ /**/
236
+ do_action ("ws_plugin__s2member_after_general_ops_notice", get_defined_vars ());
237
+ /**/
238
+ return;
239
+ }
240
+ }
241
+ /*
242
+ Function that describes the Multisite Option overrides for clarity.
243
+ Attach to: add_action("admin_init");
244
+ */
245
+ if (!function_exists ("ws_plugin__s2member_multisite_ops_notice"))
246
+ {
247
+ function ws_plugin__s2member_multisite_ops_notice ()
248
+ {
249
+ global $pagenow; /* Need this. */
250
+ /**/
251
+ do_action ("ws_plugin__s2member_before_multisite_ops_notice", get_defined_vars ());
252
+ /**/
253
+ if (is_admin () && $pagenow === "ms-options.php" && !isset ($_GET["page"]) && is_multisite ()) /* Only with Multisite Networking enabled. */
254
+ {
255
+ $notice = "<em>* Note: The s2Member plugin has control over four options on this page.<br /><code>Dashboard Blog = " . esc_html (get_site_option ("dashboard_blog")) . " / Main Site</code>, <code>Default Role = " . esc_html (get_site_option ("default_user_role")) . "</code>, <code>Allow Open Registration = " . esc_html (get_site_option ("registration")) . "</code>, and <code>Add New Users = " . esc_html (get_site_option ("add_new_users")) . "</code>.<br />In your Dashboard ( on the Main Site ), see: <code>s2Member -> Multisite ( Config )</code>.";
256
+ /**/
257
+ $js = '<script type="text/javascript">';
258
+ $js .= "jQuery('input#dashboard_blog, select#default_user_role, input[name=registration], input#add_new_users').attr('disabled', 'disabled');";
259
+ $js .= '</script>';
260
+ /**/
261
+ do_action ("ws_plugin__s2member_during_multisite_ops_notice", get_defined_vars ());
262
+ /**/
263
+ ws_plugin__s2member_enqueue_admin_notice ($notice . $js, $pagenow);
264
+ }
265
+ /**/
266
+ do_action ("ws_plugin__s2member_after_multisite_ops_notice", get_defined_vars ());
267
+ /**/
268
+ return;
269
+ }
270
+ }
271
+ ?>
includes/functions/list-servers.inc.php CHANGED
@@ -12,7 +12,24 @@ If not, see: <http://www.gnu.org/licenses/>.
12
Direct access denial.
13
*/
14
if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
- exit("Do not access this file directly.");
16
/*
17
Function that process list server integrations for s2Member.
18
*/
@@ -20,7 +37,7 @@ if (!function_exists ("ws_plugin__s2member_process_list_servers"))
20
{
21
function ws_plugin__s2member_process_list_servers ($level = FALSE, $email = FALSE, $fname = FALSE, $lname = FALSE, $ip = FALSE, $opt_in = FALSE)
22
{
23
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
24
do_action ("ws_plugin__s2member_before_process_list_servers", get_defined_vars ());
25
unset ($__refs, $__v); /* Unset defined __refs, __v. */
26
/**/
@@ -46,33 +63,16 @@ if (!function_exists ("ws_plugin__s2member_process_list_servers"))
46
"From: \"" . preg_replace ("/\"/", "", $fname . " " . $lname) . "\" <" . $email . ">\r\nContent-Type: text/plain; charset=utf-8");
47
}
48
/**/
49
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
50
do_action ("ws_plugin__s2member_during_process_list_servers", get_defined_vars ());
51
unset ($__refs, $__v); /* Unset defined __refs, __v. */
52
}
53
/**/
54
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
55
do_action ("ws_plugin__s2member_after_process_list_servers", get_defined_vars ());
56
unset ($__refs, $__v); /* Unset defined __refs, __v. */
57
/**/
58
return;
59
}
60
}
61
- /*
62
- Function that determines whether or not any list
63
- servers have been integrated into the s2Member options.
64
- */
65
- if (!function_exists ("ws_plugin__s2member_list_servers_integrated"))
66
- {
67
- function ws_plugin__s2member_list_servers_integrated ()
68
- {
69
- do_action ("ws_plugin__s2member_before_list_servers_integrated", get_defined_vars ());
70
- /**/
71
- for ($i = 0; $i <= 4; $i++)
72
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $i . "_mailchimp_list_ids"] || $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $i . "_aweber_list_ids"])
73
- return apply_filters ("ws_plugin__s2member_list_servers_integrated", true, get_defined_vars ());
74
- /**/
75
- return apply_filters ("ws_plugin__s2member_list_servers_integrated", false, get_defined_vars ());
76
- }
77
- }
78
?>
12
Direct access denial.
13
*/
14
if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit ("Do not access this file directly.");
16
+ /*
17
+ Function that determines whether or not any list
18
+ servers have been integrated into the s2Member options.
19
+ */
20
+ if (!function_exists ("ws_plugin__s2member_list_servers_integrated"))
21
+ {
22
+ function ws_plugin__s2member_list_servers_integrated ()
23
+ {
24
+ do_action ("ws_plugin__s2member_before_list_servers_integrated", get_defined_vars ());
25
+ /**/
26
+ for ($i = 0; $i <= 4; $i++)
27
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $i . "_mailchimp_list_ids"] || $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $i . "_aweber_list_ids"])
28
+ return apply_filters ("ws_plugin__s2member_list_servers_integrated", true, get_defined_vars ());
29
+ /**/
30
+ return apply_filters ("ws_plugin__s2member_list_servers_integrated", false, get_defined_vars ());
31
+ }
32
+ }
33
/*
34
Function that process list server integrations for s2Member.
35
*/
37
{
38
function ws_plugin__s2member_process_list_servers ($level = FALSE, $email = FALSE, $fname = FALSE, $lname = FALSE, $ip = FALSE, $opt_in = FALSE)
39
{
40
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
41
do_action ("ws_plugin__s2member_before_process_list_servers", get_defined_vars ());
42
unset ($__refs, $__v); /* Unset defined __refs, __v. */
43
/**/
63
"From: \"" . preg_replace ("/\"/", "", $fname . " " . $lname) . "\" <" . $email . ">\r\nContent-Type: text/plain; charset=utf-8");
64
}
65
/**/
66
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
67
do_action ("ws_plugin__s2member_during_process_list_servers", get_defined_vars ());
68
unset ($__refs, $__v); /* Unset defined __refs, __v. */
69
}
70
/**/
71
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
72
do_action ("ws_plugin__s2member_after_process_list_servers", get_defined_vars ());
73
unset ($__refs, $__v); /* Unset defined __refs, __v. */
74
/**/
75
return;
76
}
77
}
78
?>
includes/functions/login-customizations.inc.php CHANGED
@@ -57,31 +57,48 @@ if (!function_exists ("ws_plugin__s2member_login_header_styles"))
57
do_action ("ws_plugin__s2member_before_login_header_styles", get_defined_vars ());
58
unset ($__refs, $__v); /* Unset defined __refs, __v. */
59
/**/
60
$s .= "\n" . '<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"></script>' . "\n";
61
$s .= '<script type="text/javascript" src="' . get_bloginfo ("wpurl") . '/?ws_plugin__s2member_js_w_globals=1&amp;no-cache=' . urlencode (md5 (mt_rand ())) . '"></script>' . "\n";
62
/**/
63
$s .= "\n" . '<style type="text/css">' . "\n";
64
/**/
65
- $s .= 'html, body { border: 0 !important; background: none !important; }' . "\n"; /* Clear borders & existing background. */
66
- $s .= 'html { background-color: #' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_color"] . ' !important; }' . "\n";
67
- $s .= 'html { background-image: url(' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_image"] . ') !important; }' . "\n";
68
- $s .= 'html { background-repeat: ' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_image_repeat"] . ' !important; }' . "\n";
69
/**/
70
- $s .= 'p#backtoblog a, p#backtoblog a:hover, p#backtoblog a:active, p#backtoblog a:focus { color: #' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_text_color"] . ' !important; text-shadow: 1px 1px 3px #' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_text_shadow_color"] . ' !important; top: 15px !important; left: 15px !important; padding: 10px !important; border:1px solid #' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_box_shadow_color"] . ' !important; background-color: #' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_color"] . ' !important; -moz-border-radius:3px !important; -webkit-border-radius:3px !important; border-radius:3px !important; }' . "\n";
71
/**/
72
- $s .= 'div#login { width: ' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_logo_src_width"] . 'px !important; }' . "\n";
73
- $s .= 'div#login h1 a { background: url(' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_logo_src"] . ') no-repeat top center !important; }' . "\n";
74
- $s .= 'div#login h1 a { display: block !important; width: 100% !important; height: ' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_logo_src_height"] . 'px !important; }' . "\n";
75
- $s .= 'div#login p#nav, div#login p#nav a, div#login p#nav a:hover, div#login p#nav a:active, div#login p#nav a:focus { color: #' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_text_color"] . ' !important; text-shadow: 1px 1px 3px #' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_text_shadow_color"] . ' !important; }' . "\n";
76
- $s .= 'div#login form { -moz-box-shadow: 1px 1px 5px #' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_box_shadow_color"] . ', -1px -1px 5px #' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_box_shadow_color"] . ' !important; -webkit-box-shadow: 1px 1px 5px #' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_box_shadow_color"] . ', -1px -1px 5px #' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_box_shadow_color"] . ' !important; -khtml-box-shadow: 1px 1px 5px #' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_box_shadow_color"] . ', -1px -1px 5px #' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_box_shadow_color"] . ' !important; box-shadow: 1px 1px 5px #' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_box_shadow_color"] . ', -1px -1px 5px #' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_box_shadow_color"] . ' !important; }' . "\n";
77
- $s .= 'div#login form input[type="submit"], div#login form input[type="submit"]:hover, div#login form input[type="submit"]:active, div#login form input[type="submit"]:focus { color: #333333 !important; border: 1px solid #666666 !important; background: #CCCCCC !important; padding: 5px !important; -moz-border-radius: 3px !important; -webkit-border-radius: 3px !important; -khtml-border-radius: 3px !important; border-radius: 3px !important; }' . "\n";
78
- $s .= 'div#login form input[type="submit"]:hover, div#login form input[type="submit"]:active, div#login form input[type="submit"]:focus { color: #000000 !important; border: 1px solid #000000 !important; }' . "\n";
79
/**/
80
- $s .= 'div#login form input.ws-plugin--s2member-custom-reg-field, div#login form select.ws-plugin--s2member-custom-reg-field { background:none repeat scroll 0 0 #FBFBFB; border:1px solid #E5E5E5; font-size:24px; margin-bottom:16px; margin-right:6px; margin-top:2px; padding:3px; width:97%; }' . "\n";
81
- $s .= 'div#login form select.ws-plugin--s2member-custom-reg-field { width:99%; }' . "\n"; /* Adjust select fields. */
82
/**/
83
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_password"])
84
- $s .= 'p#reg_passmail { display: none; }' . "\n";
85
/**/
86
$s .= '</style>' . "\n\n";
87
/**/
57
do_action ("ws_plugin__s2member_before_login_header_styles", get_defined_vars ());
58
unset ($__refs, $__v); /* Unset defined __refs, __v. */
59
/**/
60
+ /* The !important declarations can be disabled here if you need to apply other hard-coded styles. */
61
+ $important = $i = apply_filters ("ws_plugin__s2member_login_header_styles_important", " !important", get_defined_vars ());
62
+ /**/
63
$s .= "\n" . '<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"></script>' . "\n";
64
$s .= '<script type="text/javascript" src="' . get_bloginfo ("wpurl") . '/?ws_plugin__s2member_js_w_globals=1&amp;no-cache=' . urlencode (md5 (mt_rand ())) . '"></script>' . "\n";
65
/**/
66
$s .= "\n" . '<style type="text/css">' . "\n";
67
/**/
68
+ $s .= 'html, body { border: 0' . $i . '; background: none' . $i . '; }' . "\n"; /* Clear existing. */
69
+ $s .= 'html { background-color: #' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_color"] . $i . '; }' . "\n";
70
+ $s .= 'html { background-image: url(' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_image"] . ')' . $i . '; }' . "\n";
71
+ $s .= 'html { background-repeat: ' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_image_repeat"] . $i . '; }' . "\n";
72
+ /**/
73
+ $s .= 'body, body * { font-size: ' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_font_size"] . $i . '; }' . "\n";
74
+ $s .= 'body, body * { font-family: ' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_font_family"] . $i . '; }' . "\n";
75
+ /**/
76
+ $s .= 'p#backtoblog a, p#backtoblog a:hover, p#backtoblog a:active, p#backtoblog a:focus { color: #' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_text_color"] . $i . '; text-shadow: 1px 1px 3px #' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_text_shadow_color"] . $i . '; top: 15px' . $i . '; left: 15px' . $i . '; padding: 10px' . $i . '; border:1px solid #' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_box_shadow_color"] . $i . '; background-color: #' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_color"] . $i . '; -moz-border-radius:3px' . $i . '; -webkit-border-radius:3px' . $i . '; border-radius:3px' . $i . '; }' . "\n";
77
+ /**/
78
+ $s .= 'div#login { width: ' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_logo_src_width"] . 'px' . $i . '; }' . "\n";
79
+ $s .= 'div#login h1 a { background: url(' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_logo_src"] . ') no-repeat top center' . $i . '; }' . "\n";
80
+ $s .= 'div#login h1 a { display: block' . $i . '; width: 100%' . $i . '; height: ' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_logo_src_height"] . 'px' . $i . '; }' . "\n";
81
+ /**/
82
+ $s .= 'div#login form { -moz-box-shadow: 1px 1px 5px #' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_box_shadow_color"] . ', -1px -1px 5px #' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_box_shadow_color"] . $i . '; -webkit-box-shadow: 1px 1px 5px #' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_box_shadow_color"] . ', -1px -1px 5px #' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_box_shadow_color"] . $i . '; box-shadow: 1px 1px 5px #' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_box_shadow_color"] . ', -1px -1px 5px #' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_box_shadow_color"] . $i . '; }' . "\n";
83
/**/
84
+ $s .= 'div#login p#nav, div#login p#nav a, div#login p#nav a:hover, div#login p#nav a:active, div#login p#nav a:focus { color: #' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_text_color"] . $i . '; text-shadow: 1px 1px 3px #' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_text_shadow_color"] . $i . '; }' . "\n";
85
/**/
86
+ $s .= 'div#login form p { margin: 2px 0 16px 0' . $i . '; }' . "\n"; /* Handle margins. */
87
+ $s .= 'div#login form input[type="text"].input, div#login form input[type="password"].input, div#login form input[type="text"].ws-plugin--s2member-custom-reg-field, div#login form input[type="password"].ws-plugin--s2member-custom-reg-field, div#login form textarea.ws-plugin--s2member-custom-reg-field, div#login form select.ws-plugin--s2member-custom-reg-field { font-weight:normal' . $i . '; color:#333333' . $i . '; background:none repeat scroll 0 0 #FBFBFB' . $i . '; border:1px solid #E5E5E5' . $i . '; font-size:' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_font_field_size"] . $i . '; margin: 0 2% 0 0' . $i . '; padding:3px' . $i . '; width:98%' . $i . '; }' . "\n";
88
+ $s .= 'div#login form input[type="checkbox"].ws-plugin--s2member-custom-reg-field, div#login form input[type="radio"].ws-plugin--s2member-custom-reg-field { vertical-align:middle' . $i . '; }' . "\n";
89
+ $s .= 'div#login form select.ws-plugin--s2member-custom-reg-field > option { font-size:' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_font_field_size"] . $i . '; }' . "\n";
90
+ $s .= 'div#login form label.ws-plugin--s2member-custom-reg-field-op-l { vertical-align:middle' . $i . '; font-size:90%' . $i . '; }' . "\n";
91
+ $s .= 'div#login form select.ws-plugin--s2member-custom-reg-field { width:100%' . $i . '; }' . "\n";
92
/**/
93
+ $s .= 'div#login form p.submit { margin-bottom: 0' . $i . '; }' . "\n";
94
+ $s .= 'div#login form input[type="submit"], div#login form input[type="submit"]:hover, div#login form input[type="submit"]:active, div#login form input[type="submit"]:focus { color: #666666' . $i . '; text-shadow: 2px 2px 5px #EEEEEE' . $i . '; border: 1px solid #999999' . $i . '; background: #FBFBFB' . $i . '; padding: 5px' . $i . '; -moz-border-radius: 3px' . $i . '; -webkit-border-radius: 3px' . $i . '; border-radius: 3px' . $i . '; }' . "\n";
95
+ $s .= 'div#login form input[type="submit"]:hover, div#login form input[type="submit"]:active, div#login form input[type="submit"]:focus { color: #000000' . $i . '; text-shadow: 2px 2px 5px #CCCCCC' . $i . '; border-color: #000000' . $i . '; }' . "\n";
96
+ $s .= 'div#login form#lostpasswordform { padding-bottom: 16px' . $i . '; } div#login form#lostpasswordform p.submit { float: none' . $i . '; } div#login form#lostpasswordform input[type="submit"] { width: 100%' . $i . '; }' . "\n";
97
+ $s .= 'div#login form#registerform { padding-bottom: 16px' . $i . '; } div#login form#registerform p.submit { float: none' . $i . '; margin-top: -10px' . $i . '; } div#login form#registerform input[type="submit"] { width: 100%' . $i . '; }' . "\n";
98
/**/
99
+ $s .= 'div#login form#registerform p#reg_passmail { font-style: italic' . $i . '; }' . "\n";
100
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_password"])
101
+ $s .= 'p#reg_passmail { display: none' . $i . '; }' . "\n";
102
/**/
103
$s .= '</style>' . "\n\n";
104
/**/
includes/functions/menu-pages.inc.php CHANGED
@@ -12,74 +12,67 @@ If not, see: <http://www.gnu.org/licenses/>.
12
Direct access denial.
13
*/
14
if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
- exit("Do not access this file directly.");
16
/*
17
- Function for saving all options from any page.
18
*/
19
if (!function_exists ("ws_plugin__s2member_update_all_options"))
20
{
21
function ws_plugin__s2member_update_all_options ($new_options = FALSE, $verified = FALSE, $update_other = TRUE, $display_notices = TRUE, $enqueue_notices = FALSE)
22
{
23
- do_action ("ws_plugin__s2member_before_update_all_options", get_defined_vars ());
24
/**/
25
- if ($verified || (($nonce = $_POST["ws_plugin__s2member_options_save"]) && wp_verify_nonce ($nonce, "ws-plugin--s2member-options-save")))
26
{
27
- unset($_POST["ws_plugin__s2member_options_save"]); /* Unset this key before we begin. */
28
/**/
29
- $options = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]; /* Get current options. */
30
- $new_options = (is_array ($new_options)) ? $new_options : $_POST; /* New! */
31
- /**/
32
- foreach ($new_options as $key => $value) /* Go through each POST variable and look for s2member. */
33
- {
34
- if (preg_match ("/^" . preg_quote ("ws_plugin__s2member", "/") . "/", $key)) /* Look for keys. */
35
{
36
- if ($key === "ws_plugin__s2member_configured") /* This is a special configuration option. */
37
- {
38
- update_option ("ws_plugin__s2member_configured", trim (stripslashes ($value))); /* Update this option separately. */
39
- /**/
40
- $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["configured"] = trim (stripslashes ($value)); /* Update on-the-fly. */
41
- }
42
- else /* We need to place this option into the array. Here we remove the ws_plugin__s2member_ portion on the beginning. */
43
- {
44
- (is_array ($value)) ? array_shift ($value) : null; /* Arrays should be padded, 1st key is removed. */
45
- $options[preg_replace ("/^" . preg_quote ("ws_plugin__s2member_", "/") . "/", "", $key)] = $value;
46
- }
47
}
48
- }
49
- /**/
50
- $options["options_version"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["options_version"] + 0.001; /* Increment options version. */
51
/**/
52
- $options = ws_plugin__s2member_configure_options_and_their_defaults ($options); /* Also updates the global options array. */
53
/**/
54
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
55
do_action ("ws_plugin__s2member_during_update_all_options", get_defined_vars ());
56
unset ($__refs, $__v); /* Unset defined __refs, __v. */
57
/**/
58
update_option ("ws_plugin__s2member_options", $options) . update_option ("ws_plugin__s2member_cache", array ());
59
/**/
60
- if ($update_other === true || (is_array ($update_other) && in_array ("auto_eot_system", $update_other)))
61
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["auto_eot_system_enabled"] == 1)
62
- ws_plugin__s2member_add_auto_eot_system (); /* 1 == WP-Cron. */
63
- else /* Otherwise, the Auto-EOT System via WP-Cron is disabled. */
64
- ws_plugin__s2member_delete_auto_eot_system ();
65
- /**/
66
- if ($display_notices === true || (is_array ($display_notices) && in_array ("options_saved", $display_notices)))
67
- if ($enqueue_notices === true || (is_array ($enqueue_notices) && in_array ("options_saved", $enqueue_notices)))
68
- ws_plugin__s2member_enqueue_admin_notice('<strong>Options saved.</strong>');
69
- else /* Otherwise, we can go ahead and display the notice immediately. Not queuing. */
70
- ws_plugin__s2member_display_admin_notice('<strong>Options saved.</strong>');
71
-