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

Version Description

  • Simple Conditionals. Staring with s2Member v3.2.1, "Simple Conditionals" are now available to you from within WordPress, using Shortcodes that are fully compatible with both the Visual Editor, and also the HTML Tab in WordPress. We've been through all of the documentation for s2Member, and updated ALL code samples to provide you with Shortcode equivalents. You can learn more about these new Shortcodes in your WP Dashboard, under: s2Member -> API Scripting -> Simple Conditionals. There are three new Shortcodes all together: s2All, s2Any, and s2Get - which allows you to pull all sorts of information from your WordPress installation, without a single line of PHP code. All compatible with the Visual Editor. We also suggest a re-review of s2Member's API Constants, under: s2Member -> API Scripting -> Constants. This will NOT affect any existing Conditionals that you've written. Simple Conditionals are a NEW feature, and they'll have no affect on Advanced Conditionals; which have always been available for s2Member.
  • Feature. s2Member now comes equipped with an advanced behavioral setting; specifically geared toward two special events ( Refunds/Reversals ). With s2Member v3.2.1+, you will find a new option which gives you more control over the way s2Member handles these two events. In your WP Dashboard, see: s2Member -> PayPal Options -> EOT Behavior.
  • Bug fix. s2Member's bbPress Bridge integration was using a hard-coded reference to wp_capabilities, instead of using an option call to determine the WordPress table prefix that was needed for some installations. This was affecting installations of WordPress that were using a non-standard wp_ prefix. Corrected in s2Member v3.2.1. In addition, another bug was found, causing the error: missing argument in preg_replace. This has also been corrected with s2Member v3.2.1+.
  • Bug fix. Invalid method WP_User->hap_cap(). This should have been WP_User->has_cap(). This was negatively affecting the new Custom Capabilities per-Post/Page introduced in the previous release of s2Member v3.2. This bug has been resolved with s2Member v3.2.1+.
  • Hooks/Filters. Several new Hooks/Filters for Custom Fields. The upcoming release of s2Member v3.3 will include many new features for Custom Fields. In the mean time, these new Hooks/Filters integrated into /includes/functions/register-access.inc.php will make it easier for developers to maniuplate the display of Custom Fields. One such example is the Filter ws_plugin__s2member_during_custom_registration_fields_during_custom_fields_display.
  • Forcing SSL w/ PayPal Pro integration. The Custom Field s2member_force_ssl=yes is now more powerful. s2Member is now capable of forcing SSL ( i.e. https:// ) on certain Posts/Pages, WITHOUT causing a site-wide conversion to https. In other words, s2Member can now buffer content without affecting href tags within that content, and/or in your navigation menus. Improvements to this routine make integrations of PayPal Pro Forms easier than ever. Just add this Custom Field to any Post/Page that you want to force SSL on: s2member_force_ssl=yes. This is compatible with almost ANY WordPress theme. Or, if your host requires a specific port number in the URL, use this instead: s2member_force_ssl=443. This Custom Field can be added in your Post/Page editing stations; inside WordPress. ( * This is also compatible with the Quick Cache plugin for WordPress, so that PayPal Pro Forms can be cached initially for speed optimization. )
  • IP Restrictions ( i.e. s2Member -> General Options -> IP Restrictions ), have been enhanced to provide better security against slower attacks that may span several weeks/months. s2Member's IP Restrictions are now capable of internal concurrency timeouts on a per-IP basis, as opposed to just a per entry-point basis. In addition, s2Member is now smarter about the way it enforces your configured Punishment Period. Some additional documentation on how IP Restrictions work, is now available in your s2Member General Options panel. There's nothing you need to change though; just review the updated details on this topic in your General Options panel for s2Member.
  • Bug fix. The new Meta Box panel that was made available in the previous release of s2Member ( e.g. in your Post/Page editing stations ), was saving an empty array when there were no Custom Capabilities being specified/required. This is/was harmless; however, it WAS causing s2member_ccaps_req to appear in the Custom Fields drop-down menu for each Post/Page; even with no Custom Capabilities were required. This confusing behavior has been resolved with s2Member v3.2.1+.
  • Bug fix. A new feature added in the previous release of s2Member, making it possible to Add A User through WordPress ( including all s2Member fields initially, without a subsequent Edit ), was working with Multisite enabled, but broken WITHOUT Multisite enabled. This has been resolved with s2Member v3.2.1+. This feature is now working with or without Multisite Networking enabled.
Download this release

Release Info

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

Code changes from version 3.2 to 3.2.1

Files changed (91) hide show
  1. includes/codes.inc.php +13 -1
  2. includes/dropins/bridges/_s2member-bbpress-bridge.php +9 -5
  3. includes/functions/api-functions.inc.php +152 -0
  4. includes/functions/force-ssl.inc.php +32 -3
  5. includes/functions/ip-restrictions.inc.php +40 -21
  6. includes/functions/login-customizations.inc.php +5 -4
  7. includes/functions/meta-boxes.inc.php +27 -17
  8. includes/functions/page-level-access.inc.php +1 -1
  9. includes/functions/paypal-button.inc.php +11 -11
  10. includes/functions/paypal-notify.inc.php +20 -6
  11. includes/functions/post-level-access.inc.php +1 -1
  12. includes/functions/register-access.inc.php +38 -17
  13. includes/functions/sc-conditionals.inc.php +168 -0
  14. includes/functions/sc-get-details.inc.php +77 -0
  15. includes/functions/users-list.inc.php +19 -8
  16. includes/functions/utilities.inc.php +0 -44
  17. includes/hooks.inc.php +3 -1
  18. includes/menu-pages/code-samples/current-user-access-label.php +5 -1
  19. includes/menu-pages/code-samples/current-user-access-level-conditional-upgrades.php +23 -1
  20. includes/menu-pages/code-samples/current-user-access-level.php +27 -1
  21. includes/menu-pages/code-samples/current-user-can-ccaps-1.php +22 -2
  22. includes/menu-pages/code-samples/current-user-can-ccaps-2.php +38 -2
  23. includes/menu-pages/code-samples/current-user-can-full-access.php +1 -1
  24. includes/menu-pages/code-samples/current-user-can-specific-content.php +0 -13
  25. includes/menu-pages/code-samples/current-user-custom.php +5 -1
  26. includes/menu-pages/code-samples/current-user-display-name.php +5 -1
  27. includes/menu-pages/code-samples/current-user-downloads-allowed-days.php +5 -1
  28. includes/menu-pages/code-samples/current-user-downloads-allowed-is-unlimited.php +5 -1
  29. includes/menu-pages/code-samples/current-user-downloads-allowed.php +5 -1
  30. includes/menu-pages/code-samples/current-user-downloads-currently.php +5 -1
  31. includes/menu-pages/code-samples/current-user-email.php +5 -1
  32. includes/menu-pages/code-samples/current-user-fields.php +17 -1
  33. includes/menu-pages/code-samples/current-user-first-name.php +5 -1
  34. includes/menu-pages/code-samples/current-user-id.php +5 -1
  35. includes/menu-pages/code-samples/current-user-ip.php +5 -1
  36. includes/menu-pages/code-samples/current-user-is-logged-in-as-member.php +7 -1
  37. includes/menu-pages/code-samples/current-user-is-logged-in.php +7 -1
  38. includes/menu-pages/code-samples/current-user-is-specific-content.php +13 -0
  39. includes/menu-pages/code-samples/current-user-last-name.php +5 -1
  40. includes/menu-pages/code-samples/current-user-login.php +5 -1
  41. includes/menu-pages/code-samples/current-user-profile-modification-page-url-1.php +5 -1
  42. includes/menu-pages/code-samples/current-user-registration-days-dripping.php +7 -1
  43. includes/menu-pages/code-samples/current-user-registration-days.php +7 -1
  44. includes/menu-pages/code-samples/current-user-registration-time.php +5 -1
  45. includes/menu-pages/code-samples/current-user-subscr-id.php +5 -1
  46. includes/menu-pages/code-samples/current-user-value-for-pp-on0-os0.php +6 -1
  47. includes/menu-pages/code-samples/file-download-inline-extensions.php +5 -1
  48. includes/menu-pages/code-samples/file-download-limit-exceeded-page-url.php +5 -1
  49. includes/menu-pages/code-samples/level0-file-downloads-allowed-days.php +5 -1
  50. includes/menu-pages/code-samples/level0-file-downloads-allowed.php +5 -1
  51. includes/menu-pages/code-samples/level0-label.php +5 -1
  52. includes/menu-pages/code-samples/level1-file-downloads-allowed-days.php +5 -1
  53. includes/menu-pages/code-samples/level1-file-downloads-allowed.php +5 -1
  54. includes/menu-pages/code-samples/level1-label.php +5 -1
  55. includes/menu-pages/code-samples/level2-file-downloads-allowed-days.php +5 -1
  56. includes/menu-pages/code-samples/level2-file-downloads-allowed.php +5 -1
  57. includes/menu-pages/code-samples/level2-label.php +5 -1
  58. includes/menu-pages/code-samples/level3-file-downloads-allowed-days.php +5 -1
  59. includes/menu-pages/code-samples/level3-file-downloads-allowed.php +5 -1
  60. includes/menu-pages/code-samples/level3-label.php +5 -1
  61. includes/menu-pages/code-samples/level4-file-downloads-allowed-days.php +5 -1
  62. includes/menu-pages/code-samples/level4-file-downloads-allowed.php +5 -1
  63. includes/menu-pages/code-samples/level4-label.php +5 -1
  64. includes/menu-pages/code-samples/login-page-url.php +5 -1
  65. includes/menu-pages/code-samples/login-welcome-page-url.php +5 -1
  66. includes/menu-pages/code-samples/logout-page-url.php +5 -1
  67. includes/menu-pages/code-samples/membership-options-page-url.php +5 -1
  68. includes/menu-pages/code-samples/paypal-business.php +5 -1
  69. includes/menu-pages/code-samples/paypal-endpoint.php +5 -1
  70. includes/menu-pages/code-samples/paypal-notify-url.php +5 -1
  71. includes/menu-pages/code-samples/paypal-return-url.php +5 -1
  72. includes/menu-pages/code-samples/reg-email-from-email.php +5 -1
  73. includes/menu-pages/code-samples/reg-email-from-name.php +5 -1
  74. includes/menu-pages/code-samples/s2-conditional-supplements-1.php +7 -0
  75. includes/menu-pages/code-samples/s2-conditional-supplements-2.php +7 -0
  76. includes/menu-pages/code-samples/s2-conditional-supplements-3.php +18 -0
  77. includes/menu-pages/code-samples/sc-current-user-can-full-access.php +7 -0
  78. includes/menu-pages/code-samples/sc-current-user-is-specific-content.php +23 -0
  79. includes/menu-pages/code-samples/sc-is-user-logged-in.php +7 -0
  80. includes/menu-pages/code-samples/sc-s2-conditional-supplements-1.php +28 -0
  81. includes/menu-pages/code-samples/sc-s2-conditional-supplements-2.php +34 -0
  82. includes/menu-pages/code-samples/sc-s2-conditional-supplements-3.php +31 -0
  83. includes/menu-pages/code-samples/version.php +5 -1
  84. includes/menu-pages/options.inc.php +33 -21
  85. includes/menu-pages/paypal-ops.inc.php +26 -2
  86. includes/menu-pages/scripting.inc.php +100 -10
  87. includes/menu-pages/start.inc.php +1 -1
  88. includes/profile.inc.php +48 -0
  89. includes/syscon.inc.php +9 -5
  90. readme.txt +15 -4
  91. s2member.php +4 -4
includes/codes.inc.php CHANGED
@@ -17,5 +17,17 @@ if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
17
Add WordPress® Editor Shortcodes.
18
http://codex.wordpress.org/Shortcode_API
19
*/
20
- add_shortcode ("s2Member-PayPal-Button", "ws_plugin__s2member_paypal_button");
21
?>
17
Add WordPress® Editor Shortcodes.
18
http://codex.wordpress.org/Shortcode_API
19
*/
20
+ add_shortcode ("s2Get", "ws_plugin__s2member_sc_get_details");
21
+ /**/
22
+ add_shortcode ("s2All", "ws_plugin__s2member_sc_conditionals");
23
+ add_shortcode ("_s2All", "ws_plugin__s2member_sc_conditionals");
24
+ add_shortcode ("__s2All", "ws_plugin__s2member_sc_conditionals");
25
+ add_shortcode ("___s2All", "ws_plugin__s2member_sc_conditionals");
26
+ /**/
27
+ add_shortcode ("s2Any", "ws_plugin__s2member_sc_conditionals");
28
+ add_shortcode ("_s2Any", "ws_plugin__s2member_sc_conditionals");
29
+ add_shortcode ("__s2Any", "ws_plugin__s2member_sc_conditionals");
30
+ add_shortcode ("___s2Any", "ws_plugin__s2member_sc_conditionals");
31
+ /**/
32
+ add_shortcode ("s2Member-PayPal-Button", "ws_plugin__s2member_sc_paypal_button");
33
?>
includes/dropins/bridges/_s2member-bbpress-bridge.php CHANGED
@@ -1,7 +1,7 @@
1
<?php
2
/*
3
- Version: 1.0.1
4
- Stable tag: 1.0.1
5
Framework: WS-BB-DIP-1.0
6
7
Tested up to: 1.0.2
@@ -42,11 +42,13 @@ add_action ("bb_init", "ws_plugin__s2member_bridge_bbpress_roles");
42
/**/
43
function ws_plugin__s2member_bridge_bbpress_roles () /* On-the-fly. */
44
{
45
if (is_object ($user = bb_get_current_user ()) && $user->ID) /* Logged in? */
46
/**/
47
if (empty ($user->roles)) /* Only when no bbPress® Role has been assigned yet. */
48
/**/
49
- foreach ($user->wp_capabilities as $wp_cap => $v) /* Check ^s2member_level[1-4]+ */
50
/**/
51
if (preg_match ("/^s2member_level[0-4]#x2F;", $wp_cap)) /* An s2Member Role? */
52
{
@@ -69,6 +71,8 @@ function ws_plugin__s2member_bridge_bbpress_access () /* Check Access. */
69
/**/
70
$location = bb_get_location (); /* The current navigation location. */
71
/**/
72
if (!in_array ($location, array ("login-page", "register-page")))
73
{
74
if (!bb_is_user_logged_in () || !bb_current_user_can ("participate"))
@@ -89,11 +93,11 @@ function ws_plugin__s2member_bridge_bbpress_access () /* Check Access. */
89
/**/
90
else if (is_object ($user = bb_get_current_user ()) && $user->ID) /* Logged in? / Got User object? */
91
/**/
92
- foreach ($user->wp_capabilities as $wp_cap => $v) /* Looking for ^(subscriber|s2member_level[0-4])$. */
93
/**/
94
if (preg_match ("/^(subscriber|s2member_level[0-4])#x2F;", $wp_cap)) /* Subscribers and/or s2Member Roles. */
95
/**/
96
- if (($wp_cap === "subscriber" && $min > 0) || !strlen ($level = preg_replace ("/[^0-9]/", $wp_cap)) || $level < $min)
97
/**/
98
if ($url = bb_get_option ("wp_siteurl")) /* WordPress® is integrated? */
99
{
1
<?php
2
/*
3
+ Version: 1.0.2
4
+ Stable tag: 1.0.2
5
Framework: WS-BB-DIP-1.0
6
7
Tested up to: 1.0.2
42
/**/
43
function ws_plugin__s2member_bridge_bbpress_roles () /* On-the-fly. */
44
{
45
+ $wp_capabilities = bb_get_option ("wp_table_prefix") . "capabilities";
46
+ /**/
47
if (is_object ($user = bb_get_current_user ()) && $user->ID) /* Logged in? */
48
/**/
49
if (empty ($user->roles)) /* Only when no bbPress® Role has been assigned yet. */
50
/**/
51
+ foreach ($user->$wp_capabilities as $wp_cap => $v) /* Check ^s2member_level[1-4]+ */
52
/**/
53
if (preg_match ("/^s2member_level[0-4]#x2F;", $wp_cap)) /* An s2Member Role? */
54
{
71
/**/
72
$location = bb_get_location (); /* The current navigation location. */
73
/**/
74
+ $wp_capabilities = bb_get_option ("wp_table_prefix") . "capabilities";
75
+ /**/
76
if (!in_array ($location, array ("login-page", "register-page")))
77
{
78
if (!bb_is_user_logged_in () || !bb_current_user_can ("participate"))
93
/**/
94
else if (is_object ($user = bb_get_current_user ()) && $user->ID) /* Logged in? / Got User object? */
95
/**/
96
+ foreach ($user->$wp_capabilities as $wp_cap => $v) /* Looking for ^(subscriber|s2member_level[0-4])$. */
97
/**/
98
if (preg_match ("/^(subscriber|s2member_level[0-4])#x2F;", $wp_cap)) /* Subscribers and/or s2Member Roles. */
99
/**/
100
+ if (($wp_cap === "subscriber" && $min > 0) || ($level = preg_replace ("/[^0-9]/", "", $wp_cap)) < $min)
101
/**/
102
if ($url = bb_get_option ("wp_siteurl")) /* WordPress® is integrated? */
103
{
includes/functions/api-functions.inc.php ADDED
@@ -0,0 +1,152 @@
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
+ API function for Conditionals.
18
+ This matches up with a Simple Conditional made available through a Shortcode.
19
+ Function `is_user_logged_in()` already exists in WordPress® core.
20
+ */
21
+ if (!function_exists ("is_user_not_logged_in"))
22
+ {
23
+ function is_user_not_logged_in ()
24
+ {
25
+ return (!is_user_logged_in ());
26
+ }
27
+ }
28
+ /*
29
+ API function for Conditionals.
30
+ This matches up with a Simple Conditional made available through a Shortcode.
31
+ Function `current_user_can()` already exists in WordPress® core.
32
+ */
33
+ if (!function_exists ("current_user_is"))
34
+ {
35
+ function current_user_is ($role = FALSE)
36
+ {
37
+ $role = ($role === "s2member_level0") ? "subscriber" : $role;
38
+ return current_user_can (preg_replace ("/^access_/i", "", $role));
39
+ }
40
+ }
41
+ /*
42
+ API function for Conditionals.
43
+ This matches up with a Simple Conditional made available through a Shortcode.
44
+ Function `current_user_can()` already exists in WordPress® core.
45
+ */
46
+ if (!function_exists ("current_user_is_not"))
47
+ {
48
+ function current_user_is_not ($role = FALSE)
49
+ {
50
+ $role = ($role === "s2member_level0") ? "subscriber" : $role;
51
+ return (!current_user_can (preg_replace ("/^access_/i", "", $role)));
52
+ }
53
+ }
54
+ /*
55
+ API function for Conditionals.
56
+ This matches up with a Simple Conditional made available through a Shortcode.
57
+ Function `current_user_can_for_blog()` already exists in WordPress® core.
58
+ */
59
+ if (!function_exists ("current_user_is_for_blog"))
60
+ {
61
+ function current_user_is_for_blog ($blog_id = FALSE, $role = FALSE)
62
+ {
63
+ $role = ($role === "s2member_level0") ? "subscriber" : $role;
64
+ return current_user_can_for_blog ($blog_id, preg_replace ("/^access_/i", "", $role));
65
+ }
66
+ }
67
+ /*
68
+ API function for Conditionals.
69
+ This matches up with a Simple Conditional made available through a Shortcode.
70
+ Function `current_user_can_for_blog()` already exists in WordPress® core.
71
+ */
72
+ if (!function_exists ("current_user_is_not_for_blog"))
73
+ {
74
+ function current_user_is_not_for_blog ($blog_id = FALSE, $role = FALSE)
75
+ {
76
+ $role = ($role === "s2member_level0") ? "subscriber" : $role;
77
+ return (!current_user_can_for_blog ($blog_id, preg_replace ("/^access_/i", "", $role)));
78
+ }
79
+ }
80
+ /*
81
+ API function for Conditionals.
82
+ This matches up with a Simple Conditional made available through a Shortcode.
83
+ Function `current_user_can()` already exists in WordPress® core.
84
+ */
85
+ if (!function_exists ("current_user_cannot"))
86
+ {
87
+ function current_user_cannot ($capability = FALSE)
88
+ {
89
+ return (!current_user_can ($capability));
90
+ }
91
+ }
92
+ /*
93
+ API function for Conditionals.
94
+ This matches up with a Simple Conditional made available through a Shortcode.
95
+ Function `current_user_can_for_blog()` already exists in WordPress® core.
96
+ */
97
+ if (!function_exists ("current_user_cannot_for_blog"))
98
+ {
99
+ function current_user_cannot_for_blog ($blog_id = FALSE, $capability = FALSE)
100
+ {
101
+ return (!current_user_can_for_blog ($blog_id, $capability));
102
+ }
103
+ }
104
+ /*
105
+ Alias function for API Scripting usage.
106
+ Deprecated in v3.0.5. This will be removed in a future release.
107
+ Alias to: `ws_plugin__s2member_encrypt()`.
108
+ */
109
+ if (!function_exists ("s2member_encrypt"))
110
+ {
111
+ function s2member_encrypt ($string = FALSE, $key = FALSE)
112
+ {
113
+ return ws_plugin__s2member_encrypt ($string, $key);
114
+ }
115
+ }
116
+ /*
117
+ Alias function for API Scripting usage.
118
+ Deprecated in v3.0.5. This will be removed in a future release.
119
+ Alias to: `ws_plugin__s2member_decrypt()`.
120
+ */
121
+ if (!function_exists ("s2member_decrypt"))
122
+ {
123
+ function s2member_decrypt ($base64 = FALSE, $key = FALSE)
124
+ {
125
+ return ws_plugin__s2member_decrypt ($base64, $key);
126
+ }
127
+ }
128
+ /*
129
+ Alias function for API Scripting usage.
130
+ Deprecated in v3.0.5. This will be removed in a future release.
131
+ Alias to: `ws_plugin__s2member_xencrypt()`.
132
+ */
133
+ if (!function_exists ("s2member_xencrypt"))
134
+ {
135
+ function s2member_xencrypt ($string = FALSE, $key = FALSE)
136
+ {
137
+ return ws_plugin__s2member_xencrypt ($string, $key);
138
+ }
139
+ }
140
+ /*
141
+ Alias function for API Scripting usage.
142
+ Deprecated in v3.0.5. This will be removed in a future release.
143
+ Alias to: `ws_plugin__s2member_xdecrypt()`.
144
+ */
145
+ if (!function_exists ("s2member_xdecrypt"))
146
+ {
147
+ function s2member_xdecrypt ($base64 = FALSE, $key = FALSE)
148
+ {
149
+ return ws_plugin__s2member_xdecrypt ($base64, $key);
150
+ }
151
+ }
152
+ ?>
includes/functions/force-ssl.inc.php CHANGED
@@ -19,6 +19,11 @@ Attach to: add_action("template_redirect");
19
20
Triggered by Custom Field:
21
s2member_force_ssl = yes
22
*/
23
if (!function_exists ("ws_plugin__s2member_check_force_ssl"))
24
{
@@ -39,8 +44,27 @@ if (!function_exists ("ws_plugin__s2member_check_force_ssl"))
39
wp_redirect ("https://" . $ssl_host_port . $_SERVER["REQUEST_URI"]);
40
exit (); /* ^ So let's redirect to the SSL enabled version. */
41
}
42
- else /* Otherwise, we buffer the output, and switch everything to https. */
43
{
44
function _ws_plugin__s2member_force_ssl_buffer ($buffer = FALSE)
45
{
46
$o_pcre = ini_get ("pcre.backtrack_limit");
@@ -61,10 +85,15 @@ if (!function_exists ("ws_plugin__s2member_check_force_ssl"))
61
/**/
62
function _ws_plugin__s2member_force_ssl_buffer_callback ($m = FALSE)
63
{
64
- return preg_replace ("/http\:\/\//i", "https://", $m[0]);
65
}
66
/**/
67
- ob_start ("_ws_plugin__s2member_force_ssl_buffer");
68
}
69
}
70
/**/
19
20
Triggered by Custom Field:
21
s2member_force_ssl = yes
22
+ ( i.e. https://www.example.com/ )
23
+
24
+ Or with a specific port number:
25
+ s2member_force_ssl = 443 ( or whatever port you require )
26
+ ( i.e. https://www.example.com:443/ )
27
*/
28
if (!function_exists ("ws_plugin__s2member_check_force_ssl"))
29
{
44
wp_redirect ("https://" . $ssl_host_port . $_SERVER["REQUEST_URI"]);
45
exit (); /* ^ So let's redirect to the SSL enabled version. */
46
}
47
+ else /* Otherwise, we buffer all output, and switch all content over to https. */
48
{
49
+ $ssl_host = preg_replace ("/\:[0-9]+#x2F;", "", $_SERVER["HTTP_HOST"]);
50
+ $ssl_port = (is_numeric ($force_ssl) && $force_ssl > 1) ? $force_ssl : 0;
51
+ $ssl_host_port = $ssl_host . (($ssl_port) ? ":" . $ssl_port : "");
52
+ /**/
53
+ define ("_ws_plugin__s2member_force_ssl_host", $ssl_host);
54
+ define ("_ws_plugin__s2member_force_ssl_port", $ssl_port);
55
+ define ("_ws_plugin__s2member_force_ssl_host_port", $ssl_host_port);
56
+ /**/
57
+ /* Except these. We do NOT want to create a sitewide https conversion! */
58
+ add_filter ("home_url", "_ws_plugin__s2member_force_non_ssl_scheme", 10, 3);
59
+ add_filter ("network_home_url", "_ws_plugin__s2member_force_non_ssl_scheme", 10, 3);
60
+ add_filter ("site_url", "_ws_plugin__s2member_force_non_ssl_scheme", 10, 3);
61
+ add_filter ("network_site_url", "_ws_plugin__s2member_force_non_ssl_scheme", 10, 3);
62
+ /**/
63
+ function _ws_plugin__s2member_force_non_ssl_scheme ($url = FALSE, $path = FALSE, $scheme = FALSE)
64
+ {
65
+ return ($scheme) ? $url : preg_replace ("/^https\:\/\//i", "http://", $url);
66
+ }
67
+ /**/
68
function _ws_plugin__s2member_force_ssl_buffer ($buffer = FALSE)
69
{
70
$o_pcre = ini_get ("pcre.backtrack_limit");
85
/**/
86
function _ws_plugin__s2member_force_ssl_buffer_callback ($m = FALSE)
87
{
88
+ $c = preg_replace ("/http\:\/\//i", "https://", $m[0]);
89
+ /**/
90
+ if (_ws_plugin__s2member_force_ssl_port && _ws_plugin__s2member_force_ssl_host && _ws_plugin__s2member_force_ssl_host_port) /* Do we ALSO need port conversions? */
91
+ $c = preg_replace ("/\/" . preg_quote (_ws_plugin__s2member_force_ssl_host, "/") . "(\:[0-9]+)?\//i", "/" . _ws_plugin__s2member_force_ssl_host_port . "/", $c);
92
+ /**/
93
+ return $c; /* Return string with conversions. */
94
}
95
/**/
96
+ ob_start ("_ws_plugin__s2member_force_ssl_buffer"); /* Buffer. */
97
}
98
}
99
/**/
includes/functions/ip-restrictions.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
Function for handling IP Restrictions.
18
IP addresses are stored in a Transient field.
@@ -21,46 +21,65 @@ if (!function_exists ("ws_plugin__s2member_ip_restrictions_ok"))
21
{
22
function ws_plugin__s2member_ip_restrictions_ok ($ip = FALSE, $restriction = FALSE)
23
{
24
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
25
do_action ("ws_plugin__s2member_before_ip_restrictions_ok", get_defined_vars ());
26
unset ($__refs, $__v); /* Unset defined __refs, __v. */
27
/**/
28
- if ($restriction) /* There MUST be a restriction. However, the IP *can* be empty. */
29
{
30
- if (is_array ($ips = get_transient ($transient = md5 ("s2member_ip_restrictions_" . $restriction))))
31
{
32
- if (!in_array ($ip, $ips)) /* Already on record? */
33
- $ips[] = $ip;
34
/**/
35
- $new_ips = $ips;
36
}
37
- else /* Otherwise, create a new IPs array. */
38
- $new_ips[] = $ip;
39
- /*
40
- Now check to see if this is a security breach; with too many IP addresses.
41
- */
42
- if (count ($new_ips) > $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["max_ip_restriction"])
43
{
44
- ws_plugin__s2member_nocache_constants (true) . wp_clear_auth_cookie ();
45
/**/
46
do_action ("ws_plugin__s2member_during_ip_restrictions_ok_no", get_defined_vars ());
47
/**/
48
- header ("HTTP/1.0 503 Service Temporarily Unavailable");
49
/**/
50
echo '<strong>503: Service Temporarily Unavailable</strong><br />' . "\n";
51
- echo 'Too many IP addresses accessing one account/link!<br />' . "\n";
52
- echo 'Please contact Support if you need assistance.';
53
/**/
54
exit ();
55
}
56
- else /* Looks legit. Continue updating the Transient array of IP addresses. */
57
{
58
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
59
do_action ("ws_plugin__s2member_during_ip_restrictions_ok_yes", get_defined_vars ());
60
unset ($__refs, $__v); /* Unset defined __refs, __v. */
61
/**/
62
- set_transient ($transient, $new_ips, $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["max_ip_restriction_time"]);
63
- /**/
64
return apply_filters ("ws_plugin__s2member_ip_restrictions_ok", true, get_defined_vars ());
65
}
66
}
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 handling IP Restrictions.
18
IP addresses are stored in a Transient field.
21
{
22
function ws_plugin__s2member_ip_restrictions_ok ($ip = FALSE, $restriction = FALSE)
23
{
24
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
25
do_action ("ws_plugin__s2member_before_ip_restrictions_ok", get_defined_vars ());
26
unset ($__refs, $__v); /* Unset defined __refs, __v. */
27
/**/
28
+ if ($restriction) /* There MUST be a restriction. However, the IP *could* be empty. */
29
{
30
+ $ip = ($ip) ? $ip : "empty"; /* Allow empty IPs; we need to track them too. */
31
+ /**/
32
+ $entries = (array)get_transient ($transient = md5 ("s2member_ip_restrictions_" . $restriction));
33
+ /**/
34
+ $conc_filter = "ws_plugin__s2member_ip_restrictions__concurrency_time_per_ip";
35
+ $concurrency = apply_filters ($conc_filter, "30 days");
36
+ /**/
37
+ foreach ($entries as $_entry => $_time) /* Auto-expire entries. */
38
+ if ($_time < strtotime ("-" . $concurrency))
39
+ unset($entries[$_entry]);
40
+ /**/
41
+ $entries[$ip] = strtotime ("now"); /* Log this entry. */
42
+ set_transient ($transient, $entries, 2 * (strtotime ("+" . $concurrency) - strtotime ("now")));
43
+ /*
44
+ Now check to see if this is a security breach; or if it has too many IP addresses.
45
+ */
46
+ if (get_transient (md5 ("s2member_ip_restrictions_" . $restriction . "_breached")))
47
{
48
+ ws_plugin__s2member_nocache_constants(true) . wp_clear_auth_cookie ();
49
+ /**/
50
+ do_action ("ws_plugin__s2member_during_ip_restrictions_ok_no", get_defined_vars ());
51
+ /**/
52
+ header("HTTP/1.0 503 Service Temporarily Unavailable"); /* Sends a status header. */
53
+ /**/
54
+ echo '<strong>503: Service Temporarily Unavailable</strong><br />' . "\n";
55
+ echo 'Too many IP addresses accessing one secure area<em>!</em><br />' . "\n";
56
+ echo 'Please contact Support if you require assistance.';
57
/**/
58
+ exit ();
59
}
60
+ else if (count ($entries) > $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["max_ip_restriction"])
61
{
62
+ ws_plugin__s2member_nocache_constants(true) . wp_clear_auth_cookie ();
63
+ /**/
64
+ $p = $punish = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["max_ip_restriction_time"];
65
+ set_transient (md5 ("s2member_ip_restrictions_" . $restriction . "_breached"), "1", $p);
66
/**/
67
do_action ("ws_plugin__s2member_during_ip_restrictions_ok_no", get_defined_vars ());
68
/**/
69
+ header("HTTP/1.0 503 Service Temporarily Unavailable"); /* Sends a status header. */
70
/**/
71
echo '<strong>503: Service Temporarily Unavailable</strong><br />' . "\n";
72
+ echo 'Too many IP addresses accessing one secure area<em>!</em><br />' . "\n";
73
+ echo 'Please contact Support if you require assistance.';
74
/**/
75
exit ();
76
}
77
+ else /* OK, this looks legitimate. Continue updating the Transient array of IP addresses. */
78
{
79
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
80
do_action ("ws_plugin__s2member_during_ip_restrictions_ok_yes", get_defined_vars ());
81
unset ($__refs, $__v); /* Unset defined __refs, __v. */
82
/**/
83
return apply_filters ("ws_plugin__s2member_ip_restrictions_ok", true, get_defined_vars ());
84
}
85
}
includes/functions/login-customizations.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
Function for filtering the login logo url.
18
Attach to: add_filter("login_headerurl");
@@ -53,7 +53,7 @@ if (!function_exists ("ws_plugin__s2member_login_header_styles"))
53
{
54
$s = ""; /* Initialize here to give hooks a chance. */
55
/**/
56
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
57
do_action ("ws_plugin__s2member_before_login_header_styles", get_defined_vars ());
58
unset ($__refs, $__v); /* Unset defined __refs, __v. */
59
/**/
@@ -77,14 +77,15 @@ if (!function_exists ("ws_plugin__s2member_login_header_styles"))
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 { 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
/**/
82
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_password"])
83
$s .= 'p#reg_passmail { display: none; }' . "\n";
84
/**/
85
$s .= '</style>' . "\n\n";
86
/**/
87
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
88
do_action ("ws_plugin__s2member_during_login_header_styles", get_defined_vars ());
89
unset ($__refs, $__v); /* Unset defined __refs, __v. */
90
/**/
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 filtering the login logo url.
18
Attach to: add_filter("login_headerurl");
53
{
54
$s = ""; /* Initialize here to give hooks a chance. */
55
/**/
56
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
57
do_action ("ws_plugin__s2member_before_login_header_styles", get_defined_vars ());
58
unset ($__refs, $__v); /* Unset defined __refs, __v. */
59
/**/
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
/**/
88
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
89
do_action ("ws_plugin__s2member_during_login_header_styles", get_defined_vars ());
90
unset ($__refs, $__v); /* Unset defined __refs, __v. */
91
/**/
includes/functions/meta-boxes.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
Function adds meta boxes to Post/Page editing stations.
18
Attach to: add_action("admin_menu");
@@ -40,7 +40,7 @@ if (!function_exists ("ws_plugin__s2member_security_meta_box"))
40
{
41
function ws_plugin__s2member_security_meta_box ($post = FALSE)
42
{
43
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
44
do_action ("ws_plugin__s2member_before_security_meta_box", get_defined_vars ());
45
unset ($__refs, $__v); /* Unset defined __refs, __v. */
46
/**/
@@ -121,7 +121,7 @@ if (!function_exists ("ws_plugin__s2member_save_meta_boxes"))
121
{
122
function ws_plugin__s2member_save_meta_boxes ($post_id = FALSE)
123
{
124
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
125
do_action ("ws_plugin__s2member_before_save_meta_boxes", get_defined_vars ());
126
unset ($__refs, $__v); /* Unset defined __refs, __v. */
127
/**/
@@ -144,15 +144,15 @@ if (!function_exists ("ws_plugin__s2member_save_meta_boxes"))
144
$pages["4"] = array_unique (preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_pages"]));
145
/**/
146
if (($i = array_search ($page_id, $pages["0"])) !== false) /* Remove $page_id from existing options. */
147
- unset ($pages["0"][$i]);
148
else if (($i = array_search ($page_id, $pages["1"])) !== false)
149
- unset ($pages["1"][$i]);
150
else if (($i = array_search ($page_id, $pages["2"])) !== false)
151
- unset ($pages["2"][$i]);
152
else if (($i = array_search ($page_id, $pages["3"])) !== false)
153
- unset ($pages["3"][$i]);
154
else if (($i = array_search ($page_id, $pages["4"])) !== false)
155
- unset ($pages["4"][$i]);
156
/**/
157
if (strlen ($_p["ws_plugin__s2member_security_meta_box_level"]) && is_array ($pages[$_p["ws_plugin__s2member_security_meta_box_level"]]))
158
if (!$pages[$_p["ws_plugin__s2member_security_meta_box_level"]] !== array ("all"))
@@ -160,7 +160,7 @@ if (!function_exists ("ws_plugin__s2member_save_meta_boxes"))
160
/**/
161
$new_options = array_merge ((array)$new_options, array ("ws_plugin__s2member_level0_pages" => implode (",", $pages[0]), "ws_plugin__s2member_level1_pages" => implode (",", $pages[1]), "ws_plugin__s2member_level2_pages" => implode (",", $pages[2]), "ws_plugin__s2member_level3_pages" => implode (",", $pages[3]), "ws_plugin__s2member_level4_pages" => implode (",", $pages[4])));
162
/**/
163
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
164
do_action ("ws_plugin__s2member_during_save_meta_boxes", get_defined_vars ());
165
unset ($__refs, $__v); /* Unset defined __refs, __v. */
166
/**/
@@ -179,15 +179,15 @@ if (!function_exists ("ws_plugin__s2member_save_meta_boxes"))
179
$posts["4"] = array_unique (preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_posts"]));
180
/**/
181
if (($i = array_search ($post_id, $posts["0"])) !== false) /* Remove $post_id from existing options. */
182
- unset ($posts["0"][$i]);
183
else if (($i = array_search ($post_id, $posts["1"])) !== false)
184
- unset ($posts["1"][$i]);
185
else if (($i = array_search ($post_id, $posts["2"])) !== false)
186
- unset ($posts["2"][$i]);
187
else if (($i = array_search ($post_id, $posts["3"])) !== false)
188
- unset ($posts["3"][$i]);
189
else if (($i = array_search ($post_id, $posts["4"])) !== false)
190
- unset ($posts["4"][$i]);
191
/**/
192
if (strlen ($_p["ws_plugin__s2member_security_meta_box_level"]) && is_array ($posts[$_p["ws_plugin__s2member_security_meta_box_level"]]))
193
if (!$posts[$_p["ws_plugin__s2member_security_meta_box_level"]] !== array ("all"))
@@ -195,7 +195,7 @@ if (!function_exists ("ws_plugin__s2member_save_meta_boxes"))
195
/**/
196
$new_options = array_merge ((array)$new_options, array ("ws_plugin__s2member_level0_posts" => implode (",", $posts[0]), "ws_plugin__s2member_level1_posts" => implode (",", $posts[1]), "ws_plugin__s2member_level2_posts" => implode (",", $posts[2]), "ws_plugin__s2member_level3_posts" => implode (",", $posts[3]), "ws_plugin__s2member_level4_posts" => implode (",", $posts[4])));
197
/**/
198
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
199
do_action ("ws_plugin__s2member_during_save_meta_boxes", get_defined_vars ());
200
unset ($__refs, $__v); /* Unset defined __refs, __v. */
201
/**/
@@ -209,7 +209,12 @@ if (!function_exists ("ws_plugin__s2member_save_meta_boxes"))
209
{
210
$ccaps_req = trim (strtolower ($_p["ws_plugin__s2member_security_meta_box_ccaps"]), ",");
211
$ccaps_req = trim (preg_replace ("/[^a-z_0-9,]/", "", $ccaps_req), ","); /* Now clean up. */
212
- update_post_meta ($page_id, "s2member_ccaps_req", preg_split ("/[\r\n\t\s;,]+/", $ccaps_req));
213
}
214
}
215
/**/
@@ -219,7 +224,12 @@ if (!function_exists ("ws_plugin__s2member_save_meta_boxes"))
219
{
220
$ccaps_req = trim (strtolower ($_p["ws_plugin__s2member_security_meta_box_ccaps"]), ",");
221
$ccaps_req = trim (preg_replace ("/[^a-z_0-9,]/", "", $ccaps_req), ","); /* Now clean up. */
222
- update_post_meta ($post_id, "s2member_ccaps_req", preg_split ("/[\r\n\t\s;,]+/", $ccaps_req));
223
}
224
}
225
}
12
Direct access denial.
13
*/
14
if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit("Do not access this file directly.");
16
/*
17
Function adds meta boxes to Post/Page editing stations.
18
Attach to: add_action("admin_menu");
40
{
41
function ws_plugin__s2member_security_meta_box ($post = FALSE)
42
{
43
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
44
do_action ("ws_plugin__s2member_before_security_meta_box", get_defined_vars ());
45
unset ($__refs, $__v); /* Unset defined __refs, __v. */
46
/**/
121
{
122
function ws_plugin__s2member_save_meta_boxes ($post_id = FALSE)
123
{
124
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
125
do_action ("ws_plugin__s2member_before_save_meta_boxes", get_defined_vars ());
126
unset ($__refs, $__v); /* Unset defined __refs, __v. */
127
/**/
144
$pages["4"] = array_unique (preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_pages"]));
145
/**/
146
if (($i = array_search ($page_id, $pages["0"])) !== false) /* Remove $page_id from existing options. */
147
+ unset($pages["0"][$i]);
148
else if (($i = array_search ($page_id, $pages["1"])) !== false)
149
+ unset($pages["1"][$i]);
150
else if (($i = array_search ($page_id, $pages["2"])) !== false)
151
+ unset($pages["2"][$i]);
152
else if (($i = array_search ($page_id, $pages["3"])) !== false)
153
+ unset($pages["3"][$i]);
154
else if (($i = array_search ($page_id, $pages["4"])) !== false)
155
+ unset($pages["4"][$i]);
156
/**/
157
if (strlen ($_p["ws_plugin__s2member_security_meta_box_level"]) && is_array ($pages[$_p["ws_plugin__s2member_security_meta_box_level"]]))
158
if (!$pages[$_p["ws_plugin__s2member_security_meta_box_level"]] !== array ("all"))
160
/**/
161
$new_options = array_merge ((array)$new_options, array ("ws_plugin__s2member_level0_pages" => implode (",", $pages[0]), "ws_plugin__s2member_level1_pages" => implode (",", $pages[1]), "ws_plugin__s2member_level2_pages" => implode (",", $pages[2]), "ws_plugin__s2member_level3_pages" => implode (",", $pages[3]), "ws_plugin__s2member_level4_pages" => implode (",", $pages[4])));
162
/**/
163
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
164
do_action ("ws_plugin__s2member_during_save_meta_boxes", get_defined_vars ());
165
unset ($__refs, $__v); /* Unset defined __refs, __v. */
166
/**/
179
$posts["4"] = array_unique (preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_posts"]));
180
/**/
181
if (($i = array_search ($post_id, $posts["0"])) !== false) /* Remove $post_id from existing options. */
182
+ unset($posts["0"][$i]);
183
else if (($i = array_search ($post_id, $posts["1"])) !== false)
184
+ unset($posts["1"][$i]);
185
else if (($i = array_search ($post_id, $posts["2"])) !== false)
186
+ unset($posts["2"][$i]);
187
else if (($i = array_search ($post_id, $posts["3"])) !== false)
188
+ unset($posts["3"][$i]);
189
else if (($i = array_search ($post_id, $posts["4"])) !== false)
190
+ unset($posts["4"][$i]);
191
/**/
192
if (strlen ($_p["ws_plugin__s2member_security_meta_box_level"]) && is_array ($posts[$_p["ws_plugin__s2member_security_meta_box_level"]]))
193
if (!$posts[$_p["ws_plugin__s2member_security_meta_box_level"]] !== array ("all"))
195
/**/
196
$new_options = array_merge ((array)$new_options, array ("ws_plugin__s2member_level0_posts" => implode (",", $posts[0]), "ws_plugin__s2member_level1_posts" => implode (",", $posts[1]), "ws_plugin__s2member_level2_posts" => implode (",", $posts[2]), "ws_plugin__s2member_level3_posts" => implode (",", $posts[3]), "ws_plugin__s2member_level4_posts" => implode (",", $posts[4])));
197
/**/
198
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
199
do_action ("ws_plugin__s2member_during_save_meta_boxes", get_defined_vars ());
200
unset ($__refs, $__v); /* Unset defined __refs, __v. */
201
/**/
209
{
210
$ccaps_req = trim (strtolower ($_p["ws_plugin__s2member_security_meta_box_ccaps"]), ",");
211
$ccaps_req = trim (preg_replace ("/[^a-z_0-9,]/", "", $ccaps_req), ","); /* Now clean up. */
212
+ /**/
213
+ if (($s2member_ccaps_req = preg_split ("/[\r\n\t\s;,]+/", $ccaps_req)))
214
+ update_post_meta ($page_id, "s2member_ccaps_req", $s2member_ccaps_req);
215
+ /**/
216
+ else /* Otherwise, the array is empty. Safe to delete. */
217
+ delete_post_meta ($page_id, "s2member_ccaps_req");
218
}
219
}
220
/**/
224
{
225
$ccaps_req = trim (strtolower ($_p["ws_plugin__s2member_security_meta_box_ccaps"]), ",");
226
$ccaps_req = trim (preg_replace ("/[^a-z_0-9,]/", "", $ccaps_req), ","); /* Now clean up. */
227
+ /**/
228
+ if (($s2member_ccaps_req = preg_split ("/[\r\n\t\s;,]+/", $ccaps_req)))
229
+ update_post_meta ($post_id, "s2member_ccaps_req", $s2member_ccaps_req);
230
+ /**/
231
+ else /* Otherwise, the array is empty. Safe to delete. */
232
+ delete_post_meta ($post_id, "s2member_ccaps_req");
233
}
234
}
235
}
includes/functions/page-level-access.inc.php CHANGED
@@ -77,7 +77,7 @@ if (!function_exists ("ws_plugin__s2member_check_page_level_access"))
77
/**/
78
else if (is_array ($ccaps_req = get_post_meta ($page_ID, "s2member_ccaps_req", true))) /* Check for per Post Custom Capability requirements. */
79
foreach ($ccaps_req as $ccap) /* The $current_user MUST satisfy ALL Custom Capability requirements. These are all stored as a serialized array. */
80
- if (strlen ($ccap) && (!$current_user || !$current_user->hap_cap ("access_s2member_ccap_" . $ccap)))
81
{
82
wp_redirect(add_query_arg ("s2member_ccap_req", $ccap, get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])));
83
exit ();
77
/**/
78
else if (is_array ($ccaps_req = get_post_meta ($page_ID, "s2member_ccaps_req", true))) /* Check for per Post Custom Capability requirements. */
79
foreach ($ccaps_req as $ccap) /* The $current_user MUST satisfy ALL Custom Capability requirements. These are all stored as a serialized array. */
80
+ if (strlen ($ccap) && (!$current_user || !$current_user->has_cap ("access_s2member_ccap_" . $ccap)))
81
{
82
wp_redirect(add_query_arg ("s2member_ccap_req", $ccap, get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])));
83
exit ();
includes/functions/paypal-button.inc.php CHANGED
@@ -21,16 +21,16 @@ Attach to: add_shortcode("s2Member-PayPal-Button");
21
[s2Member-PayPal-Button page="0" exp="72" desc="Specific Post/Page Access" ps="paypal" cc="USD" custom="www.domain.com" ra="0.01" sp="1" image="default" /]
22
The image="" attribute will be used as a custom image; when provided; and not equal to "default".
23
24
- PayPal® Cancellation Buttons are identified by cancel="1".
25
- PayPal® Specific Post/Page Buttons are identified by sp="1".
26
- PayPal® Modification Buttons are identified by modify="1".
27
*/
28
- if (!function_exists ("ws_plugin__s2member_paypal_button"))
29
{
30
- function ws_plugin__s2member_paypal_button ($attr = FALSE, $content = FALSE, $shortcode = FALSE)
31
{
32
eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
33
- do_action ("ws_plugin__s2member_before_paypal_button", get_defined_vars ());
34
unset ($__refs, $__v); /* Unset defined __refs, __v. */
35
/**/
36
$attr = ws_plugin__s2member_trim_quot_deep ($attr); /* Fix &quot; in Shortcode attrs
@@ -50,7 +50,7 @@ if (!function_exists ("ws_plugin__s2member_paypal_button"))
50
$attr = shortcode_atts (array ("ids" => "0", "exp" => "72", "level" => "1", "ccaps" => "", "desc" => "", "ps" => "paypal", "cc" => "USD", "custom" => $_SERVER["HTTP_HOST"], "tp" => "0", "tt" => "D", "ra" => "0.01", "rp" => "1", "rt" => "M", "rr" => "1", "modify" => "0", "cancel" => "0", "sp" => "0", "image" => "default"), $attr);
51
/**/
52
eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
53
- do_action ("ws_plugin__s2member_before_paypal_button_after_shortcode_atts", get_defined_vars ());
54
unset ($__refs, $__v); /* Unset defined __refs, __v. */
55
/**/
56
if ($attr["cancel"]) /* This is a special routine for Cancellation Buttons. Cancellation Buttons use a different template. */
@@ -62,7 +62,7 @@ if (!function_exists ("ws_plugin__s2member_paypal_button"))
62
$code = ($attr["image"] && $attr["image"] !== "default") ? preg_replace ('/ src\="(.*?)"/', ' src="' . ws_plugin__s2member_esc_ds (esc_attr ($attr["image"])) . '"', $code) : $code;
63
/**/
64
eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
65
- do_action ("ws_plugin__s2member_during_paypal_cancellation_button", get_defined_vars ());
66
unset ($__refs, $__v); /* Unset defined __refs, __v. */
67
}
68
/**/
@@ -88,7 +88,7 @@ if (!function_exists ("ws_plugin__s2member_paypal_button"))
88
$code = ($attr["image"] && $attr["image"] !== "default") ? preg_replace ('/ src\="(.*?)"/', ' src="' . ws_plugin__s2member_esc_ds (esc_attr ($attr["image"])) . '"', $code) : $code;
89
/**/
90
eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
91
- do_action ("ws_plugin__s2member_during_paypal_sp_button", get_defined_vars ());
92
unset ($__refs, $__v); /* Unset defined __refs, __v. */
93
}
94
else /* Otherwise, we'll process this Button normally, using the Membership routines. Also handles Modification Buttons. */
@@ -134,11 +134,11 @@ if (!function_exists ("ws_plugin__s2member_paypal_button"))
134
$code = ($attr["image"] && $attr["image"] !== "default") ? preg_replace ('/ src\="(.*?)"/', ' src="' . ws_plugin__s2member_esc_ds (esc_attr ($attr["image"])) . '"', $code) : $code;
135
/**/
136
eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
137
- ($attr["modify"]) ? do_action ("ws_plugin__s2member_during_paypal_modification_button", get_defined_vars ()) : do_action ("ws_plugin__s2member_during_paypal_button", get_defined_vars ());
138
unset ($__refs, $__v); /* Unset defined __refs, __v. */
139
}
140
/**/
141
- return apply_filters ("ws_plugin__s2member_paypal_button", $code, get_defined_vars ());
142
}
143
}
144
?>
21
[s2Member-PayPal-Button page="0" exp="72" desc="Specific Post/Page Access" ps="paypal" cc="USD" custom="www.domain.com" ra="0.01" sp="1" image="default" /]
22
The image="" attribute will be used as a custom image; when provided; and not equal to "default".
23
24
+ - PayPal® Cancellation Buttons are identified by cancel="1".
25
+ - PayPal® Specific Post/Page Buttons are identified by sp="1".
26
+ - PayPal® Modification Buttons are identified by modify="1".
27
*/
28
+ if (!function_exists ("ws_plugin__s2member_sc_paypal_button"))
29
{
30
+ function ws_plugin__s2member_sc_paypal_button ($attr = FALSE, $content = FALSE, $shortcode = FALSE)
31
{
32
eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
33
+ do_action ("ws_plugin__s2member_before_sc_paypal_button", get_defined_vars ());
34
unset ($__refs, $__v); /* Unset defined __refs, __v. */
35
/**/
36
$attr = ws_plugin__s2member_trim_quot_deep ($attr); /* Fix &quot; in Shortcode attrs
50
$attr = shortcode_atts (array ("ids" => "0", "exp" => "72", "level" => "1", "ccaps" => "", "desc" => "", "ps" => "paypal", "cc" => "USD", "custom" => $_SERVER["HTTP_HOST"], "tp" => "0", "tt" => "D", "ra" => "0.01", "rp" => "1", "rt" => "M", "rr" => "1", "modify" => "0", "cancel" => "0", "sp" => "0", "image" => "default"), $attr);
51
/**/
52
eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
53
+ do_action ("ws_plugin__s2member_before_sc_paypal_button_after_shortcode_atts", get_defined_vars ());
54
unset ($__refs, $__v); /* Unset defined __refs, __v. */
55
/**/
56
if ($attr["cancel"]) /* This is a special routine for Cancellation Buttons. Cancellation Buttons use a different template. */
62
$code = ($attr["image"] && $attr["image"] !== "default") ? preg_replace ('/ src\="(.*?)"/', ' src="' . ws_plugin__s2member_esc_ds (esc_attr ($attr["image"])) . '"', $code) : $code;
63
/**/
64
eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
65
+ do_action ("ws_plugin__s2member_during_sc_paypal_cancellation_button", get_defined_vars ());
66
unset ($__refs, $__v); /* Unset defined __refs, __v. */
67
}
68
/**/
88
$code = ($attr["image"] && $attr["image"] !== "default") ? preg_replace ('/ src\="(.*?)"/', ' src="' . ws_plugin__s2member_esc_ds (esc_attr ($attr["image"])) . '"', $code) : $code;
89
/**/
90
eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
91
+ do_action ("ws_plugin__s2member_during_sc_paypal_sp_button", get_defined_vars ());
92
unset ($__refs, $__v); /* Unset defined __refs, __v. */
93
}
94
else /* Otherwise, we'll process this Button normally, using the Membership routines. Also handles Modification Buttons. */
134
$code = ($attr["image"] && $attr["image"] !== "default") ? preg_replace ('/ src\="(.*?)"/', ' src="' . ws_plugin__s2member_esc_ds (esc_attr ($attr["image"])) . '"', $code) : $code;
135
/**/
136
eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
137
+ ($attr["modify"]) ? do_action ("ws_plugin__s2member_during_sc_paypal_modification_button", get_defined_vars ()) : do_action ("ws_plugin__s2member_during_sc_paypal_button", get_defined_vars ());
138
unset ($__refs, $__v); /* Unset defined __refs, __v. */
139
}
140
/**/
141
+ return apply_filters ("ws_plugin__s2member_sc_paypal_button", $code, get_defined_vars ());
142
}
143
}
144
?>
includes/functions/paypal-notify.inc.php CHANGED
@@ -779,13 +779,19 @@ if (!function_exists ("ws_plugin__s2member_paypal_notify"))
779
do_action ("ws_plugin__s2member_during_paypal_notify_before_subscr_eot", get_defined_vars ());
780
unset ($__refs, $__v); /* Unset defined __refs, __v. */
781
/**/
782
$paypal["s2member_log"][] = "s2Member txn_type identified as (subscr_eot|recurring_payment_expired|recurring_payment_suspended_due_to_max_failed_payment) - or - recurring_payment_profile_cancel w/ initial_payment_status (failed) - or - new_case w/ case_type (chargeback) - or - !txn_type w/ payment_status (refunded|reversed).";
783
/**/
784
if (($user_id = ws_plugin__s2member_paypal_user_id ($paypal["subscr_id"], $paypal["option_selection1"])) && is_object ($user = new WP_User ($user_id)) && $user->ID)
785
{
786
- if (!get_user_option ("s2member_auto_eot_time", $user_id) || /* Respect Auto-EOT; EXCEPT on refund/reverals. */
787
- (!$paypal["txn_type"] && preg_match ("/^(refunded|reversed)#x2F;i", $paypal["payment_status"]) && $paypal["parent_txn_id"]))
788
- /* A refund/reversal will ALWAYS trigger an immediate EOT; even if there is already an Auto-EOT set. */
789
{
790
if (!$user->has_cap ("administrator")) /* Do NOT process this routine on Administrators. */
791
{
@@ -882,9 +888,17 @@ if (!function_exists ("ws_plugin__s2member_paypal_notify"))
882
$paypal["s2member_log"][] = "Unable to (demote|delete) Member. The existing User ID is associated with an Administrator. Stopping here. Otherwise, an Administrator could lose access.";
883
}
884
}
885
- else
886
{
887
- $paypal["s2member_log"][] = "Skipping (demote|delete) Member, for now. An Auto-EOT Time is already set. When an Auto-EOT Time has been recorded, s2Member will handle EOT (demote|delete) events using it's own Auto-EOT System.";
888
}
889
}
890
else
@@ -897,7 +911,7 @@ if (!function_exists ("ws_plugin__s2member_paypal_notify"))
897
Since this routine ignores the processing check, it is *possible* that Refund/Reversal Notification URLs will be contacted more than once.
898
If you're writing scripts that depend on Refund/Reversal Notifications, please keep this in mind.
899
*/
900
- if (!$paypal["txn_type"] && preg_match ("/^(refunded|reversed)#x2F;i", $paypal["payment_status"]) && $paypal["parent_txn_id"])
901
{
902
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["ref_rev_notification_urls"] && is_array ($cv = preg_split ("/\|/", $paypal["custom"])))
903
{
779
do_action ("ws_plugin__s2member_during_paypal_notify_before_subscr_eot", get_defined_vars ());
780
unset ($__refs, $__v); /* Unset defined __refs, __v. */
781
/**/
782
+ $is_refund = (!$paypal["txn_type"] && preg_match ("/^refunded#x2F;i", $paypal["payment_status"]) && $paypal["parent_txn_id"]);
783
+ $is_reversal = (!$paypal["txn_type"] && preg_match ("/^reversed#x2F;i", $paypal["payment_status"]) && $paypal["parent_txn_id"]);
784
+ $is_refund_or_reversal = (!$paypal["txn_type"] && preg_match ("/^(refunded|reversed)#x2F;i", $paypal["payment_status"]) && $paypal["parent_txn_id"]);
785
+ /**/
786
$paypal["s2member_log"][] = "s2Member txn_type identified as (subscr_eot|recurring_payment_expired|recurring_payment_suspended_due_to_max_failed_payment) - or - recurring_payment_profile_cancel w/ initial_payment_status (failed) - or - new_case w/ case_type (chargeback) - or - !txn_type w/ payment_status (refunded|reversed).";
787
/**/
788
if (($user_id = ws_plugin__s2member_paypal_user_id ($paypal["subscr_id"], $paypal["option_selection1"])) && is_object ($user = new WP_User ($user_id)) && $user->ID)
789
{
790
+ if ( /* Here we take action, but based on some advanced behavioral settings. */
791
+ (!$is_refund_or_reversal && !get_user_option ("s2member_auto_eot_time", $user_id))/**/
792
+ || ($is_refund_or_reversal && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["triggers_immediate_eot"] === "refunds,reversals")/**/
793
+ || ($is_reversal && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["triggers_immediate_eot"] === "reversals")/**/
794
+ || ($is_refund && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["triggers_immediate_eot"] === "refunds")/**/)
795
{
796
if (!$user->has_cap ("administrator")) /* Do NOT process this routine on Administrators. */
797
{
888
$paypal["s2member_log"][] = "Unable to (demote|delete) Member. The existing User ID is associated with an Administrator. Stopping here. Otherwise, an Administrator could lose access.";
889
}
890
}
891
+ else if (!$is_refund_or_reversal)
892
+ {
893
+ $paypal["s2member_log"][] = "Skipping (demote|delete) Member, for now. An Auto-EOT Time is already set for this account. When an Auto-EOT Time has been recorded, s2Member will handle EOT (demote|delete) events using it's own Auto-EOT System - internally.";
894
+ }
895
+ else if ($is_reversal)
896
+ {
897
+ $paypal["s2member_log"][] = "Skipping (demote|delete) Member. Your configuration dictates that s2Member should NOT take any immediate action on an EOT associated with a Chargeback Reversal. An s2Member API Notification will still be processed however.";
898
+ }
899
+ else if ($is_refund)
900
{
901
+ $paypal["s2member_log"][] = "Skipping (demote|delete) Member. Your configuration dictates that s2Member should NOT take any immediate action on an EOT associated with a Refund. An s2Member API Notification will still be processed however.";
902
}
903
}
904
else
911
Since this routine ignores the processing check, it is *possible* that Refund/Reversal Notification URLs will be contacted more than once.
912
If you're writing scripts that depend on Refund/Reversal Notifications, please keep this in mind.
913
*/
914
+ if ($is_refund_or_reversal) /* Here we access this variable that was previously assigned as a quick method of Refund/Reversal detection. */
915
{
916
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["ref_rev_notification_urls"] && is_array ($cv = preg_split ("/\|/", $paypal["custom"])))
917
{
includes/functions/post-level-access.inc.php CHANGED
@@ -68,7 +68,7 @@ if (!function_exists ("ws_plugin__s2member_check_post_level_access"))
68
/**/
69
else if (is_array ($ccaps_req = get_post_meta ($post_ID, "s2member_ccaps_req", true))) /* Check for per Post Custom Capability requirements. */
70
foreach ($ccaps_req as $ccap) /* The $current_user MUST satisfy ALL Custom Capability requirements. These are all stored as a serialized array. */
71
- if (strlen ($ccap) && (!$current_user || !$current_user->hap_cap ("access_s2member_ccap_" . $ccap)))
72
{
73
wp_redirect (add_query_arg ("s2member_ccap_req", $ccap, get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])));
74
exit ();
68
/**/
69
else if (is_array ($ccaps_req = get_post_meta ($post_ID, "s2member_ccaps_req", true))) /* Check for per Post Custom Capability requirements. */
70
foreach ($ccaps_req as $ccap) /* The $current_user MUST satisfy ALL Custom Capability requirements. These are all stored as a serialized array. */
71
+ if (strlen ($ccap) && (!$current_user || !$current_user->has_cap ("access_s2member_ccap_" . $ccap)))
72
{
73
wp_redirect (add_query_arg ("s2member_ccap_req", $ccap, get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])));
74
exit ();
includes/functions/register-access.inc.php CHANGED
@@ -416,10 +416,15 @@ if (!function_exists ("_ws_plugin__s2member_admin_user_new_fields"))
416
$field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field));
417
$field_id_class = preg_replace ("/_/", "-", $field_var);
418
/**/
419
- $unfs .= '<tr>' . "\n";
420
- $unfs .= '<th><label>' . esc_html ($field) . ':</label></th>' . "\n";
421
- $unfs .= '<td><input type="text" name="ws_plugin__s2member_user_new_' . $field_var . '" value="' . format_to_edit ($_POST["ws_plugin__s2member_user_new_" . $field_var]) . '" class="regular-text" /></td>' . "\n";
422
- $unfs .= '</tr>' . "\n";
423
/**/
424
eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
425
do_action ("_ws_plugin__s2member_during_admin_user_new_fields_during_custom_fields_after", get_defined_vars ());
@@ -528,9 +533,14 @@ if (!function_exists ("ws_plugin__s2member_ms_custom_registration_fields"))
528
$field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field));
529
$field_id_class = preg_replace ("/_/", "-", $field_var);
530
/**/
531
- echo '<label for="ws-plugin--s2member-custom-reg-field-' . $field_id_class . '">' . esc_html ($field) . (($req) ? " *" : "") . '</label>' . "\n";
532
- echo '<input' . $req . ' type="text" maxlength="100" name="ws_plugin__s2member_custom_reg_field_' . $field_var . '" id="ws-plugin--s2member-custom-reg-field-' . $field_id_class . '" class="ws-plugin--s2member-custom-reg-field input" size="25" value="' . format_to_edit ($_POST["ws_plugin__s2member_custom_reg_field_" . $field_var]) . '" />' . "\n";
533
- echo '<br />' . "\n";
534
/**/
535
eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
536
do_action ("ws_plugin__s2member_during_ms_custom_registration_fields_after_custom_fields", get_defined_vars ());
@@ -651,12 +661,17 @@ if (!function_exists ("ws_plugin__s2member_custom_registration_fields"))
651
$field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field));
652
$field_id_class = preg_replace ("/_/", "-", $field_var);
653
/**/
654
- echo '<p>' . "\n";
655
- echo '<label>' . "\n";
656
- echo esc_html ($field) . (($req) ? " *" : "") . "\n";
657
- echo '<input' . $req . ' type="text" maxlength="100" name="ws_plugin__s2member_custom_reg_field_' . $field_var . '" id="ws-plugin--s2member-custom-reg-field-' . $field_id_class . '" class="ws-plugin--s2member-custom-reg-field input" size="25" value="' . format_to_edit ($_POST["ws_plugin__s2member_custom_reg_field_" . $field_var]) . '" tabindex="' . esc_attr (($tabindex = $tabindex + 10)) . '" />' . "\n";
658
- echo '</label>' . "\n";
659
- echo '</p>';
660
/**/
661
eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
662
do_action ("ws_plugin__s2member_during_custom_registration_fields_after_custom_fields", get_defined_vars ());
@@ -938,10 +953,16 @@ if (!function_exists ("ws_plugin__s2member_configure_user_registration"))
938
/**/
939
&& $user_id && is_object ($user = new WP_User ($user_id)) && $user->ID && ($processed = true)) /* Process only once. */
940
{
941
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"]))
942
exit ("s2Member security violation. You attempted to POST variables that will NOT be trusted!");
943
/**/
944
- $_pm = array_merge ((array)$_POST, (array)$meta); /* Merge these two data sources together. */
945
/**/
946
if (!is_admin () /* Only run this particular routine whenever a Member [1-4] is registering themselves with cookies. */
947
&& ($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"])))/**/
@@ -1163,7 +1184,7 @@ if (!function_exists ("ws_plugin__s2member_configure_user_registration"))
1163
unset ($__refs, $__v); /* Unset defined __refs, __v. */
1164
}
1165
/**/
1166
- else if (is_admin () && $pagenow === "user-new.php") /* Else, if we're on this admin page. */
1167
{ /*
1168
This routine can ONLY be processed through `user-new.php` inside the Dashboard.
1169
*/
@@ -1344,8 +1365,8 @@ if (!function_exists ("wp_generate_password"))
1344
Function hides password fields for demo users.
1345
1346
Demo accounts ( where the Username MUST be "demo" ), will NOT be allowed to change their password.
1347
- Any other restrictions you need to impose must be done through custom programming, using s2Member's Advanced Conditionals.
1348
- See `s2Member -> API Scripting -> Advanced Conditionals`.
1349
1350
Attach to: add_filter("show_password_fields");
1351
*/
416
$field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field));
417
$field_id_class = preg_replace ("/_/", "-", $field_var);
418
/**/
419
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
420
+ if (apply_filters ("_ws_plugin__s2member_during_admin_user_new_fields_during_custom_fields_display", true, get_defined_vars ()))
421
+ {
422
+ $unfs .= '<tr>' . "\n";
423
+ $unfs .= '<th><label>' . esc_html ($field) . ':</label></th>' . "\n";
424
+ $unfs .= '<td><input type="text" name="ws_plugin__s2member_user_new_' . $field_var . '" value="' . format_to_edit ($_POST["ws_plugin__s2member_user_new_" . $field_var]) . '" class="regular-text" /></td>' . "\n";
425
+ $unfs .= '</tr>' . "\n";
426
+ }
427
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
428
/**/
429
eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
430
do_action ("_ws_plugin__s2member_during_admin_user_new_fields_during_custom_fields_after", get_defined_vars ());
533
$field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field));
534
$field_id_class = preg_replace ("/_/", "-", $field_var);
535
/**/
536
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
537
+ if (apply_filters ("ws_plugin__s2member_during_ms_custom_registration_fields_during_custom_fields_display", true, get_defined_vars ()))
538
+ {
539
+ echo '<label for="ws-plugin--s2member-custom-reg-field-' . $field_id_class . '">' . esc_html ($field) . (($req) ? " *" : "") . '</label>' . "\n";
540
+ echo '<input' . $req . ' type="text" maxlength="100" name="ws_plugin__s2member_custom_reg_field_' . $field_var . '" id="ws-plugin--s2member-custom-reg-field-' . $field_id_class . '" class="ws-plugin--s2member-custom-reg-field input" size="25" value="' . format_to_edit ($_POST["ws_plugin__s2member_custom_reg_field_" . $field_var]) . '" />' . "\n";
541
+ echo '<br />' . "\n";
542
+ }
543
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
544
/**/
545
eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
546
do_action ("ws_plugin__s2member_during_ms_custom_registration_fields_after_custom_fields", get_defined_vars ());
661
$field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field));
662
$field_id_class = preg_replace ("/_/", "-", $field_var);
663
/**/
664
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
665
+ if (apply_filters ("ws_plugin__s2member_during_custom_registration_fields_during_custom_fields_display", true, get_defined_vars ()))
666
+ {
667
+ echo '<p>' . "\n";
668
+ echo '<label>' . "\n";
669
+ echo esc_html ($field) . (($req) ? " *" : "") . "\n";
670
+ echo '<input' . $req . ' type="text" maxlength="100" name="ws_plugin__s2member_custom_reg_field_' . $field_var . '" id="ws-plugin--s2member-custom-reg-field-' . $field_id_class . '" class="ws-plugin--s2member-custom-reg-field input" size="25" value="' . format_to_edit ($_POST["ws_plugin__s2member_custom_reg_field_" . $field_var]) . '" tabindex="' . esc_attr (($tabindex = $tabindex + 10)) . '" />' . "\n";
671
+ echo '</label>' . "\n";
672
+ echo '</p>';
673
+ }
674
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
675
/**/
676
eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
677
do_action ("ws_plugin__s2member_during_custom_registration_fields_after_custom_fields", get_defined_vars ());
953
/**/
954
&& $user_id && is_object ($user = new WP_User ($user_id)) && $user->ID && ($processed = true)) /* Process only once. */
955
{
956
+ foreach ((array)$_POST as $key => $value) /* Scan $_POST vars; adding `custom_reg_field` uniformity keys. */
957
+ if (preg_match ("/^ws_plugin__s2member_user_new_/", $key)) /* Looking for `user_new` keys here. */
958
+ if ($key = preg_replace ("/_user_new_/", "_custom_reg_field_", $key))
959
+ $_POST[$key] = $value; /* Add these keys for uniformity. */
960
+ unset ($key, $value); /* Prevents bleeding vars into Hooks/Filters. */
961
+ /**/
962
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"]))
963
exit ("s2Member security violation. You attempted to POST variables that will NOT be trusted!");
964
/**/
965
+ $_pm = array_merge ((array)$_POST, (array)$meta); /* Merge these two data sources together now. However, ALWAYS after the security routine above ^. */
966
/**/
967
if (!is_admin () /* Only run this particular routine whenever a Member [1-4] is registering themselves with cookies. */
968
&& ($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"])))/**/
1184
unset ($__refs, $__v); /* Unset defined __refs, __v. */
1185
}
1186
/**/
1187
+ else if (is_admin () && $pagenow === "user-new.php") /* Else, if we're on this page. */
1188
{ /*
1189
This routine can ONLY be processed through `user-new.php` inside the Dashboard.
1190
*/
1365
Function hides password fields for demo users.
1366
1367
Demo accounts ( where the Username MUST be "demo" ), will NOT be allowed to change their password.
1368
+ Any other restrictions you need to impose must be done through custom programming, using s2Member's Conditionals.
1369
+ See `s2Member -> API Scripting`.
1370
1371
Attach to: add_filter("show_password_fields");
1372
*/
includes/functions/sc-conditionals.inc.php ADDED
@@ -0,0 +1,168 @@
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 handles the Shortcode for [s2All ... simple conditionals][/s2All].
18
+ Function that handles the Shortcode for [s2Any ... simple conditionals][/s2Any].
19
+
20
+ Attach to: add_shortcode("s2All"), add_shortcode("_s2All"), add_shortcode("__s2All"), add_shortcode("___s2All");
21
+ Attach to: add_shortcode("s2Any"), add_shortcode("_s2Any"), add_shortcode("__s2Any"), add_shortcode("___s2Any");
22
+
23
+ [s2All is_user_logged_in="yes" current_user_can="access_s2member_level1"]
24
+
25
+ Content appears here for Members with access to Level #1.
26
+
27
+ [_s2All current_user_can="access_s2member_ccap_free_gift"]
28
+ Free gift here with nested Custom Capability check.
29
+ [/_s2All]
30
+
31
+ [/s2All]
32
+
33
+
34
+ [s2Any current_user_is="s2member_level1" current_user_is="s2member_level2"]
35
+
36
+ Content appears here for Members at Level #1 and Level #2.
37
+
38
+ [_s2Any current_user_can="access_s2member_ccap_free_gift"]
39
+ Free gift here with nested Custom Capability check.
40
+ [/_s2Any]
41
+
42
+ [/s2Any]
43
+
44
+ */
45
+ if (!function_exists ("ws_plugin__s2member_sc_conditionals"))
46
+ {
47
+ function ws_plugin__s2member_sc_conditionals ($attr = FALSE, $content = FALSE, $shortcode = FALSE)
48
+ {
49
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
50
+ do_action ("ws_plugin__s2member_before_sc_conditionals", get_defined_vars ());
51
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
52
+ /**/
53
+ $attr = ws_plugin__s2member_trim_quot_deep ($attr); /* Fix &quot; in Shortcode attrs
54
+ that have been corrupted by a non-default visual editor; ( i.e. CKEditor does this ). */
55
+ /**/
56
+ if (is_multisite () && ws_plugin__s2member_is_multisite_farm () && !is_main_site ()) /* Restrict to a subset of the most useful Conditionals on a Blog Farm. */
57
+ $attr = shortcode_atts (array ("is_user_logged_in" => "", "is_user_not_logged_in" => "", "current_user_is" => "", "current_user_is_not" => "", "current_user_is_for_blog" => "", "current_user_is_not_for_blog" => "", "current_user_can" => "", "current_user_cannot" => "", "current_user_can_for_blog" => "", "current_user_cannot_for_blog" => "", "is_404" => "", "is_home" => "", "is_front_page" => "", "is_singular" => "", "is_single" => "", "is_page" => "", "is_page_template" => "", "is_attachment" => "", "is_feed" => "", "is_archive" => "", "is_search" => "", "is_category" => "", "is_tax" => "", "is_tag" => "", "has_tag" => "", "is_author" => "", "is_date" => "", "is_day" => "", "is_month" => "", "is_time" => "", "is_year" => "", "is_sticky" => "", "is_paged" => "", "is_preview" => "", "in_the_loop" => "", "comments_open" => "", "pings_open" => "", "has_excerpt" => "", "has_post_image" => ""), $attr);
58
+ /**/
59
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
60
+ do_action ("ws_plugin__s2member_before_sc_conditionals_after_shortcode_atts", get_defined_vars ());
61
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
62
+ /**/
63
+ if (preg_match ("/^(_*)s2All#x2F;i", $shortcode)) /* This is the AND variation. This routine analyzes conditionals using AND logic, instead of OR. */
64
+ {
65
+ foreach ($attr as $conditional => $_args) /* All conditions must evaluate to true; except for basic yes|no argument values that are = "no". */
66
+ {
67
+ if (strlen ($_args) && strlen ($_args = preg_replace ("/^array\(/i", "(", $_args))) /* Remove array() prefixes and leave only the () indicator. */
68
+ if (strlen ($_args = preg_replace ("/[\r\n\t\s ]/", "", $_args)) && is_array ($args = preg_split ("/[;,]+/", $_args, 0, PREG_SPLIT_NO_EMPTY)) && !empty ($args))
69
+ {
70
+ $args_are_yes_no = preg_match ("/^(true|yes|false|no)#x2F;", $_args); /* Args can be passed as a simple yes|no. ( is_tag="yes" ). */
71
+ $args_are_yes = ($args_are_yes_no && preg_match ("/^(true|yes)#x2F;", $_args)); /* Passed as a simple yes|no. ( is_tag="yes" ). */
72
+ $args_are_array = (!$args_are_yes_no && preg_match ("/^\((.+?)\)#x2F;", $_args)); /* Example: has_tag="(cheese,butter,salt)" */
73
+ /**/
74
+ try /* Using try/catch here to protect this routine from errors due to invalid arguments passed through Shortcode attrs. */
75
+ {
76
+ if ($args_are_yes_no) /* No args. Only testing the return value. */
77
+ {
78
+ if ($args_are_yes && !call_user_func ($conditional))
79
+ {
80
+ $condition_failed = true;
81
+ break;
82
+ }
83
+ /**/
84
+ else if (call_user_func ($conditional))
85
+ {
86
+ $condition_failed = true;
87
+ break;
88
+ }
89
+ }
90
+ /**/
91
+ else if ($args_are_array && !call_user_func ($conditional, $args))
92
+ {
93
+ $condition_failed = true;
94
+ break;
95
+ }
96
+ /**/
97
+ else if (!call_user_func_array ($conditional, $args))
98
+ {
99
+ $condition_failed = true;
100
+ break;
101
+ }
102
+ }
103
+ /**/
104
+ catch (Exception $e) /* Catch errors silently. */
105
+ {
106
+ $condition_failed = true;
107
+ break;
108
+ }
109
+ }
110
+ }
111
+ /* Supports nested Shortcodes. */
112
+ return do_shortcode (apply_filters ("ws_plugin__s2member_sc_conditionals", (($condition_failed) ? "" : $content), get_defined_vars ()));
113
+ }
114
+ /**/
115
+ else if (preg_match ("/^(_*)s2Any#x2F;i", $shortcode)) /* This is the OR variation. This routine analyzes conditionals using OR logic, instead of AND. */
116
+ {
117
+ foreach ($attr as $conditional => $_args) /* Any condition can evaluate to true; except for basic yes|no argument values that are = "no". */
118
+ {
119
+ if (strlen ($_args) && strlen ($_args = preg_replace ("/^array\(/i", "(", $_args))) /* Remove array() prefixes and leave only the () indicator. */
120
+ if (strlen ($_args = preg_replace ("/[\r\n\t\s ]/", "", $_args)) && is_array ($args = preg_split ("/[;,]+/", $_args, 0, PREG_SPLIT_NO_EMPTY)) && !empty ($args))
121
+ {
122
+ $args_are_yes_no = preg_match ("/^(true|yes|false|no)#x2F;", $_args); /* Args can be passed as a simple yes|no. ( is_tag="yes" ). */
123
+ $args_are_yes = ($args_are_yes_no && preg_match ("/^(true|yes)#x2F;", $_args)); /* Passed as a simple yes|no. ( is_tag="yes" ). */
124
+ $args_are_array = (!$args_are_yes_no && preg_match ("/^\((.+?)\)#x2F;", $_args)); /* Example: has_tag="(cheese,butter,salt)" */
125
+ /**/
126
+ try /* Using try/catch here to protect this routine from errors due to invalid arguments passed through Shortcode attrs. */
127
+ {
128
+ if ($args_are_yes_no) /* No args. Only testing the return value. */
129
+ {
130
+ if ($args_are_yes && call_user_func ($conditional))
131
+ {
132
+ $condition_succeeded = true;
133
+ break;
134
+ }
135
+ /**/
136
+ else if (!call_user_func ($conditional))
137
+ {
138
+ $condition_succeeded = true;
139
+ break;
140
+ }
141
+ }
142
+ /**/
143
+ else if ($args_are_array && call_user_func ($conditional, $args))
144
+ {
145
+ $condition_succeeded = true;
146
+ break;
147
+ }
148
+ /**/
149
+ else if (call_user_func_array ($conditional, $args))
150
+ {
151
+ $condition_succeeded = true;
152
+ break;
153
+ }
154
+ }
155
+ /**/
156
+ catch (Exception $e) /* Catch errors silently. */
157
+ {
158
+ $condition_succeeded = false;
159
+ break;
160
+ }
161
+ }
162
+ }
163
+ /* Supports nested Shortcodes. */
164
+ return do_shortcode (apply_filters ("ws_plugin__s2member_sc_conditionals", (($condition_succeeded) ? $content : ""), get_defined_vars ()));
165
+ }
166
+ }
167
+ }
168
+ ?>
includes/functions/sc-get-details.inc.php ADDED
@@ -0,0 +1,77 @@
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 handles the Shortcode for [s2Get constant="S2MEMBER_CURRENT_USER_FIRST_NAME" user_option="s2member_subscr_id" /].
18
+ Attach to: add_shortcode("s2Get");
19
+ */
20
+ if (!function_exists ("ws_plugin__s2member_sc_get_details"))
21
+ {
22
+ function ws_plugin__s2member_sc_get_details ($attr = FALSE, $content = FALSE, $shortcode = FALSE)
23
+ {
24
+ static $current_user; /* Optimizes this routine a bit. */
25
+ $current_user = (!isset ($current_user)) ? wp_get_current_user () : $current_user;
26
+ /**/
27
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
28
+ do_action ("ws_plugin__s2member_before_sc_get_details", get_defined_vars ());
29
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
30
+ /**/
31
+ $attr = ws_plugin__s2member_trim_quot_deep ($attr); /* Fix &quot; in Shortcode attrs
32
+ that have been corrupted by a non-default visual editor; ( i.e. CKEditor does this ). */
33
+ /**/
34
+ $attr = shortcode_atts (array ("constant" => "", "custom_field" => "", "user_option" => ""), $attr);
35
+ /**/
36
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
37
+ do_action ("ws_plugin__s2member_before_sc_get_details_after_shortcode_atts", get_defined_vars ());
38
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
39
+ /**/
40
+ if ($attr["constant"] && defined ($attr["constant"])) /* Security check here. It must start with S2MEMBER_ on a Blog Farm. */
41
+ {
42
+ if (!is_multisite () || !ws_plugin__s2member_is_multisite_farm () || is_main_site () || preg_match ("/^S2MEMBER_/i", $attr["constant"]))
43
+ $get = constant ($attr["constant"]);
44
+ }
45
+ /**/
46
+ else if ($attr["custom_field"] && $current_user) /* Pull details out of the DB, matching a Custom Field being requested. */
47
+ {
48
+ if (preg_match ("/^(first_name|First Name)#x2F;i", $attr["custom_field"]))
49
+ $get = $current_user->first_name;
50
+ /**/
51
+ else if (preg_match ("/^(last_name|Last Name)#x2F;i", $attr["custom_field"]))
52
+ $get = $current_user->last_name;
53
+ /**/
54
+ else if (preg_match ("/^(email|E-mail|Email Address|E-mail Address)#x2F;i", $attr["custom_field"]))
55
+ $get = $current_user->user_email;
56
+ /**/
57
+ else if (isset ($current_user->$attr["custom_field"]))
58
+ $get = $current_user->$attr["custom_field"];
59
+ /**/
60
+ else /* Otherwise, we assume it's an actual Custom Field. */
61
+ {
62
+ $field = trim ($attr["custom_field"], "^* \t\n\r\0\x0B");
63
+ $field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field));
64
+ /**/
65
+ $fields = get_user_option ("s2member_custom_fields");
66
+ /**/
67
+ $get = $fields[$field_var];
68
+ }
69
+ }
70
+ /**/
71
+ else if ($attr["user_option"] && $current_user) /* Else pull details from meta table. */
72
+ $get = get_user_option ($attr["user_option"]);
73
+ /**/
74
+ return apply_filters ("ws_plugin__s2member_sc_get_details", $get, get_defined_vars ());
75
+ }
76
+ }
77
+ ?>
includes/functions/users-list.inc.php CHANGED
@@ -256,10 +256,13 @@ if (!function_exists ("ws_plugin__s2member_users_list_edit_cols"))
256
$field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field));
257
$field_id_class = preg_replace ("/_/", "-", $field_var);
258
/**/
259
- echo '<tr>' . "\n";
260
- echo '<th><label>' . esc_html ($field) . ':</label></th>' . "\n";
261
- echo '<td><input type="text" name="ws_plugin__s2member_profile_' . $field_var . '" value="' . format_to_edit ($fields[$field_var]) . '" class="regular-text" /></td>' . "\n";
262
- echo '</tr>' . "\n";
263
/**/
264
eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
265
do_action ("ws_plugin__s2member_during_users_list_edit_cols_during_custom_fields_after", get_defined_vars ());
@@ -325,6 +328,9 @@ if (!function_exists ("ws_plugin__s2member_users_list_edit_cols"))
325
$une = preg_match ("/\^/", $field); /* Preventing this field from being edited? */
326
$une = ($une) ? ' disabled="disabled"' : ''; /* Prevent this field from being edited. */
327
/**/
328
if ($field = trim ($field, "^* \t\n\r\0\x0B")) /* Don't process empty fields. */
329
{
330
eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
@@ -334,10 +340,15 @@ if (!function_exists ("ws_plugin__s2member_users_list_edit_cols"))
334
$field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field));
335
$field_id_class = preg_replace ("/_/", "-", $field_var);
336
/**/
337
- echo '<tr>' . "\n";
338
- echo '<th><label>' . esc_html ($field) . ':</label></th>' . "\n";
339
- echo '<td><input' . $une . ' type="text" name="ws_plugin__s2member_profile_' . $field_var . '" value="' . format_to_edit ($fields[$field_var]) . '" class="regular-text" /></td>' . "\n";
340
- echo '</tr>' . "\n";
341
/**/
342
eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
343
do_action ("ws_plugin__s2member_during_users_list_edit_cols_during_custom_fields_after", get_defined_vars ());
256
$field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field));
257
$field_id_class = preg_replace ("/_/", "-", $field_var);
258
/**/
259
+ if (apply_filters ("ws_plugin__s2member_during_users_list_edit_cols_during_custom_fields_display", true, get_defined_vars ()))
260
+ {
261
+ echo '<tr>' . "\n";
262
+ echo '<th><label>' . esc_html ($field) . ':</label></th>' . "\n";
263
+ echo '<td><input type="text" name="ws_plugin__s2member_profile_' . $field_var . '" value="' . format_to_edit ($fields[$field_var]) . '" class="regular-text" /></td>' . "\n";
264
+ echo '</tr>' . "\n";
265
+ }
266
/**/
267
eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
268
do_action ("ws_plugin__s2member_during_users_list_edit_cols_during_custom_fields_after", get_defined_vars ());
328
$une = preg_match ("/\^/", $field); /* Preventing this field from being edited? */
329
$une = ($une) ? ' disabled="disabled"' : ''; /* Prevent this field from being edited. */
330
/**/
331
+ $req = preg_match ("/\*/", $field); /* Required fields should be wrapped inside asterisks. */
332
+ $req = ($req) ? ' aria-required="true"' : ''; /* Has JavaScript validation applied. */
333
+ /**/
334
if ($field = trim ($field, "^* \t\n\r\0\x0B")) /* Don't process empty fields. */
335
{
336
eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
340
$field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field));
341
$field_id_class = preg_replace ("/_/", "-", $field_var);
342
/**/
343
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
344
+ if (apply_filters ("ws_plugin__s2member_during_users_list_edit_cols_during_custom_fields_display", true, get_defined_vars ()))
345
+ {
346
+ echo '<tr>' . "\n";
347
+ echo '<th><label>' . esc_html ($field) . ':</label></th>' . "\n";
348
+ echo '<td><input' . $une . $req . ' type="text" name="ws_plugin__s2member_profile_' . $field_var . '" value="' . format_to_edit ($fields[$field_var]) . '" class="regular-text" /></td>' . "\n";
349
+ echo '</tr>' . "\n";
350
+ }
351
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
352
/**/
353
eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
354
do_action ("ws_plugin__s2member_during_users_list_edit_cols_during_custom_fields_after", get_defined_vars ());
includes/functions/utilities.inc.php CHANGED
@@ -297,17 +297,6 @@ if (!function_exists ("ws_plugin__s2member_encrypt"))
297
}
298
}
299
/*
300
- Alias function for API Scripting usage.
301
- Deprecated in v3.0.5. This will be removed in a future release.
302
- */
303
- if (!function_exists ("s2member_encrypt"))
304
- {
305
- function s2member_encrypt ($string = FALSE, $key = FALSE)
306
- {
307
- return ws_plugin__s2member_encrypt ($string, $key);
308
- }
309
- }
310
- /*
311
RIJNDAEL 256: two-way encryption/decryption, with a url-safe base64 wrapper.
312
Includes a built-in fallback on XOR encryption when mcrypt is not available.
313
*/
@@ -340,17 +329,6 @@ if (!function_exists ("ws_plugin__s2member_decrypt"))
340
}
341
}
342
/*
343
- Alias function for API Scripting usage.
344
- Deprecated in v3.0.5. This will be removed in a future release.
345
- */
346
- if (!function_exists ("s2member_decrypt"))
347
- {
348
- function s2member_decrypt ($base64 = FALSE, $key = FALSE)
349
- {
350
- return ws_plugin__s2member_decrypt ($base64, $key);
351
- }
352
- }
353
- /*
354
XOR two-way encryption/decryption, with a base64 wrapper.
355
*/
356
if (!function_exists ("ws_plugin__s2member_xencrypt"))
@@ -378,17 +356,6 @@ if (!function_exists ("ws_plugin__s2member_xencrypt"))
378
}
379
}
380
/*
381
- Alias function for API Scripting usage.
382
- Deprecated in v3.0.5. This will be removed in a future release.
383
- */
384
- if (!function_exists ("s2member_xencrypt"))
385
- {
386
- function s2member_xencrypt ($string = FALSE, $key = FALSE)
387
- {
388
- return ws_plugin__s2member_xencrypt ($string, $key);
389
- }
390
- }
391
- /*
392
XOR two-way encryption/decryption, with a base64 wrapper.
393
*/
394
if (!function_exists ("ws_plugin__s2member_xdecrypt"))
@@ -420,17 +387,6 @@ if (!function_exists ("ws_plugin__s2member_xdecrypt"))
420
}
421
}
422
/*
423
- Alias function for API Scripting usage.
424
- Deprecated in v3.0.5. This will be removed in a future release.
425
- */
426
- if (!function_exists ("s2member_xdecrypt"))
427
- {
428
- function s2member_xdecrypt ($base64 = FALSE, $key = FALSE)
429
- {
430
- return ws_plugin__s2member_xdecrypt ($base64, $key);
431
- }
432
- }
433
- /*
434
Function generates a random string with letters/numbers/symbols.
435
*/
436
if (!function_exists ("ws_plugin__s2member_random_str_gen"))
297
}
298
}
299
/*
300
RIJNDAEL 256: two-way encryption/decryption, with a url-safe base64 wrapper.
301
Includes a built-in fallback on XOR encryption when mcrypt is not available.
302
*/
329
}
330
}
331
/*
332
XOR two-way encryption/decryption, with a base64 wrapper.
333
*/
334
if (!function_exists ("ws_plugin__s2member_xencrypt"))
356
}
357
}
358
/*
359
XOR two-way encryption/decryption, with a base64 wrapper.
360
*/
361
if (!function_exists ("ws_plugin__s2member_xdecrypt"))
387
}
388
}
389
/*
390
Function generates a random string with letters/numbers/symbols.
391
*/
392
if (!function_exists ("ws_plugin__s2member_random_str_gen"))
includes/hooks.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
Add the plugin actions/filters here.
18
*/
@@ -41,6 +41,8 @@ add_action ("template_redirect", "ws_plugin__s2member_check_ptag_level_access",
41
add_action ("template_redirect", "ws_plugin__s2member_check_post_level_access", 1);
42
add_action ("template_redirect", "ws_plugin__s2member_check_page_level_access", 1);
43
/**/
44
add_action ("wp_print_styles", "ws_plugin__s2member_add_css");
45
add_action ("wp_print_scripts", "ws_plugin__s2member_add_js_w_globals");
46
add_filter ("gettext", "ws_plugin__s2member_translation_mangler", 10, 3);
12
Direct access denial.
13
*/
14
if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit("Do not access this file directly.");
16
/*
17
Add the plugin actions/filters here.
18
*/
41
add_action ("template_redirect", "ws_plugin__s2member_check_post_level_access", 1);
42
add_action ("template_redirect", "ws_plugin__s2member_check_page_level_access", 1);
43
/**/
44
+ add_filter ("widget_text", "do_shortcode"); /* Shortcodes in widgets. */
45
+ /**/
46
add_action ("wp_print_styles", "ws_plugin__s2member_add_css");
47
add_action ("wp_print_scripts", "ws_plugin__s2member_add_js_w_globals");
48
add_filter ("gettext", "ws_plugin__s2member_translation_mangler", 10, 3);
includes/menu-pages/code-samples/current-user-access-label.php CHANGED
@@ -1,3 +1,7 @@
1
<?php echo S2MEMBER_CURRENT_USER_ACCESS_LABEL; ?>
2
This may output something like: Gold Membership
3
- ( or whatever Label you've configured for their Membership Level )
1
<?php echo S2MEMBER_CURRENT_USER_ACCESS_LABEL; ?>
2
This may output something like: Gold Membership
3
+ ( or whatever Label you've configured for their Membership Level )
4
+
5
+ ---- s2member Shortcode Equivalent ----
6
+
7
+ [s2Get constant="S2MEMBER_CURRENT_USER_ACCESS_LABEL" /].
includes/menu-pages/code-samples/current-user-access-level-conditional-upgrades.php CHANGED
@@ -8,4 +8,26 @@
8
Insert Modification Button here. Upgrade Level 1 Members to Level 2 or higher.
9
<?php } else if(S2MEMBER_CURRENT_USER_ACCESS_LEVEL === 0){ ?>
10
Insert Modification Button here. Let Free Subscribers become a Member.
11
- <?php } ?>
8
Insert Modification Button here. Upgrade Level 1 Members to Level 2 or higher.
9
<?php } else if(S2MEMBER_CURRENT_USER_ACCESS_LEVEL === 0){ ?>
10
Insert Modification Button here. Let Free Subscribers become a Member.
11
+ <?php } ?>
12
+
13
+ ---- s2member Shortcode Equivalents ----
14
+
15
+ [s2All current_user_is="s2member_level4"]
16
+ Member is already at the highest Level. No Modification Button displayed here.
17
+ [/s2All]
18
+
19
+ [s2All current_user_is="s2member_level3"]
20
+ Insert Modification Button here. Upgrade Level 3 Members to highest Level 4.
21
+ [/s2All]
22
+
23
+ [s2All current_user_is="s2member_level2"]
24
+ Insert Modification Button here. Upgrade Level 2 Members to Level 3 or higher.
25
+ [/s2All]
26
+
27
+ [s2All current_user_is="s2member_level1"]
28
+ Insert Modification Button here. Upgrade Level 1 Members to Level 2 or higher.
29
+ [/s2All]
30
+
31
+ [s2All current_user_is="s2member_level0"]
32
+ Insert Modification Button here. Let Free Subscribers become a Member.
33
+ [/s2All]
includes/menu-pages/code-samples/current-user-access-level.php CHANGED
@@ -10,4 +10,30 @@
10
A User is logged in as a Free Subscriber.
11
<?php } else if(S2MEMBER_CURRENT_USER_ACCESS_LEVEL === -1){ ?>
12
A User is not logged in at all.
13
- <?php } ?>
10
A User is logged in as a Free Subscriber.
11
<?php } else if(S2MEMBER_CURRENT_USER_ACCESS_LEVEL === -1){ ?>
12
A User is not logged in at all.
13
+ <?php } ?>
14
+
15
+ ---- s2member Shortcode Equivalent ----
16
+
17
+ [s2All current_user_is="s2member_level4"]
18
+ Some premium content for Level 4 Members.
19
+ [/s2All]
20
+
21
+ [s2All current_user_is="s2member_level3"]
22
+ Some premium content for Level 3 Members.
23
+ [/s2All]
24
+
25
+ [s2All current_user_is="s2member_level2"]
26
+ Some premium content for Level 2 Members.
27
+ [/s2All]
28
+
29
+ [s2All current_user_is="s2member_level1"]
30
+ Some premium content for Level 1 Members.
31
+ [/s2All]
32
+
33
+ [s2All current_user_is="s2member_level0"]
34
+ Some content for Free Subscribers.
35
+ [/s2All]
36
+
37
+ [s2All is_user_logged_in="no"]
38
+ Some public content.
39
+ [/s2All]
includes/menu-pages/code-samples/current-user-can-ccaps-1.php CHANGED
@@ -1,4 +1,4 @@
1
- <?php if (is_user_logged_in() && current_user_can("access_s2member_level1")){ ?>
2
3
Some premium content for all Level 1 Members.
4
@@ -12,4 +12,24 @@
12
13
<?php } else { ?>
14
Some public content.
15
- <?php } ?>
1
+ <?php if (current_user_can("access_s2member_level1")){ ?>
2
3
Some premium content for all Level 1 Members.
4
12
13
<?php } else { ?>
14
Some public content.
15
+ <?php } ?>
16
+
17
+ ---- s2member Shortcode Equivalents ----
18
+
19
+ [s2All current_user_can="access_s2member_level1"]
20
+
21
+ Some premium content for all Level 1 Members.
22
+
23
+ [_s2All current_user_can="access_s2member_ccap_music"]
24
+ Display links for music as well.
25
+ [/_s2All]
26
+
27
+ [_s2All current_user_can="access_s2member_ccap_videos"]
28
+ Display videos as well.
29
+ [/_s2All]
30
+
31
+ [/s2All]
32
+
33
+ [s2All current_user_cannot="access_s2member_level1"]
34
+ Some public content.
35
+ [/s2All]
includes/menu-pages/code-samples/current-user-can-ccaps-2.php CHANGED
@@ -1,4 +1,4 @@
1
- <?php if (is_user_logged_in() && current_user_can("access_s2member_level1")){ ?>
2
3
Some premium content for all Level 1 Members.
4
@@ -25,4 +25,40 @@
25
26
<?php } else { ?>
27
Some public content.
28
- <?php } ?>
1
+ <?php if (current_user_can("access_s2member_level1")){ ?>
2
3
Some premium content for all Level 1 Members.
4
25
26
<?php } else { ?>
27
Some public content.
28
+ <?php } ?>
29
+
30
+ ---- s2member Shortcode Equivalents ----
31
+
32
+ [s2All current_user_can="access_s2member_level1"]
33
+
34
+ Some premium content for all Level 1 Members.
35
+
36
+ [_s2All current_user_can="access_s2member_ccap_ebooks"]
37
+ Display links for downloading your eBooks.
38
+ [/_s2All]
39
+ [_s2All current_user_cannot="access_s2member_ccap_ebooks"]
40
+ Insert a PayPal® Modification Button that includes the Custom Capability: ebooks
41
+ This might read, "Upgrade Your Membership for access to my eBooks!".
42
+ [/_s2All]
43
+
44
+ [_s2All current_user_can="access_s2member_ccap_reports"]
45
+ Display links for accessing your reports.
46
+ [/_s2All]
47
+ [_s2All current_user_cannot="access_s2member_ccap_reports"]
48
+ Insert a PayPal® Modification Button that includes the Custom Capability: reports
49
+ This might read, "Upgrade Your Membership for access to my reports!".
50
+ [/_s2All]
51
+
52
+ [_s2All current_user_can="access_s2member_ccap_tips"]
53
+ Display tips.
54
+ [/_s2All]
55
+ [_s2All current_user_cannot="access_s2member_ccap_tips"]
56
+ Insert a PayPal® Modification Button that includes the Custom Capability: tips
57
+ This might read, "Upgrade Your Membership for access to my tips!".
58
+ [/_s2All]
59
+
60
+ [/s2All]
61
+
62
+ [s2All current_user_cannot="access_s2member_level1"]
63
+ Some public content.
64
+ [/s2All]
includes/menu-pages/code-samples/current-user-can-full-access.php CHANGED
@@ -1,4 +1,4 @@
1
- <?php if (is_user_logged_in() && current_user_can("access_s2member_level1")){ ?>
2
Some content for Members who are logged in with an s2Member Level >= 1.
3
<?php } else { ?>
4
Some public content.
1
+ <?php if (current_user_can("access_s2member_level1")){ ?>
2
Some content for Members who are logged in with an s2Member Level >= 1.
3
<?php } else { ?>
4
Some public content.
includes/menu-pages/code-samples/current-user-can-specific-content.php DELETED
@@ -1,13 +0,0 @@
1
- <?php if (is_user_logged_in() && current_user_can("access_s2member_level4")){ ?>
2
- Some premium content for Level 4 Members.
3
- <?php } else if (is_user_logged_in() && current_user_can("access_s2member_level3")){ ?>
4
- Some premium content for Level 3 Members.
5
- <?php } else if (is_user_logged_in() && current_user_can("access_s2member_level2")){ ?>
6
- Some premium content for Level 2 Members.
7
- <?php } else if (is_user_logged_in() && current_user_can("access_s2member_level1")){ ?>
8
- Some premium content for Level 1 Members.
9
- <?php } else if (is_user_logged_in() && current_user_can("access_s2member_level0")){ ?>
10
- Some content for Free Subscribers.
11
- <?php } else { ?>
12
- Some public content.
13
- <?php } ?>
includes/menu-pages/code-samples/current-user-custom.php CHANGED
@@ -1,3 +1,7 @@
1
<?php echo S2MEMBER_CURRENT_USER_CUSTOM; ?>
2
This may output something like: www.yourdomain.com|cv1|cv2|cv3
3
- ( this is the PayPal input field value for the `custom` variable )
1
<?php echo S2MEMBER_CURRENT_USER_CUSTOM; ?>
2
This may output something like: www.yourdomain.com|cv1|cv2|cv3
3
+ ( this is the PayPal input field value for the `custom` variable )
4
+
5
+ ---- s2member Shortcode Equivalent ----
6
+
7
+ [s2Get constant="S2MEMBER_CURRENT_USER_CUSTOM" /]
includes/menu-pages/code-samples/current-user-display-name.php CHANGED
@@ -1,3 +1,7 @@
1
<?php echo S2MEMBER_CURRENT_USER_DISPLAY_NAME; ?>
2
This may output something like: Johnny
3
- ( this is the User's display name )
1
<?php echo S2MEMBER_CURRENT_USER_DISPLAY_NAME; ?>
2
This may output something like: Johnny
3
+ ( this is the User's display name )
4
+
5
+ ---- s2member Shortcode Equivalent ----
6
+
7
+ [s2Get constant="S2MEMBER_CURRENT_USER_DISPLAY_NAME" /]
includes/menu-pages/code-samples/current-user-downloads-allowed-days.php CHANGED
@@ -1,3 +1,7 @@
1
<?php echo S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS; ?>
2
This will output the number of days ( the period ) in which stats are being kept.
3
- ( users are allowed to download X number of files every X number of days )
1
<?php echo S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS; ?>
2
This will output the number of days ( the period ) in which stats are being kept.
3
+ ( users are allowed to download X number of files every X number of days )
4
+
5
+ ---- s2member Shortcode Equivalent ----
6
+
7
+ [s2Get constant="S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS" /]
includes/menu-pages/code-samples/current-user-downloads-allowed-is-unlimited.php CHANGED
@@ -1,2 +1,6 @@
1
You are allowed to download <?php echo (S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED) ? 'Unlimited' : S2MEMBER_LEVEL2_FILE_DOWNLOADS_ALLOWED; ?> files
2
- every <?php S2MEMBER_LEVEL2_FILE_DOWNLOADS_ALLOWED_DAYS; ?> days.
1
You are allowed to download <?php echo (S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED) ? 'Unlimited' : S2MEMBER_LEVEL2_FILE_DOWNLOADS_ALLOWED; ?> files
2
+ every <?php S2MEMBER_LEVEL2_FILE_DOWNLOADS_ALLOWED_DAYS; ?> days.
3
+
4
+ ---- s2member Shortcode Equivalent ----
5
+
6
+ There is NO equivalent for this logic yet.
includes/menu-pages/code-samples/current-user-downloads-allowed.php CHANGED
@@ -1,3 +1,7 @@
1
<?php echo S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED; ?>
2
This will output the number of files they're allowed to download.
3
- ( the number of files allowed is based on their membership level )
1
<?php echo S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED; ?>
2
This will output the number of files they're allowed to download.
3
+ ( the number of files allowed is based on their membership level )
4
+
5
+ ---- s2member Shortcode Equivalent ----
6
+
7
+ [s2Get constant="S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED" /]
includes/menu-pages/code-samples/current-user-downloads-currently.php CHANGED
@@ -1,3 +1,7 @@
1
<?php echo S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY; ?>
2
This will output the number of files they've downloaded recently.
3
- ( that is, the number of files within the last X days, according to your configuration )
1
<?php echo S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY; ?>
2
This will output the number of files they've downloaded recently.
3
+ ( that is, the number of files within the last X days, according to your configuration )
4
+
5
+ ---- s2member Shortcode Equivalent ----
6
+
7
+ [s2Get constant="S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY" /]
includes/menu-pages/code-samples/current-user-email.php CHANGED
@@ -1,3 +1,7 @@
1
<?php echo S2MEMBER_CURRENT_USER_EMAIL; ?>
2
This may output something like: johnsmith@example.com
3
- ( or whatever their email address is )
1
<?php echo S2MEMBER_CURRENT_USER_EMAIL; ?>
2
This may output something like: johnsmith@example.com
3
+ ( or whatever their email address is )
4
+
5
+ ---- s2member Shortcode Equivalent ----
6
+
7
+ [s2Get constant="S2MEMBER_CURRENT_USER_EMAIL" /]
includes/menu-pages/code-samples/current-user-fields.php CHANGED
@@ -4,4 +4,20 @@ This would output the first and last name for the current user.
4
5
Custom Fields are also included in the JSON decoded array.
6
<?php print_r(json_decode(S2MEMBER_CURRENT_USER_FIELDS, true)); ?>
7
- ( Displays a full list of all associative array elements. )
4
5
Custom Fields are also included in the JSON decoded array.
6
<?php print_r(json_decode(S2MEMBER_CURRENT_USER_FIELDS, true)); ?>
7
+ ( Displays a full list of all associative array elements. )
8
+
9
+ ---- s2member Shortcode Equivalents ----
10
+
11
+ [s2Get custom_field="first_name" /]
12
+ [s2Get custom_field="last_name" /]
13
+ [s2Get custom_field="Website URL" /]
14
+ [s2Get custom_field="My Custom Field Name" /]
15
+ [s2Get custom_field="my_custom_field_name" /]
16
+ [s2Get custom_field="any other WP_User property" /]
17
+
18
+ You can also pull details from the meta table.
19
+ [s2Get user_option="s2member_custom" /]
20
+ [s2Get user_option="s2member_subscr_id" /]
21
+ [s2Get user_option="s2member_last_payment_time" /]
22
+ [s2Get user_option="s2member_auto_eot_time" /]
23
+ [s2Get user_option="any other meta_key" /]
includes/menu-pages/code-samples/current-user-first-name.php CHANGED
@@ -1,3 +1,7 @@
1
<?php echo S2MEMBER_CURRENT_USER_FIRST_NAME; ?>
2
This may output something like: John
3
- ( or whatever their first name is )
1
<?php echo S2MEMBER_CURRENT_USER_FIRST_NAME; ?>
2
This may output something like: John
3
+ ( or whatever their first name is )
4
+
5
+ ---- s2member Shortcode Equivalent ----
6
+
7
+ [s2Get constant="S2MEMBER_CURRENT_USER_FIRST_NAME" /]
includes/menu-pages/code-samples/current-user-id.php CHANGED
@@ -1,3 +1,7 @@
1
<?php echo S2MEMBER_CURRENT_USER_ID; ?>
2
This may output something like: 5547
3
- ( or whatever their user ID# is )
1
<?php echo S2MEMBER_CURRENT_USER_ID; ?>
2
This may output something like: 5547
3
+ ( or whatever their user ID# is )
4
+
5
+ ---- s2member Shortcode Equivalent ----
6
+
7
+ [s2Get constant="S2MEMBER_CURRENT_USER_ID" /]
includes/menu-pages/code-samples/current-user-ip.php CHANGED
@@ -1,3 +1,7 @@
1
<?php echo S2MEMBER_CURRENT_USER_IP; ?>
2
This may output something like: 123.456.789.111
3
- ( or whatever the current user's IP address happens to be )
1
<?php echo S2MEMBER_CURRENT_USER_IP; ?>
2
This may output something like: 123.456.789.111
3
+ ( or whatever the current user's IP address happens to be )
4
+
5
+ ---- s2member Shortcode Equivalent ----
6
+
7
+ [s2Get constant="S2MEMBER_CURRENT_USER_IP" /]
includes/menu-pages/code-samples/current-user-is-logged-in-as-member.php CHANGED
@@ -1,3 +1,9 @@
1
<?php if (S2MEMBER_CURRENT_USER_IS_LOGGED_IN_AS_MEMBER){ ?>
2
A Member is logged in, with an Access Level >= 1.
3
- <?php } ?>
1
<?php if (S2MEMBER_CURRENT_USER_IS_LOGGED_IN_AS_MEMBER){ ?>
2
A Member is logged in, with an Access Level >= 1.
3
+ <?php } ?>
4
+
5
+ ---- s2member Shortcode Equivalent ----
6
+
7
+ [s2All is_user_logged_in="yes" current_user_can="access_s2member_level1"]
8
+ content goes here
9
+ [/s2All]
includes/menu-pages/code-samples/current-user-is-logged-in.php CHANGED
@@ -1,3 +1,9 @@
1
<?php if (S2MEMBER_CURRENT_USER_IS_LOGGED_IN){ ?>
2
A User/Member is logged in, with an Access Level >= 0.
3
- <?php } ?>
1
<?php if (S2MEMBER_CURRENT_USER_IS_LOGGED_IN){ ?>
2
A User/Member is logged in, with an Access Level >= 0.
3
+ <?php } ?>
4
+
5
+ ---- s2member Shortcode Equivalent ----
6
+
7
+ [s2All is_user_logged_in="yes"]
8
+ content goes here
9
+ [/s2All]
includes/menu-pages/code-samples/current-user-is-specific-content.php ADDED
@@ -0,0 +1,13 @@
1
+ <?php if (current_user_is("s2member_level4")){ ?>
2
+ Some premium content for Level 4 Members.
3
+ <?php } else if (current_user_is("s2member_level3")){ ?>
4
+ Some premium content for Level 3 Members.
5
+ <?php } else if (current_user_is("s2member_level2")){ ?>
6
+ Some premium content for Level 2 Members.
7
+ <?php } else if (current_user_is("s2member_level1")){ ?>
8
+ Some premium content for Level 1 Members.
9
+ <?php } else if (current_user_is("s2member_level0")){ ?>
10
+ Some content for Free Subscribers.
11
+ <?php } else { ?>
12
+ Some public content.
13
+ <?php } ?>
includes/menu-pages/code-samples/current-user-last-name.php CHANGED
@@ -1,3 +1,7 @@
1
<?php echo S2MEMBER_CURRENT_USER_LAST_NAME; ?>
2
This may output something like: Smith
3
- ( or whatever their last name is )
1
<?php echo S2MEMBER_CURRENT_USER_LAST_NAME; ?>
2
This may output something like: Smith
3
+ ( or whatever their last name is )
4
+
5
+ ---- s2member Shortcode Equivalent ----
6
+
7
+ [s2Get constant="S2MEMBER_CURRENT_USER_LAST_NAME" /]
includes/menu-pages/code-samples/current-user-login.php CHANGED
@@ -1,3 +1,7 @@
1
<?php echo S2MEMBER_CURRENT_USER_LOGIN; ?>
2
This may output something like: johnsmith22
3
- ( or whatever their login/username is )
1
<?php echo S2MEMBER_CURRENT_USER_LOGIN; ?>
2
This may output something like: johnsmith22
3
+ ( or whatever their login/username is )
4
+
5
+ ---- s2member Shortcode Equivalent ----
6
+
7
+ [s2Get constant="S2MEMBER_CURRENT_USER_LOGIN" /]
includes/menu-pages/code-samples/current-user-profile-modification-page-url-1.php CHANGED
@@ -1 +1,5 @@
1
- <a href="<?php echo S2MEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL; ?>">Modify Profile</a>
1
+ <a href="<?php echo S2MEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL; ?>">Modify Profile</a>
2
+
3
+ ---- s2member Shortcode Equivalent ----
4
+
5
+ [s2Get constant="S2MEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL" /]
includes/menu-pages/code-samples/current-user-registration-days-dripping.php CHANGED
@@ -14,4 +14,10 @@
14
Drip content to Members who are more than 90 days old.
15
<?php } ?>
16
17
- <?php } ?>
14
Drip content to Members who are more than 90 days old.
15
<?php } ?>
16
17
+ <?php } ?>
18
+
19
+ ---- s2member Shortcode Equivalent ----
20
+
21
+ [s2Get constant="S2MEMBER_CURRENT_USER_REGISTRATION_DAYS" /]
22
+
23
+ There is NO Shortcode equivalent for this logic yet. Coming soon.
includes/menu-pages/code-samples/current-user-registration-days.php CHANGED
@@ -19,4 +19,10 @@ Here's how you Drip Content. The longer they've been a Member, the more they get
19
Drip content to Members who are more than 90 days old.
20
<?php } ?>
21
22
- <?php } ?>
19
Drip content to Members who are more than 90 days old.
20
<?php } ?>
21
22
+ <?php } ?>
23
+
24
+ ---- s2member Shortcode Equivalent ----
25
+
26
+ [s2Get constant="S2MEMBER_CURRENT_USER_REGISTRATION_DAYS" /]
27
+
28
+ There is NO Shortcode equivalent for this logic yet. Coming soon.
includes/menu-pages/code-samples/current-user-registration-time.php CHANGED
@@ -1,3 +1,7 @@
1
<?php echo S2MEMBER_CURRENT_USER_REGISTRATION_TIME; ?>
2
This may output something like: 1270537981
3
- ( this is a Unix timestamp, which is based on seconds )
1
<?php echo S2MEMBER_CURRENT_USER_REGISTRATION_TIME; ?>
2
This may output something like: 1270537981
3
+ ( this is a Unix timestamp, which is based on seconds )
4
+
5
+ ---- s2member Shortcode Equivalent ----
6
+
7
+ [s2Get constant="S2MEMBER_CURRENT_USER_REGISTRATION_TIME" /]
includes/menu-pages/code-samples/current-user-subscr-id.php CHANGED
@@ -2,4 +2,8 @@
2
This may output something like: S-82234JD0923423
3
( this is the PayPal Subscription ID associated with their account )
4
( if the User is a Free Subscriber, this is their Free Subscriber ID )
5
- ( for Lifetime subscriptions sold through Buy It Now buttons, this will hold the PayPal Transaction ID associated with their purchase )
2
This may output something like: S-82234JD0923423
3
( this is the PayPal Subscription ID associated with their account )
4
( if the User is a Free Subscriber, this is their Free Subscriber ID )
5
+ ( for Lifetime subscriptions sold through Buy It Now buttons, this will hold the PayPal Transaction ID associated with their purchase )
6
+
7
+ ---- s2member Shortcode Equivalent ----
8
+
9
+ [s2Get constant="S2MEMBER_CURRENT_USER_SUBSCR_ID" /]
includes/menu-pages/code-samples/current-user-value-for-pp-on0-os0.php CHANGED
@@ -1,4 +1,9 @@
1
<!-- Identifies/Updates An Existing Member After Checkout -->
2
<input type="hidden" name="on0" value="<?php echo S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0; ?>" />
3
<input type="hidden" name="os0" value="<?php echo S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0; ?>" />
4
- <input type="hidden" name="modify" value="1" />
1
<!-- Identifies/Updates An Existing Member After Checkout -->
2
<input type="hidden" name="on0" value="<?php echo S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0; ?>" />
3
<input type="hidden" name="os0" value="<?php echo S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0; ?>" />
4
+ <input type="hidden" name="modify" value="1" />
5
+
6
+ ---- s2member Shortcode Equivalents ----
7
+
8
+ [s2Get constant="S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0" /]
9
+ [s2Get constant="S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0" /]
includes/menu-pages/code-samples/file-download-inline-extensions.php CHANGED
@@ -1,3 +1,7 @@
1
<?php echo S2MEMBER_FILE_DOWNLOAD_INLINE_EXTENSIONS; ?>
2
This may output something like: pdf,jpg,jpeg,jpe,png
3
- ( s2Member will display these extensions inline )
1
<?php echo S2MEMBER_FILE_DOWNLOAD_INLINE_EXTENSIONS; ?>
2
This may output something like: pdf,jpg,jpeg,jpe,png
3
+ ( s2Member will display these extensions inline )
4
+
5
+ ---- s2member Shortcode Equivalent ----
6
+
7
+ [s2Get constant="S2MEMBER_FILE_DOWNLOAD_INLINE_EXTENSIONS" /]
includes/menu-pages/code-samples/file-download-limit-exceeded-page-url.php CHANGED
@@ -1,3 +1,7 @@
1
<?php if (S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY > S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED){ ?>
2
Limit Exceeded, <a href="<?php echo S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL; ?>">click here for details</a>.
3
- <?php } ?>
1
<?php if (S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY > S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED){ ?>
2
Limit Exceeded, <a href="<?php echo S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL; ?>">click here for details</a>.
3
+ <?php } ?>
4
+
5
+ ---- s2member Shortcode Equivalent ----
6
+
7
+ [s2Get constant="S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL" /]
includes/menu-pages/code-samples/level0-file-downloads-allowed-days.php CHANGED
@@ -1,3 +1,7 @@
1
Level #0 Users are allowed to download
2
<?php echo S2MEMBER_LEVEL0_FILE_DOWNLOADS_ALLOWED; ?> files
3
- every <?php S2MEMBER_LEVEL0_FILE_DOWNLOADS_ALLOWED_DAYS; ?> days.
1
Level #0 Users are allowed to download
2
<?php echo S2MEMBER_LEVEL0_FILE_DOWNLOADS_ALLOWED; ?> files
3
+ every <?php S2MEMBER_LEVEL0_FILE_DOWNLOADS_ALLOWED_DAYS; ?> days.
4
+
5
+ ---- s2member Shortcode Equivalent ----
6
+
7
+ [s2Get constant="S2MEMBER_LEVEL0_FILE_DOWNLOADS_ALLOWED_DAYS" /]
includes/menu-pages/code-samples/level0-file-downloads-allowed.php CHANGED
@@ -1,3 +1,7 @@
1
Level #0 Users are allowed to download
2
<?php echo S2MEMBER_LEVEL0_FILE_DOWNLOADS_ALLOWED; ?> files
3
- every <?php S2MEMBER_LEVEL0_FILE_DOWNLOADS_ALLOWED_DAYS; ?> days.
1
Level #0 Users are allowed to download
2
<?php echo S2MEMBER_LEVEL0_FILE_DOWNLOADS_ALLOWED; ?> files
3
+ every <?php S2MEMBER_LEVEL0_FILE_DOWNLOADS_ALLOWED_DAYS; ?> days.
4
+
5
+ ---- s2member Shortcode Equivalent ----
6
+
7
+ [s2Get constant="S2MEMBER_LEVEL0_FILE_DOWNLOADS_ALLOWED" /]
includes/menu-pages/code-samples/level0-label.php CHANGED
@@ -1,3 +1,7 @@
1
<?php echo S2MEMBER_LEVEL0_LABEL; ?>
2
This may output something like: Free
3
- ( or whatever Label you've configured for Level #0 )
1
<?php echo S2MEMBER_LEVEL0_LABEL; ?>
2
This may output something like: Free
3
+ ( or whatever Label you've configured for Level #0 )
4
+
5
+ ---- s2member Shortcode Equivalent ----
6
+
7
+ [s2Get constant="S2MEMBER_LEVEL0_LABEL" /]
includes/menu-pages/code-samples/level1-file-downloads-allowed-days.php CHANGED
@@ -1,3 +1,7 @@
1
Level #1 Members are allowed to download
2
<?php echo S2MEMBER_LEVEL1_FILE_DOWNLOADS_ALLOWED; ?> files
3
- every <?php S2MEMBER_LEVEL1_FILE_DOWNLOADS_ALLOWED_DAYS; ?> days.
1
Level #1 Members are allowed to download
2
<?php echo S2MEMBER_LEVEL1_FILE_DOWNLOADS_ALLOWED; ?> files
3
+ every <?php S2MEMBER_LEVEL1_FILE_DOWNLOADS_ALLOWED_DAYS; ?> days.
4
+
5
+ ---- s2member Shortcode Equivalent ----
6
+
7
+ [s2Get constant="S2MEMBER_LEVEL1_FILE_DOWNLOADS_ALLOWED_DAYS" /]
includes/menu-pages/code-samples/level1-file-downloads-allowed.php CHANGED
@@ -1,3 +1,7 @@
1
Level #1 Members are allowed to download
2
<?php echo S2MEMBER_LEVEL1_FILE_DOWNLOADS_ALLOWED; ?> files
3
- every <?php S2MEMBER_LEVEL1_FILE_DOWNLOADS_ALLOWED_DAYS; ?> days.