WP-Members Membership Plugin - Version 3.0.7

Version Description

  • Fix for use of display_name on profile update.
  • Fix for newer installs (post WP 4.0) where WPLANG is not defined and reCAPTCHA is used.
  • Fix in wpmem_form shortcode to skp if no additional tag exists.
  • Fix to plugin_basename.
  • Changes in core to use fields from WP_Members class (preparing for new form field process).
  • Reviews and updates to code standards and inline documentation.
  • Fix for password reset (typo in object name checking for moderated registration)
  • Fix for PayPal extension (http://rkt.bz/r3); added logic to avoid errors if the PayPal extension is disabled but the main option setting remained turned on.
Download this release

Release Info

Developer cbutlerjr
Plugin Icon 128x128 WP-Members Membership Plugin
Version 3.0.7
Comparing to
See all releases

Code changes from version 3.0.6 to 3.0.7

admin/admin.php CHANGED
@@ -9,8 +9,7 @@
9
  * Copyright (c) 2006-2015 Chad Butler
10
  * WP-Members(tm) is a trademark of butlerblog.com
11
  *
12
- * @package WordPress
13
- * @subpackage WP-Members
14
  * @author Chad Butler
15
  * @copyright 2006-2015
16
  *
@@ -29,11 +28,15 @@
29
  */
30
 
31
 
32
- /** File Includes */
 
 
33
  include_once( WPMEM_PATH . 'admin/dialogs.php' );
34
 
35
 
36
- /** Actions and Filters */
 
 
37
  add_action( 'admin_enqueue_scripts', 'wpmem_admin_enqueue_scripts' );
38
  add_action( 'wpmem_admin_do_tab', 'wpmem_admin_do_tab' );
39
  add_action( 'wp_ajax_wpmem_a_field_reorder', 'wpmem_a_do_field_reorder' );
@@ -45,11 +48,14 @@ add_filter( 'plugin_action_links', 'wpmem_admin_plugin_links', 10, 2 )
45
  * Calls the function to reorder fields.
46
  *
47
  * @since 2.8.0
48
- *
49
- * @uses wpmem_a_field_reorder
50
  */
51
- function wpmem_a_do_field_reorder(){
 
 
 
52
  include_once( WPMEM_PATH . 'admin/tab-fields.php' );
 
 
53
  wpmem_a_field_reorder();
54
  }
55
 
@@ -57,17 +63,16 @@ function wpmem_a_do_field_reorder(){
57
  /**
58
  * Filter to add link to settings from plugin panel.
59
  *
60
- * @since 2.4
61
  *
62
  * @param array $links
63
  * @param string $file
64
- * @static string $wpmem_plugin
65
  * @return array $links
66
  */
67
  function wpmem_admin_plugin_links( $links, $file ) {
68
  static $wpmem_plugin;
69
  if ( ! $wpmem_plugin ) {
70
- $wpmem_plugin = plugin_basename( 'wp-members/wp-members.php' );
71
  }
72
  if ( $file == $wpmem_plugin ) {
73
  $settings_link = '<a href="options-general.php?page=wpmem-settings">' . __( 'Settings', 'wp-members' ) . '</a>';
@@ -82,9 +87,6 @@ function wpmem_admin_plugin_links( $links, $file ) {
82
  *
83
  * @since 2.5.1
84
  * @deprecated 3.0.6
85
- *
86
- * @uses wp_enqueue_script
87
- * @uses wp_enqueue_style
88
  */
89
  function wpmem_load_admin_js() {
90
  // Queue up admin ajax and styles.
@@ -96,21 +98,29 @@ function wpmem_load_admin_js() {
96
  /**
97
  * Creates the captcha tab.
98
  *
99
- * @since 2.8
100
  *
101
- * @param string $tab
102
- * @return
103
  */
104
  function wpmem_a_captcha_tab( $tab ) {
105
- include_once( WPMEM_PATH . 'admin/tab-captcha.php' );
106
- return ( $tab == 'captcha' ) ? wpmem_a_build_captcha_options() : false ;
 
 
 
 
 
 
 
 
107
  }
108
 
109
 
110
  /**
111
  * Adds the captcha tab.
112
  *
113
- * @since 2.8
114
  *
115
  * @param array $tabs The array of tabs for the admin panel.
116
  * @return array The updated array of tabs for the admin panel.
@@ -123,7 +133,9 @@ function wpmem_add_captcha_tab( $tabs ) {
123
  /**
124
  * Primary admin function.
125
  *
126
- * @since 2.1
 
 
127
  */
128
  function wpmem_admin() {
129
 
@@ -142,8 +154,10 @@ function wpmem_admin() {
142
  <?php
143
  $tab = ( isset( $_GET['tab'] ) ) ? $_GET['tab'] : 'options';
144
 
 
145
  wpmem_admin_tabs( $tab );
146
-
 
147
  wpmem_a_do_warnings( $did_update );
148
 
149
  /**
@@ -153,7 +167,7 @@ function wpmem_admin() {
153
  * additional admin tabs. This action is for adding content for
154
  * a custom tab.
155
  *
156
- * @since 2.8
157
  *
158
  * @param string $tab The tab being generated.
159
  */
@@ -167,8 +181,12 @@ function wpmem_admin() {
167
 
168
  /**
169
  * Displays the content for default tabs.
 
 
 
 
170
  *
171
- * @since 2.8
172
  *
173
  * @param string $tab The tab that we are on and displaying.
174
  */
@@ -199,7 +217,10 @@ function wpmem_admin_do_tab( $tab ) {
199
  /**
200
  * Assemble the tabs for the admin panel.
201
  *
202
- * @since 2.8
 
 
 
203
  *
204
  * @param string $current The tab that we are on.
205
  */
@@ -238,9 +259,10 @@ function wpmem_admin_tabs( $current = 'options' ) {
238
  /**
239
  * Handles the various update actions for the default tabs.
240
  *
241
- * @since 2.8
242
  *
243
- * @param string $action The action that is being done.
 
244
  */
245
  function wpmem_admin_action( $action ) {
246
 
@@ -248,6 +270,9 @@ function wpmem_admin_action( $action ) {
248
  switch ( $action ) {
249
 
250
  case 'update_settings':
 
 
 
251
  include_once( WPMEM_PATH . 'admin/tab-options.php' );
252
  $did_update = wpmem_update_options();
253
  break;
@@ -255,21 +280,33 @@ function wpmem_admin_action( $action ) {
255
  case 'update_fields':
256
  case 'add_field':
257
  case 'edit_field':
 
 
 
258
  include_once( WPMEM_PATH . 'admin/tab-fields.php' );
259
  $did_update = wpmem_update_fields( $action );
260
  break;
261
 
262
  case 'update_dialogs':
 
 
 
263
  include_once( WPMEM_PATH . 'admin/tab-dialogs.php' );
264
  $did_update = wpmem_update_dialogs();
265
  break;
266
 
267
  case 'update_emails':
 
 
 
268
  include_once( WPMEM_PATH . 'admin/tab-emails.php' );
269
  $did_update = wpmem_update_emails();
270
  break;
271
 
272
  case 'update_captcha':
 
 
 
273
  include_once( WPMEM_PATH . 'admin/tab-captcha.php' );
274
  $did_update = wpmem_update_captcha();
275
  break;
@@ -285,7 +322,11 @@ function wpmem_admin_action( $action ) {
285
  * @since 2.9.1
286
  */
287
  function wpmem_admin_add_new_user() {
 
 
 
288
  include_once( WPMEM_PATH . 'inc/wp-registration.php' );
 
289
  echo wpmem_do_wp_newuser_form();
290
  return;
291
  }
@@ -294,10 +335,9 @@ function wpmem_admin_add_new_user() {
294
  /**
295
  * Enqueues the admin javascript and css files.
296
  *
297
- * @since 3.0.6
298
  *
299
- * @uses wp_enqueue_script
300
- * @uses wp_enqueue_style
301
  *
302
  * @param str $hook The admin screen hook being loaded.
303
  */
9
  * Copyright (c) 2006-2015 Chad Butler
10
  * WP-Members(tm) is a trademark of butlerblog.com
11
  *
12
+ * @package WP-Members
 
13
  * @author Chad Butler
14
  * @copyright 2006-2015
15
  *
28
  */
29
 
30
 
31
+ /**
32
+ * Load dialog functions.
33
+ */
34
  include_once( WPMEM_PATH . 'admin/dialogs.php' );
35
 
36
 
37
+ /**
38
+ * Actions and Filters
39
+ */
40
  add_action( 'admin_enqueue_scripts', 'wpmem_admin_enqueue_scripts' );
41
  add_action( 'wpmem_admin_do_tab', 'wpmem_admin_do_tab' );
42
  add_action( 'wp_ajax_wpmem_a_field_reorder', 'wpmem_a_do_field_reorder' );
48
  * Calls the function to reorder fields.
49
  *
50
  * @since 2.8.0
 
 
51
  */
52
+ function wpmem_a_do_field_reorder() {
53
+ /**
54
+ * Load the fields tab functions.
55
+ */
56
  include_once( WPMEM_PATH . 'admin/tab-fields.php' );
57
+
58
+ // Reorder registration fields.
59
  wpmem_a_field_reorder();
60
  }
61
 
63
  /**
64
  * Filter to add link to settings from plugin panel.
65
  *
66
+ * @since 2.4.0
67
  *
68
  * @param array $links
69
  * @param string $file
 
70
  * @return array $links
71
  */
72
  function wpmem_admin_plugin_links( $links, $file ) {
73
  static $wpmem_plugin;
74
  if ( ! $wpmem_plugin ) {
75
+ $wpmem_plugin = plugin_basename( WPMEM_PATH . '/wp-members.php' );
76
  }
77
  if ( $file == $wpmem_plugin ) {
78
  $settings_link = '<a href="options-general.php?page=wpmem-settings">' . __( 'Settings', 'wp-members' ) . '</a>';
87
  *
88
  * @since 2.5.1
89
  * @deprecated 3.0.6
 
 
 
90
  */
91
  function wpmem_load_admin_js() {
92
  // Queue up admin ajax and styles.
98
  /**
99
  * Creates the captcha tab.
100
  *
101
+ * @since 2.8.0
102
  *
103
+ * @param string $tab The admin tab being displayed.
104
+ * @return string|bool The captcha options tab, otherwise false.
105
  */
106
  function wpmem_a_captcha_tab( $tab ) {
107
+ if ( $tab == 'captcha' ) {
108
+ /**
109
+ * Load the captcha tab functions.
110
+ */
111
+ include_once( WPMEM_PATH . 'admin/tab-captcha.php' );
112
+ // Render the captcha tab.
113
+ return wpmem_a_build_captcha_options();
114
+ } else {
115
+ return false;
116
+ }
117
  }
118
 
119
 
120
  /**
121
  * Adds the captcha tab.
122
  *
123
+ * @since 2.8.0
124
  *
125
  * @param array $tabs The array of tabs for the admin panel.
126
  * @return array The updated array of tabs for the admin panel.
133
  /**
134
  * Primary admin function.
135
  *
136
+ * @since 2.1.0
137
+ *
138
+ * @global object $wpmem The WP_Members object.
139
  */
140
  function wpmem_admin() {
141
 
154
  <?php
155
  $tab = ( isset( $_GET['tab'] ) ) ? $_GET['tab'] : 'options';
156
 
157
+ // Render the tab being displayed.
158
  wpmem_admin_tabs( $tab );
159
+
160
+ // Render any warning messages.
161
  wpmem_a_do_warnings( $did_update );
162
 
163
  /**
167
  * additional admin tabs. This action is for adding content for
168
  * a custom tab.
169
  *
170
+ * @since 2.8.0
171
  *
172
  * @param string $tab The tab being generated.
173
  */
181
 
182
  /**
183
  * Displays the content for default tabs.
184
+ *
185
+ * While this function displays only the default tabs (options, fields, emails
186
+ * and dialogs), custom tabs can be added via the action hook wpmem_admin_do_tab
187
+ * in the wpmem_admin() function.
188
  *
189
+ * @since 2.8.0
190
  *
191
  * @param string $tab The tab that we are on and displaying.
192
  */
217
  /**
218
  * Assemble the tabs for the admin panel.
219
  *
220
+ * Creates the defaults tabs array (options, fields, dialogs, emails) that
221
+ * can be extended for custom admin tabs with the wpmem_admin_tabs filter.
222
+ *
223
+ * @since 2.8.0
224
  *
225
  * @param string $current The tab that we are on.
226
  */
259
  /**
260
  * Handles the various update actions for the default tabs.
261
  *
262
+ * @since 2.8.0
263
  *
264
+ * @param string $action The action that is being done.
265
+ * @return string $did_update The update message result.
266
  */
267
  function wpmem_admin_action( $action ) {
268
 
270
  switch ( $action ) {
271
 
272
  case 'update_settings':
273
+ /**
274
+ * Load Options tab functions.
275
+ */
276
  include_once( WPMEM_PATH . 'admin/tab-options.php' );
277
  $did_update = wpmem_update_options();
278
  break;
280
  case 'update_fields':
281
  case 'add_field':
282
  case 'edit_field':
283
+ /**
284
+ * Load Fields tab functions.
285
+ */
286
  include_once( WPMEM_PATH . 'admin/tab-fields.php' );
287
  $did_update = wpmem_update_fields( $action );
288
  break;
289
 
290
  case 'update_dialogs':
291
+ /**
292
+ * Load Dialogs tab functions.
293
+ */
294
  include_once( WPMEM_PATH . 'admin/tab-dialogs.php' );
295
  $did_update = wpmem_update_dialogs();
296
  break;
297
 
298
  case 'update_emails':
299
+ /**
300
+ * Load Emails tab functions.
301
+ */
302
  include_once( WPMEM_PATH . 'admin/tab-emails.php' );
303
  $did_update = wpmem_update_emails();
304
  break;
305
 
306
  case 'update_captcha':
307
+ /**
308
+ * Load Captcha tab functions.
309
+ */
310
  include_once( WPMEM_PATH . 'admin/tab-captcha.php' );
311
  $did_update = wpmem_update_captcha();
312
  break;
322
  * @since 2.9.1
323
  */
324
  function wpmem_admin_add_new_user() {
325
+ /**
326
+ * Load WP native registration functions.
327
+ */
328
  include_once( WPMEM_PATH . 'inc/wp-registration.php' );
329
+ // Output the custom registration fields.
330
  echo wpmem_do_wp_newuser_form();
331
  return;
332
  }
335
  /**
336
  * Enqueues the admin javascript and css files.
337
  *
338
+ * Only loads the js and css on admin screens that use them.
339
  *
340
+ * @since 3.0.6
 
341
  *
342
  * @param str $hook The admin screen hook being loaded.
343
  */
admin/tab-fields.php CHANGED
@@ -535,7 +535,7 @@ function wpmem_a_field_table( $wpmem_fields ) {
535
  <?php echo ( ( $wpmem_ut_fields ) && ( in_array( 'Registration IP', $wpmem_ut_fields ) ) ) ? 'checked' : false; ?> />
536
  </td>
537
  </tr>
538
- <?php if ( $wpmem->use_exp == 1 ) { ?>
539
  <tr class="nodrag nodrop">
540
  <td>&nbsp;</td>
541
  <td><i>Subscription Type</i></td>
535
  <?php echo ( ( $wpmem_ut_fields ) && ( in_array( 'Registration IP', $wpmem_ut_fields ) ) ) ? 'checked' : false; ?> />
536
  </td>
537
  </tr>
538
+ <?php if ( defined( 'WPMEM_EXP_MODULE' ) && $wpmem->use_exp == 1 ) { ?>
539
  <tr class="nodrag nodrop">
540
  <td>&nbsp;</td>
541
  <td><i>Subscription Type</i></td>
admin/user-export.php CHANGED
@@ -74,7 +74,7 @@ function wpmem_export_users( $args, $users = null ) {
74
  }
75
 
76
  $hrow .= ( $wpmem->mod_reg == 1 ) ? __( 'Activated?', 'wp-members' ) . "," : '';
77
- $hrow .= ( $wpmem->use_exp == 1 ) ? __( 'Subscription', 'wp-members' ) . "," . __( 'Expires', 'wp-members' ) . "," : '';
78
 
79
  $hrow .= __( 'Registered', 'wp-members' ) . ",";
80
  $hrow .= __( 'IP', 'wp-members' );
@@ -110,8 +110,8 @@ function wpmem_export_users( $args, $users = null ) {
110
  }
111
 
112
  $data .= ( $wpmem->mod_reg == 1 ) ? '"' . ( get_user_meta( $user, 'active', 1 ) ? __( 'Yes' ) : __( 'No' ) ) . '",' : '';
113
- $data .= ( $wpmem->use_exp == 1 ) ? '"' . get_user_meta( $user, "exp_type", true ) . '",' : '';
114
- $data .= ( $wpmem->use_exp == 1 ) ? '"' . get_user_meta( $user, "expires", true ) . '",' : '';
115
 
116
  $data .= '"' . $user_info->user_registered . '",';
117
  $data .= '"' . get_user_meta( $user, "wpmem_reg_ip", true ). '"';
74
  }
75
 
76
  $hrow .= ( $wpmem->mod_reg == 1 ) ? __( 'Activated?', 'wp-members' ) . "," : '';
77
+ $hrow .= ( defined( 'WPMEM_EXP_MODULE' ) && $wpmem->use_exp == 1 ) ? __( 'Subscription', 'wp-members' ) . "," . __( 'Expires', 'wp-members' ) . "," : '';
78
 
79
  $hrow .= __( 'Registered', 'wp-members' ) . ",";
80
  $hrow .= __( 'IP', 'wp-members' );
110
  }
111
 
112
  $data .= ( $wpmem->mod_reg == 1 ) ? '"' . ( get_user_meta( $user, 'active', 1 ) ? __( 'Yes' ) : __( 'No' ) ) . '",' : '';
113
+ $data .= ( defined( 'WPMEM_EXP_MODULE' ) && $wpmem->use_exp == 1 ) ? '"' . get_user_meta( $user, "exp_type", true ) . '",' : '';
114
+ $data .= ( defined( 'WPMEM_EXP_MODULE' ) && $wpmem->use_exp == 1 ) ? '"' . get_user_meta( $user, "expires", true ) . '",' : '';
115
 
116
  $data .= '"' . $user_info->user_registered . '",';
117
  $data .= '"' . get_user_meta( $user, "wpmem_reg_ip", true ). '"';
admin/user-profile.php CHANGED
@@ -135,7 +135,7 @@ function wpmem_admin_fields() {
135
  * If registration is moderated, this doesn't show
136
  * if user is not active yet.
137
  */
138
- if ( $wpmem->use_exp == 1 ) {
139
  if ( ( $wpmem->mod_reg == 1 && get_user_meta( $user_id, 'active', true ) == 1 ) || ( $wpmem->mod_reg != 1 ) ) {
140
  wpmem_a_extenduser( $user_id );
141
  }
@@ -222,7 +222,7 @@ function wpmem_admin_update() {
222
  }
223
  }
224
 
225
- ( $wpmem->use_exp == 1 ) ? wpmem_a_extend_user( $user_id ) : '';
226
 
227
  /**
228
  * Fires after the user profile is updated.
135
  * If registration is moderated, this doesn't show
136
  * if user is not active yet.
137
  */
138
+ if ( defined( 'WPMEM_EXP_MODULE' ) && $wpmem->use_exp == 1 ) {
139
  if ( ( $wpmem->mod_reg == 1 && get_user_meta( $user_id, 'active', true ) == 1 ) || ( $wpmem->mod_reg != 1 ) ) {
140
  wpmem_a_extenduser( $user_id );
141
  }
222
  }
223
  }
224
 
225
+ ( defined( 'WPMEM_EXP_MODULE' ) && $wpmem->use_exp == 1 ) ? wpmem_a_extend_user( $user_id ) : '';
226
 
227
  /**
228
  * Fires after the user profile is updated.
admin/users.php CHANGED
@@ -238,13 +238,13 @@ function wpmem_users_views( $views ) {
238
  global $wpmem;
239
 
240
  $arr = array();
241
- if ( $wpmem->use_exp == 1 ) {
242
  $arr[] = 'Pending';
243
  }
244
  if ( $wpmem->use_trial == 1 ) {
245
  $arr[] = 'Trial';
246
  }
247
- if ( $wpmem->use_exp == 1 ) {
248
  $arr[] = 'Subscription';
249
  $arr[] = 'Expired';
250
  }
238
  global $wpmem;
239
 
240
  $arr = array();
241
+ if ( defined( 'WPMEM_EXP_MODULE' ) && $wpmem->use_exp == 1 ) {
242
  $arr[] = 'Pending';
243
  }
244
  if ( $wpmem->use_trial == 1 ) {
245
  $arr[] = 'Trial';
246
  }
247
+ if ( defined( 'WPMEM_EXP_MODULE' ) && $wpmem->use_exp == 1 ) {
248
  $arr[] = 'Subscription';
249
  $arr[] = 'Expired';
250
  }
inc/class-wp-members.php CHANGED
@@ -1,9 +1,16 @@
1
  <?php
2
  /**
3
- * The WP-Members Class.
4
  *
5
- * @since 3.0
 
 
 
 
 
 
6
  */
 
7
  class WP_Members {
8
 
9
  /**
@@ -17,6 +24,7 @@ class WP_Members {
17
  * Filter the options before they are loaded into constants.
18
  *
19
  * @since 2.9.0
 
20
  *
21
  * @param array $this->settings An array of the WP-Members settings.
22
  */
@@ -25,7 +33,11 @@ class WP_Members {
25
  // Validate that v3 settings are loaded.
26
  if ( ! isset( $settings['version'] ) ) {
27
  // If settings were not properly built during plugin upgrade.
 
 
 
28
  require_once( WPMEM_PATH . 'wp-members-install.php' );
 
29
  $settings = apply_filters( 'wpmem_settings', wpmem_update_settings() );
30
  }
31
 
@@ -45,13 +57,18 @@ class WP_Members {
45
  */
46
  function load_shortcodes() {
47
 
 
 
 
48
  require_once( WPMEM_PATH . 'inc/shortcodes.php' );
 
49
  add_shortcode( 'wp-members', 'wpmem_shortcode' );
50
  add_shortcode( 'wpmem_field', 'wpmem_shortcode' );
51
  add_shortcode( 'wpmem_logged_in', 'wpmem_sc_logged_in' );
52
  add_shortcode( 'wpmem_logged_out', 'wpmem_sc_logged_out' );
53
  add_shortcode( 'wpmem_logout', 'wpmem_shortcode' );
54
  add_shortcode( 'wpmem_form', 'wpmem_sc_forms' );
 
55
 
56
  /**
57
  * Fires after shortcodes load (for adding additional custom shortcodes).
@@ -131,7 +148,7 @@ class WP_Members {
131
  /**
132
  * Loads pre-3.0 constants (included primarily for add-on compatibility).
133
  *
134
- * @since 3.0
135
  */
136
  function load_constants() {
137
  ( ! defined( 'WPMEM_BLOCK_POSTS' ) ) ? define( 'WPMEM_BLOCK_POSTS', $this->block['post'] ) : '';
@@ -156,6 +173,8 @@ class WP_Members {
156
  * Gets the requested action.
157
  *
158
  * @since 3.0.0
 
 
159
  */
160
  function get_action() {
161
 
@@ -175,6 +194,8 @@ class WP_Members {
175
  *
176
  * @since 3.0.0
177
  *
 
 
178
  * @param string $action The action being done.
179
  * @return string The regchk value.
180
  *
@@ -237,7 +258,9 @@ class WP_Members {
237
  * This function was originally stand alone in the core file and
238
  * was moved to the WP_Members class in 3.0.
239
  *
240
- * @since 3.0
 
 
241
  *
242
  * @return bool $block true|false
243
  */
@@ -308,11 +331,11 @@ class WP_Members {
308
  * This is the primary function that picks up where get_action() leaves off.
309
  * Determines whether content is shown or hidden for both post and pages.
310
  *
311
- * @since 3.0
312
  *
313
  * @global string $wpmem_themsg Contains messages to be output.
314
- * @global string $wpmem_captcha_err Contains error message for reCAPTCHA.
315
- * @global object $post The post object.
316
  * @param string $content
317
  * @return string $content
318
  */
@@ -416,14 +439,40 @@ class WP_Members {
416
  }
417
 
418
  /**
419
- * Returns the registration fields.
420
  *
421
  * @since 3.0.0
422
- *
423
- * @return array The registration fields.
424
  */
425
  function load_fields() {
426
  $this->fields = get_option( 'wpmembers_fields' );
427
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
428
 
429
  }
1
  <?php
2
  /**
3
+ * The WP_Members Class.
4
  *
5
+ * This is the main WP_Members object class. This class contains functions
6
+ * for loading settings, shortcodes, hooks to WP, plugin dropins, constants,
7
+ * and registration fields. It also manages whether content should be blocked.
8
+ *
9
+ * @package WP-Members
10
+ * @subpackage WP_Members Object Class
11
+ * @since 3.0.0
12
  */
13
+
14
  class WP_Members {
15
 
16
  /**
24
  * Filter the options before they are loaded into constants.
25
  *
26
  * @since 2.9.0
27
+ * @since 3.0.0 Moved to the WP_Members class.
28
  *
29
  * @param array $this->settings An array of the WP-Members settings.
30
  */
33
  // Validate that v3 settings are loaded.
34
  if ( ! isset( $settings['version'] ) ) {
35
  // If settings were not properly built during plugin upgrade.
36
+ /**
37
+ * Load installation routine.
38
+ */
39
  require_once( WPMEM_PATH . 'wp-members-install.php' );
40
+ // Update settings for 3.x
41
  $settings = apply_filters( 'wpmem_settings', wpmem_update_settings() );
42
  }
43
 
57
  */
58
  function load_shortcodes() {
59
 
60
+ /**
61
+ * Load the shortcode functions.
62
+ */
63
  require_once( WPMEM_PATH . 'inc/shortcodes.php' );
64
+
65
  add_shortcode( 'wp-members', 'wpmem_shortcode' );
66
  add_shortcode( 'wpmem_field', 'wpmem_shortcode' );
67
  add_shortcode( 'wpmem_logged_in', 'wpmem_sc_logged_in' );
68
  add_shortcode( 'wpmem_logged_out', 'wpmem_sc_logged_out' );
69
  add_shortcode( 'wpmem_logout', 'wpmem_shortcode' );
70
  add_shortcode( 'wpmem_form', 'wpmem_sc_forms' );
71
+ add_shortcode( 'wpmem_show_count', 'wpmem_sc_user_count' );
72
 
73
  /**
74
  * Fires after shortcodes load (for adding additional custom shortcodes).
148
  /**
149
  * Loads pre-3.0 constants (included primarily for add-on compatibility).
150
  *
151
+ * @since 3.0.0
152
  */
153
  function load_constants() {
154
  ( ! defined( 'WPMEM_BLOCK_POSTS' ) ) ? define( 'WPMEM_BLOCK_POSTS', $this->block['post'] ) : '';
173
  * Gets the requested action.
174
  *
175
  * @since 3.0.0
176
+ *
177
+ * @global string $wpmem_a The WP-Members action variable.
178
  */
179
  function get_action() {
180
 
194
  *
195
  * @since 3.0.0
196
  *
197
+ * @global string $wpmem_a The WP-Members action variable.
198
+ *
199
  * @param string $action The action being done.
200
  * @return string The regchk value.
201
  *
258
  * This function was originally stand alone in the core file and
259
  * was moved to the WP_Members class in 3.0.
260
  *
261
+ * @since 3.0.0
262
+ *
263
+ * @global object $post The WordPress Post object.
264
  *
265
  * @return bool $block true|false
266
  */
331
  * This is the primary function that picks up where get_action() leaves off.
332
  * Determines whether content is shown or hidden for both post and pages.
333
  *
334
+ * @since 3.0.0
335
  *
336
  * @global string $wpmem_themsg Contains messages to be output.
337
+ * @global object $post The WordPress Post object.
338
+ *
339
  * @param string $content
340
  * @return string $content
341
  */
439
  }
440
 
441
  /**
442
+ * Sets the registration fields.
443
  *
444
  * @since 3.0.0
 
 
445
  */
446
  function load_fields() {
447
  $this->fields = get_option( 'wpmembers_fields' );
448
  }
449
+
450
+ /**
451
+ * Get excluded meta fields.
452
+ *
453
+ * @since Unknown
454
+ *
455
+ * @param string $tag A tag so we know where the function is being used.
456
+ * @return array The excluded fields.
457
+ */
458
+ function excluded_fields( $tag ) {
459
+
460
+ // Default excluded fields.
461
+ $excluded_fields = array( 'password', 'confirm_password', 'confirm_email', 'password_confirm', 'email_confirm' );
462
+
463
+ /**
464
+ * Filter the fields to be excluded when user is created/updated.
465
+ *
466
+ * @since 2.9.3
467
+ * @since Unknown Moved to new method in WP_Members Class.
468
+ *
469
+ * @param array An array of the field meta names to exclude.
470
+ * @param string $tag A tag so we know where the function is being used.
471
+ */
472
+ $excluded_fields = apply_filters( 'wpmem_exclude_fields', $excluded_fields, $tag );
473
+
474
+ // Return excluded fields.
475
+ return $excluded_fields;
476
+ }
477
 
478
  }
inc/core.php CHANGED
@@ -10,14 +10,15 @@
10
  * Copyright (c) 2006-2015 Chad Butler
11
  * WP-Members(tm) is a trademark of butlerblog.com
12
  *
13
- * @package WordPress
14
- * @subpackage WP-Members
15
- * @author Chad Butler
16
  * @copyright 2006-2015
17
  */
18
 
19
 
20
- // Include utility functions.
 
 
21
  require_once( WPMEM_PATH . 'inc/utilities.php' );
22
 
23
 
@@ -25,9 +26,12 @@ require_once( WPMEM_PATH . 'inc/utilities.php' );
25
  * The Main Action Function.
26
  *
27
  * Does actions required at initialization prior to headers being sent.
28
- * Since 3.0, this function is a wrapper for get_action().
 
 
 
29
  *
30
- * @since 0.1
31
  */
32
  function wpmem() {
33
  global $wpmem;
@@ -41,13 +45,15 @@ if ( ! function_exists( 'wpmem_securify' ) ):
41
  *
42
  * This is the primary function that picks up where wpmem() leaves off.
43
  * Determines whether content is shown or hidden for both post and pages.
44
- * Since 3.0, this function is a wrapper for do_securify().
45
  *
46
- * @since 2.0
 
47
  *
48
- * @global object $wpmem
49
- * @param string $content
50
- * @return string $content
 
51
  */
52
  function wpmem_securify( $content = null ) {
53
  global $wpmem;
@@ -58,13 +64,14 @@ endif;
58
 
59
  if ( ! function_exists( 'wpmem_block' ) ):
60
  /**
61
- * Determines if content should be blocked.
62
  *
63
- * Since 3.0, this function is a wrapper for is_blocked().
 
64
  *
65
- * @since 2.6
66
  *
67
- * @return bool $block true|false
68
  */
69
  function wpmem_block() {
70
  global $wpmem;
@@ -79,11 +86,10 @@ if ( ! function_exists( 'wpmem_check_activated' ) ):
79
  *
80
  * @since 2.7.1
81
  *
82
- * @uses wp_check_password
83
- * @param int $user
84
- * @param string $username
85
- * @param string $password
86
- * @return int $user
87
  */
88
  function wpmem_check_activated( $user, $username, $password ) {
89
 
@@ -114,12 +120,12 @@ if ( ! function_exists( 'wpmem_login' ) ):
114
  * successful, it will set a cookie using wp_set_auth_cookie (since 2.7.7),
115
  * then it redirects and exits; otherwise "loginfailed" is returned.
116
  *
117
- * @since 0.1
 
 
 
118
  *
119
- * @uses wp_signon
120
- * @uses wp_set_auth_cookie
121
- * @uses wp_redirect Redirects to $redirect_to if login is successful.
122
- * @return string Returns "loginfailed" if the login fails.
123
  */
124
  function wpmem_login() {
125
 
@@ -183,12 +189,8 @@ if ( ! function_exists( 'wpmem_logout' ) ):
183
  /**
184
  * Logs the user out then redirects.
185
  *
186
- * @since 2.0
187
  *
188
- * @uses wp_clearcookie
189
- * @uses wp_logout
190
- * @uses nocache_headers
191
- * @uses wp_redirect
192
  * @param string $redirect_to The URL to redirect to at logout.
193
  */
194
  function wpmem_logout( $redirect_to = null ) {
@@ -207,7 +209,7 @@ function wpmem_logout( $redirect_to = null ) {
207
 
208
  wp_clear_auth_cookie();
209
 
210
- // This action is defined in /wp-includes/pluggable.php.
211
  do_action( 'wp_logout' );
212
 
213
  nocache_headers();
@@ -220,17 +222,20 @@ endif;
220
 
221
  if ( ! function_exists( 'wpmem_login_status' ) ):
222
  /**
223
- * Displays the user's login status.
224
  *
225
- * @since 2.0
226
  *
227
- * @uses wpmem_inc_memberlinks()
228
- * @param boolean $echo Determines whether function should print result or not (default: true).
229
- * @return string $status The user status string produced by wpmem_inc_memberlinks().
230
  */
231
  function wpmem_login_status( $echo = true ) {
232
 
233
- include_once( WPMEM_PATH . 'inc/dialogs.php' );
 
 
 
 
234
  if ( is_user_logged_in() ) {
235
  $status = wpmem_inc_memberlinks( 'status' );
236
  if ( $echo ) {
@@ -248,12 +253,16 @@ if ( ! function_exists( 'wpmem_inc_sidebar' ) ):
248
  *
249
  * This function is a wrapper for wpmem_do_sidebar().
250
  *
251
- * @since 2.0
252
  *
253
- * @uses wpmem_do_sidebar()
254
  */
255
  function wpmem_inc_sidebar() {
 
 
 
256
  include_once( WPMEM_PATH . 'inc/sidebar.php' );
 
257
  wpmem_do_sidebar();
258
  }
259
  endif;
@@ -261,15 +270,23 @@ endif;
261
 
262
  if ( ! function_exists( 'widget_wpmemwidget_init' ) ):
263
  /**
264
- * Initializes the widget.
265
  *
266
- * @since 2.0
267
- *
268
- * @uses register_widget
269
  */
270
  function widget_wpmemwidget_init() {
271
- include_once( WPMEM_PATH . 'inc/class-wp-members-widget.php' );
272
- include_once( WPMEM_PATH . 'inc/sidebar.php' );
 
 
 
 
 
 
 
 
 
 
273
  register_widget( 'widget_wpmemwidget' );
274
  }
275
  endif;
@@ -279,10 +296,11 @@ if ( ! function_exists( 'wpmem_change_password' ) ):
279
  /**
280
  * Handles user password change (not reset).
281
  *
282
- * @since 2.1
283
  *
284
- * @global $user_ID
285
- * @return string the value for $wpmem->regchk
 
286
  */
287
  function wpmem_change_password() {
288
 
@@ -308,6 +326,7 @@ function wpmem_change_password() {
308
  * Fires after password change.
309
  *
310
  * @since 2.9.0
 
311
  *
312
  * @param int $user_ID The user's numeric ID.
313
  * @param string $pass1 The user's new plain text password.
@@ -327,11 +346,11 @@ if ( ! function_exists( 'wpmem_reset_password' ) ):
327
  /**
328
  * Resets a forgotten password.
329
  *
330
- * @since 2.1
 
 
331
  *
332
- * @uses wp_generate_password
333
- * @uses wp_update_user
334
- * @return string value for $wpmem->regchk
335
  */
336
  function wpmem_reset_password() {
337
 
@@ -374,14 +393,19 @@ function wpmem_reset_password() {
374
  // Update the users password.
375
  wp_update_user( array ( 'ID' => $user->ID, 'user_pass' => $new_pass ) );
376
 
377
- // Send it in an email.
 
 
378
  require_once( WPMEM_PATH . 'inc/email.php' );
 
 
379
  wpmem_inc_regemail( $user->ID, $new_pass, 3 );
380
 
381
  /**
382
  * Fires after password reset.
383
  *
384
  * @since 2.9.0
 
385
  *
386
  * @param int $user_ID The user's numeric ID.
387
  * @param string $new_pass The new plain text password.
@@ -404,12 +428,11 @@ endif;
404
 
405
  if ( ! function_exists( 'wpmem_no_reset' ) ):
406
  /**
407
- * Keeps users not activated from resetting their password
408
- * via wp-login when using registration moderation.
409
  *
410
  * @since 2.5.1
411
  *
412
- * @return bool
413
  */
414
  function wpmem_no_reset() {
415
 
@@ -422,7 +445,7 @@ function wpmem_no_reset() {
422
  $user = get_user_by( 'login', $username );
423
  }
424
 
425
- if ( $wmem->mod_reg == 1 ) {
426
  if ( get_user_meta( $user->ID, 'active', true ) != 1 ) {
427
  return false;
428
  }
@@ -439,7 +462,10 @@ endif;
439
  * @since 2.8.3
440
  */
441
  function wpmem_wp_register_form() {
442
- include_once( WPMEM_PATH . 'inc/wp-registration.php' );
 
 
 
443
  wpmem_do_wp_register_form();
444
  }
445
 
@@ -449,24 +475,28 @@ function wpmem_wp_register_form() {
449
  *
450
  * @since 2.8.3
451
  *
452
- * @param $errors
453
- * @param $sanatized_user_login
454
- * @param $user_email
455
- * @return $errors
 
 
456
  */
457
  function wpmem_wp_reg_validate( $errors, $sanitized_user_login, $user_email ) {
458
 
459
  global $wpmem;
460
- $wpmem_fields = $wpmem->fields; //get_option( 'wpmembers_fields' );
 
 
461
  $exclude = wpmem_get_excluded_meta( 'register' );
462
 
463
- foreach ( $wpmem_fields as $field ) {
464
  $is_error = false;
465
  if ( $field[5] == 'y' && $field[2] != 'user_email' && ! in_array( $field[2], $exclude ) ) {
466
- if ( ( $field[3] == 'checkbox' ) && ( ! isset( $_POST[$field[2]] ) ) ) {
467
  $is_error = true;
468
  }
469
- if ( ( $field[3] != 'checkbox' ) && ( ! $_POST[$field[2]] ) ) {
470
  $is_error = true;
471
  }
472
  if ( $is_error ) { $errors->add( 'wpmem_error', sprintf( __('Sorry, %s is a required field.', 'wp-members'), $field[1] ) ); }
@@ -482,7 +512,9 @@ function wpmem_wp_reg_validate( $errors, $sanitized_user_login, $user_email ) {
482
  *
483
  * @since 2.8.3
484
  *
485
- * @param $user_id
 
 
486
  */
487
  function wpmem_wp_reg_finalize( $user_id ) {
488
 
@@ -490,13 +522,12 @@ function wpmem_wp_reg_finalize( $user_id ) {
490
  $native_reg = ( isset( $_POST['wp-submit'] ) && $_POST['wp-submit'] == esc_attr( __( 'Register' ) ) ) ? true : false;
491
  $add_new = ( isset( $_POST['action'] ) && $_POST['action'] == 'createuser' ) ? true : false;
492
  if ( $native_reg || $add_new ) {
493
- // Get the fields.
494
- $wpmem_fields = $wpmem->fields; //get_option( 'wpmembers_fields' );
495
  // Get any excluded meta fields.
 
496
  $exclude = wpmem_get_excluded_meta( 'register' );
497
- foreach ( $wpmem_fields as $meta ) {
498
- if ( isset( $_POST[$meta[2]] ) && ! in_array( $meta[2], $exclude ) ) {
499
- update_user_meta( $user_id, $meta[2], sanitize_text_field( $_POST[$meta[2]] ) );
500
  }
501
  }
502
  }
@@ -510,6 +541,7 @@ function wpmem_wp_reg_finalize( $user_id ) {
510
  * @since 2.8.7
511
  */
512
  function wpmem_wplogin_stylesheet() {
 
513
  echo '<link rel="stylesheet" id="custom_wp_admin_css" href="' . WPMEM_DIR . 'css/wp-login.css" type="text/css" media="all" />';
514
  }
515
 
@@ -518,27 +550,28 @@ function wpmem_wplogin_stylesheet() {
518
  * Securifies the comments.
519
  *
520
  * If the user is not logged in and the content is blocked
521
- * (i.e. wpmem_block() returns true), function loads a
522
  * dummy/empty comments template.
523
  *
524
  * @since 2.9.9
525
  *
526
- * @return bool $open Whether the current post is open for comments.
527
  */
528
  function wpmem_securify_comments( $open ) {
529
 
530
  $open = ( ! is_user_logged_in() && wpmem_block() ) ? false : $open;
531
-
532
  /**
533
  * Filters whether comments are open or not.
534
  *
535
  * @since 3.0.0
536
  *
537
- * @param bool $open Whether the current post is open for comments.
538
  */
539
  $open = apply_filters( 'wpmem_securify_comments', $open );
540
-
541
  if ( ! $open ) {
 
542
  add_filter( 'comments_array' , 'wpmem_securify_comments_array' , 10, 2 );
543
  }
544
 
@@ -551,6 +584,8 @@ function wpmem_securify_comments( $open ) {
551
  *
552
  * @since 3.0.1
553
  *
 
 
554
  * @return array $comments The comments array.
555
  */
556
  function wpmem_securify_comments_array( $comments , $post_id ) {
@@ -564,12 +599,16 @@ function wpmem_securify_comments_array( $comments , $post_id ) {
564
  * Redirects a user to defined login page with return redirect.
565
  *
566
  * @since 3.0.2
 
 
 
 
567
  */
568
  function wpmem_redirect_to_login() {
569
 
570
  global $wp, $post, $wpmem;
571
 
572
- if( ! is_user_logged_in() && $wpmem->is_blocked() ) {
573
 
574
  // Get current page location.
575
  $current_page = home_url( add_query_arg( array(), $wp->request ) );
@@ -584,4 +623,4 @@ function wpmem_redirect_to_login() {
584
  }
585
 
586
 
587
- // End of File.
10
  * Copyright (c) 2006-2015 Chad Butler
11
  * WP-Members(tm) is a trademark of butlerblog.com
12
  *
13
+ * @package WP-Members
14
+ * @author Chad Butler
 
15
  * @copyright 2006-2015
16
  */
17
 
18
 
19
+ /**
20
+ * Load utility functions.
21
+ */
22
  require_once( WPMEM_PATH . 'inc/utilities.php' );
23
 
24
 
26
  * The Main Action Function.
27
  *
28
  * Does actions required at initialization prior to headers being sent.
29
+ * Since 3.0, this function is a wrapper for $wpmem->get_action().
30
+ *
31
+ * @since 0.1.0
32
+ * @since 3.0.0 Now a wrapper for $wpmem->get_action().
33
  *
34
+ * @global object $wpmem The WP-Members object class.
35
  */
36
  function wpmem() {
37
  global $wpmem;
45
  *
46
  * This is the primary function that picks up where wpmem() leaves off.
47
  * Determines whether content is shown or hidden for both post and pages.
48
+ * Since 3.0, this function is a wrapper for $wpmem->do_securify().
49
  *
50
+ * @since 2.0.0
51
+ * @since 3.0.0 Now a wrapper for $wpmem->do_securify().
52
  *
53
+ * @global object $wpmem The WP-Members object class.
54
+ *
55
+ * @param string $content Content of the current post.
56
+ * @return string $content Content of the current post or replaced content if post is blocked and user is not logged in.
57
  */
58
  function wpmem_securify( $content = null ) {
59
  global $wpmem;
64
 
65
  if ( ! function_exists( 'wpmem_block' ) ):
66
  /**
67
+ * Determines if content is blocked.
68
  *
69
+ * @since 2.6.0
70
+ * @since 3.0.0 Now a wrapper for $wpmem->is_blocked().
71
  *
72
+ * @global object $wpmem The WP-Members object class.
73
  *
74
+ * @return bool $block true if content is blocked, false otherwise.
75
  */
76
  function wpmem_block() {
77
  global $wpmem;
86
  *
87
  * @since 2.7.1
88
  *
89
+ * @param object $user The WordPress User object.
90
+ * @param string $username The user's username (user_login).
91
+ * @param string $password The user's password.
92
+ * @return object $user The WordPress User object.
 
93
  */
94
  function wpmem_check_activated( $user, $username, $password ) {
95
 
120
  * successful, it will set a cookie using wp_set_auth_cookie (since 2.7.7),
121
  * then it redirects and exits; otherwise "loginfailed" is returned.
122
  *
123
+ * @since 0.1.0
124
+ * @since 2.5.2 Now uses wp_signon().
125
+ * @since 2.7.7 Sets cookie using wp_set_auth_cookie().
126
+ * @since 3.0.0 Removed wp_set_auth_cookie(), this already happens in wp_signon().
127
  *
128
+ * @return string Returns "loginfailed" if the login fails.
 
 
 
129
  */
130
  function wpmem_login() {
131
 
189
  /**
190
  * Logs the user out then redirects.
191
  *
192
+ * @since 2.0.0
193
  *
 
 
 
 
194
  * @param string $redirect_to The URL to redirect to at logout.
195
  */
196
  function wpmem_logout( $redirect_to = null ) {
209
 
210
  wp_clear_auth_cookie();
211
 
212
+ /** This action is defined in /wp-includes/pluggable.php. */
213
  do_action( 'wp_logout' );
214
 
215
  nocache_headers();
222
 
223
  if ( ! function_exists( 'wpmem_login_status' ) ):
224
  /**
225
+ * Returns or displays the user's login status.
226
  *
227
+ * @since 2.0.0
228
  *
229
+ * @param boolean $echo Determines whether function should print result or not (default: true).
230
+ * @return string $status The user status string produced by wpmem_inc_memberlinks().
 
231
  */
232
  function wpmem_login_status( $echo = true ) {
233
 
234
+ /**
235
+ * Load the dialogs functions.
236
+ */
237
+ require_once( WPMEM_PATH . 'inc/dialogs.php' );
238
+
239
  if ( is_user_logged_in() ) {
240
  $status = wpmem_inc_memberlinks( 'status' );
241
  if ( $echo ) {
253
  *
254
  * This function is a wrapper for wpmem_do_sidebar().
255
  *
256
+ * @since 2.0.0
257
  *
258
+ * @todo This function may be deprecated.
259
  */
260
  function wpmem_inc_sidebar() {
261
+ /**
262
+ * Load the sidebar functions.
263
+ */
264
  include_once( WPMEM_PATH . 'inc/sidebar.php' );
265
+ // Render the sidebar.
266
  wpmem_do_sidebar();
267
  }
268
  endif;
270
 
271
  if ( ! function_exists( 'widget_wpmemwidget_init' ) ):
272
  /**
273
+ * Initializes the WP-Members widget.
274
  *
275
+ * @since 2.0.0
 
 
276
  */
277
  function widget_wpmemwidget_init() {
278
+
279
+ /**
280
+ * Load the WP-Members widget class.
281
+ */
282
+ require_once( WPMEM_PATH . 'inc/class-wp-members-widget.php' );
283
+
284
+ /**
285
+ * Load the sidebar functions.
286
+ */
287
+ require_once( WPMEM_PATH . 'inc/sidebar.php' );
288
+
289
+ // Register the WP-Members widget.
290
  register_widget( 'widget_wpmemwidget' );
291
  }
292
  endif;
296
  /**
297
  * Handles user password change (not reset).
298
  *
299
+ * @since 2.1.0
300
  *
301
+ * @global int $user_ID The WordPress user ID.
302
+ *
303
+ * @return string The value for $wpmem->regchk
304
  */
305
  function wpmem_change_password() {
306
 
326
  * Fires after password change.
327
  *
328
  * @since 2.9.0
329
+ * @since 3.0.5 Added $pass1 to arguments passed.
330
  *
331
  * @param int $user_ID The user's numeric ID.
332
  * @param string $pass1 The user's new plain text password.
346
  /**
347
  * Resets a forgotten password.
348
  *
349
+ * @since 2.1.0
350
+ *
351
+ * @global object $wpmem The WP-Members object class.
352
  *
353
+ * @return string The value for $wpmem->regchk
 
 
354
  */
355
  function wpmem_reset_password() {
356
 
393
  // Update the users password.
394
  wp_update_user( array ( 'ID' => $user->ID, 'user_pass' => $new_pass ) );
395
 
396
+ /**
397
+ * Load the email functions.
398
+ */
399
  require_once( WPMEM_PATH . 'inc/email.php' );
400
+
401
+ // Send it in an email.
402
  wpmem_inc_regemail( $user->ID, $new_pass, 3 );
403
 
404
  /**
405
  * Fires after password reset.
406
  *
407
  * @since 2.9.0
408
+ * @since 3.0.5 Added $pass1 to arguments passed.
409
  *
410
  * @param int $user_ID The user's numeric ID.
411
  * @param string $new_pass The new plain text password.
428
 
429
  if ( ! function_exists( 'wpmem_no_reset' ) ):
430
  /**
431
+ * Prevents users not activated from resetting their password.
 
432
  *
433
  * @since 2.5.1
434
  *
435
+ * @return bool Returns false if the user is not activated, otherwise true.
436
  */
437
  function wpmem_no_reset() {
438
 
445
  $user = get_user_by( 'login', $username );
446
  }
447
 
448
+ if ( $wpmem->mod_reg == 1 ) {
449
  if ( get_user_meta( $user->ID, 'active', true ) != 1 ) {
450
  return false;
451
  }
462
  * @since 2.8.3
463
  */
464
  function wpmem_wp_register_form() {
465
+ /**
466
+ * Load native WP registration functions.
467
+ */
468
+ require_once( WPMEM_PATH . 'inc/wp-registration.php' );
469
  wpmem_do_wp_register_form();
470
  }
471
 
475
  *
476
  * @since 2.8.3
477
  *
478
+ * @global object $wpmem The WP-Members object class.
479
+ *
480
+ * @param array $errors A WP_Error object containing any errors encountered during registration.
481
+ * @param string $sanitized_user_login User's username after it has been sanitized.
482
+ * @param string $user_email User's email.
483
+ * @return array $errors A WP_Error object containing any errors encountered during registration.
484
  */
485
  function wpmem_wp_reg_validate( $errors, $sanitized_user_login, $user_email ) {
486
 
487
  global $wpmem;
488
+
489
+ // Get any meta fields that should be excluded.
490
+ // @todo This needs to change to $wpmem->excluded_fields($tag).
491
  $exclude = wpmem_get_excluded_meta( 'register' );
492
 
493
+ foreach ( $wpmem->fields as $field ) {
494
  $is_error = false;
495
  if ( $field[5] == 'y' && $field[2] != 'user_email' && ! in_array( $field[2], $exclude ) ) {
496
+ if ( ( $field[3] == 'checkbox' ) && ( ! isset( $_POST[ $field[2] ] ) ) ) {
497
  $is_error = true;
498
  }
499
+ if ( ( $field[3] != 'checkbox' ) && ( ! $_POST[ $field[2] ] ) ) {
500
  $is_error = true;
501
  }
502
  if ( $is_error ) { $errors->add( 'wpmem_error', sprintf( __('Sorry, %s is a required field.', 'wp-members'), $field[1] ) ); }
512
  *
513
  * @since 2.8.3
514
  *
515
+ * @global object $wpmem The WP-Members object class.
516
+ *
517
+ * @param int $user_id The WP user ID.
518
  */
519
  function wpmem_wp_reg_finalize( $user_id ) {
520
 
522
  $native_reg = ( isset( $_POST['wp-submit'] ) && $_POST['wp-submit'] == esc_attr( __( 'Register' ) ) ) ? true : false;
523
  $add_new = ( isset( $_POST['action'] ) && $_POST['action'] == 'createuser' ) ? true : false;
524
  if ( $native_reg || $add_new ) {
 
 
525
  // Get any excluded meta fields.
526
+ // @todo This needs to change to $wpmem->excluded_fields($tag).
527
  $exclude = wpmem_get_excluded_meta( 'register' );
528
+ foreach ( $wpmem->fields as $meta ) {
529
+ if ( isset( $_POST[ $meta[2] ] ) && ! in_array( $meta[2], $exclude ) ) {
530
+ update_user_meta( $user_id, $meta[2], sanitize_text_field( $_POST[ $meta[2] ] ) );
531
  }
532
  }
533
  }
541
  * @since 2.8.7
542
  */
543
  function wpmem_wplogin_stylesheet() {
544
+ // @todo Should this enqueue styles?
545
  echo '<link rel="stylesheet" id="custom_wp_admin_css" href="' . WPMEM_DIR . 'css/wp-login.css" type="text/css" media="all" />';
546
  }
547
 
550
  * Securifies the comments.
551
  *
552
  * If the user is not logged in and the content is blocked
553
+ * (i.e. wpmem->is_blocked() returns true), function loads a
554
  * dummy/empty comments template.
555
  *
556
  * @since 2.9.9
557
  *
558
+ * @return bool $open true if current post is open for comments, otherwise false.
559
  */
560
  function wpmem_securify_comments( $open ) {
561
 
562
  $open = ( ! is_user_logged_in() && wpmem_block() ) ? false : $open;
563
+
564
  /**
565
  * Filters whether comments are open or not.
566
  *
567
  * @since 3.0.0
568
  *
569
+ * @param bool $open true if current post is open for comments, otherwise false.
570
  */
571
  $open = apply_filters( 'wpmem_securify_comments', $open );
572
+
573
  if ( ! $open ) {
574
+ /** This filter is documented in wp-includes/comment-template.php */
575
  add_filter( 'comments_array' , 'wpmem_securify_comments_array' , 10, 2 );
576
  }
577
 
584
  *
585
  * @since 3.0.1
586
  *
587
+ * @global object $wpmem The WP-Members object class.
588
+ *
589
  * @return array $comments The comments array.
590
  */
591
  function wpmem_securify_comments_array( $comments , $post_id ) {
599
  * Redirects a user to defined login page with return redirect.
600
  *
601
  * @since 3.0.2
602
+ *
603
+ * @global object $wp The WordPress object.
604
+ * @global object $post The WordPress post object.
605
+ * @global object $wpmem The WP-Members object.
606
  */
607
  function wpmem_redirect_to_login() {
608
 
609
  global $wp, $post, $wpmem;
610
 
611
+ if ( ! is_user_logged_in() && $wpmem->is_blocked() ) {
612
 
613
  // Get current page location.
614
  $current_page = home_url( add_query_arg( array(), $wp->request ) );
623
  }
624
 
625
 
626
+ // End of file.
inc/dialogs.php CHANGED
@@ -195,7 +195,7 @@ function wpmem_inc_memberlinks( $page = 'members' ) {
195
  case 'members':
196
  $str = '<ul><li><a href="' .$link . 'a=edit">' . __( 'Edit My Information', 'wp-members' ) . '</a></li>
197
  <li><a href="' . $link . 'a=pwdchange">' . __( 'Change Password', 'wp-members' ) . '</a></li>';
198
- if ( $wpmem->use_exp == 1 && function_exists( 'wpmem_user_page_detail' ) ) { $str .= wpmem_user_page_detail(); }
199
  $str.= '</ul>';
200
  /**
201
  * Filter the links displayed on the User Profile page (logged in state).
195
  case 'members':
196
  $str = '<ul><li><a href="' .$link . 'a=edit">' . __( 'Edit My Information', 'wp-members' ) . '</a></li>
197
  <li><a href="' . $link . 'a=pwdchange">' . __( 'Change Password', 'wp-members' ) . '</a></li>';
198
+ if ( defined( 'WPMEM_EXP_MODULE' ) && $wpmem->use_exp == 1 && function_exists( 'wpmem_user_page_detail' ) ) { $str .= wpmem_user_page_detail(); }
199
  $str.= '</ul>';
200
  /**
201
  * Filter the links displayed on the User Profile page (logged in state).
inc/email.php CHANGED
@@ -81,8 +81,8 @@ function wpmem_inc_regemail( $user_id, $password, $toggle, $wpmem_fields = null,
81
  $arr['user_login'] = stripslashes( $user->user_login );
82
  $arr['user_email'] = stripslashes( $user->user_email );
83
  $arr['blogname'] = wp_specialchars_decode( get_option ( 'blogname' ), ENT_QUOTES );
84
- $arr['exp_type'] = ( $wpmem->use_exp == 1 ) ? get_user_meta( $user_id, 'exp_type', true ) : '';
85
- $arr['exp_date'] = ( $wpmem->use_exp == 1 ) ? get_user_meta( $user_id, 'expires', true ) : '';
86
  $arr['wpmem_msurl'] = $wpmem->user_pages['profile'];
87
  $arr['reg_link'] = esc_url( get_user_meta( $user_id, 'wpmem_reg_url', true ) );
88
  $arr['do_shortcodes'] = true;
@@ -280,8 +280,8 @@ function wpmem_notify_admin( $user_id, $wpmem_fields, $field_data = null ) {
280
  $arr['user_ip'] = get_user_meta( $user_id, 'wpmem_reg_ip', true );
281
  $arr['reg_link'] = esc_url( get_user_meta( $user_id, 'wpmem_reg_url', true ) );
282
  $arr['act_link'] = get_bloginfo ( 'wpurl' ) . "/wp-admin/user-edit.php?user_id=".$user_id;
283
- $arr['exp_type'] = ( $wpmem->use_exp == 1 ) ? get_user_meta( $user_id, 'exp_type', true ) : '';
284
- $arr['exp_date'] = ( $wpmem->use_exp == 1 ) ? get_user_meta( $user_id, 'expires', true ) : '';
285
  $arr['do_shortcodes'] = true;
286
  $arr['add_footer'] = true;
287
  $arr['disable'] = false;
81
  $arr['user_login'] = stripslashes( $user->user_login );
82
  $arr['user_email'] = stripslashes( $user->user_email );
83
  $arr['blogname'] = wp_specialchars_decode( get_option ( 'blogname' ), ENT_QUOTES );
84
+ $arr['exp_type'] = ( defined( 'WPMEM_EXP_MODULE' ) && $wpmem->use_exp == 1 ) ? get_user_meta( $user_id, 'exp_type', true ) : '';
85
+ $arr['exp_date'] = ( defined( 'WPMEM_EXP_MODULE' ) && $wpmem->use_exp == 1 ) ? get_user_meta( $user_id, 'expires', true ) : '';
86
  $arr['wpmem_msurl'] = $wpmem->user_pages['profile'];
87
  $arr['reg_link'] = esc_url( get_user_meta( $user_id, 'wpmem_reg_url', true ) );
88
  $arr['do_shortcodes'] = true;
280
  $arr['user_ip'] = get_user_meta( $user_id, 'wpmem_reg_ip', true );
281
  $arr['reg_link'] = esc_url( get_user_meta( $user_id, 'wpmem_reg_url', true ) );
282
  $arr['act_link'] = get_bloginfo ( 'wpurl' ) . "/wp-admin/user-edit.php?user_id=".$user_id;
283
+ $arr['exp_type'] = ( defined( 'WPMEM_EXP_MODULE' ) && $wpmem->use_exp == 1 ) ? get_user_meta( $user_id, 'exp_type', true ) : '';
284
+ $arr['exp_date'] = ( defined( 'WPMEM_EXP_MODULE' ) && $wpmem->use_exp == 1 ) ? get_user_meta( $user_id, 'expires', true ) : '';
285
  $arr['do_shortcodes'] = true;
286
  $arr['add_footer'] = true;
287
  $arr['disable'] = false;
inc/forms.php CHANGED
@@ -33,24 +33,27 @@ if ( ! function_exists( 'wpmem_inc_login' ) ):
33
  *
34
  * @since 1.8
35
  *
36
- * @uses wpmem_login_form()
 
 
37
  *
38
  * @param string $page
39
  * @param string $redirect_to
40
  * @return string $str The generated html for the login form.
41
  */
42
- function wpmem_inc_login( $page="page", $redirect_to = null, $show = 'show' ) {
43
 
44
  global $wpmem, $wpmem_regchk, $post;
45
 
46
  $str = '';
47
 
48
- if ( $page == "page" ){
49
- if ( $wpmem_regchk != "success" ){
 
50
 
51
  $arr = get_option( 'wpmembers_dialogs' );
52
 
53
- // this shown above blocked content
54
  $str = '<p>' . __( stripslashes( $arr[0] ), 'wp-members' ) . '</p>';
55
 
56
  /**
@@ -65,7 +68,7 @@ function wpmem_inc_login( $page="page", $redirect_to = null, $show = 'show' ) {
65
  }
66
  }
67
 
68
- // create the default inputs
69
  $default_inputs = array(
70
  array(
71
  'name' => __( 'Username' ),
@@ -124,9 +127,7 @@ if ( ! function_exists( 'wpmem_inc_changepassword' ) ):
124
  *
125
  * Loads the form for changing password.
126
  *
127
- * @since 2.0
128
- *
129
- * @uses wpmem_login_form()
130
  *
131
  * @return string $str the generated html for the change password form.
132
  */
@@ -190,15 +191,13 @@ if ( ! function_exists( 'wpmem_inc_resetpassword' ) ):
190
  *
191
  * Loads the form for resetting password.
192
  *
193
- * @since 2.1
194
- *
195
- * @uses wpmem_login_form()
196
  *
197
  * @return string $str the generated html fo the reset password form.
198
  */
199
- function wpmem_inc_resetpassword()
200
- {
201
- /** create the default inputs **/
202
  $default_inputs = array(
203
  array(
204
  'name' => __( 'Username' ),
@@ -637,14 +636,18 @@ function wpmem_inc_registration( $toggle = 'new', $heading = '', $redirect_to =
637
  $val = htmlspecialchars( get_user_meta( $userdata->ID, 'description', 'true' ) );
638
  break;
639
 
640
- case( 'user_email' ):
641
- case( 'confirm_email' ):
642
  $val = $userdata->user_email;
643
  break;
644
 
645
- case( 'user_url' ):
646
  $val = esc_url( $userdata->user_url );
647
  break;
 
 
 
 
648
 
649
  default:
650
  $val = htmlspecialchars( get_user_meta( $userdata->ID, $field[2], 'true' ) );
@@ -927,7 +930,8 @@ function wpmem_inc_recaptcha( $arr ) {
927
 
928
  // determine if reCAPTCHA should be another language
929
  $allowed_langs = array( 'nl', 'fr', 'de', 'pt', 'ru', 'es', 'tr' );
930
- $compare_lang = strtolower( substr( WPLANG, -2 ) );
 
931
  $use_the_lang = ( in_array( $compare_lang, $allowed_langs ) ) ? $compare_lang : false;
932
  $lang = ( $use_the_lang ) ? ' lang : \'' . $use_the_lang . '\'' : '';
933
 
33
  *
34
  * @since 1.8
35
  *
36
+ * @global object $wpmem The WP_Members object.
37
+ * @global string $wpmem_regchk The WP-Members message container.
38
+ * @global object $post The WordPress Post object.
39
  *
40
  * @param string $page
41
  * @param string $redirect_to
42
  * @return string $str The generated html for the login form.
43
  */
44
+ function wpmem_inc_login( $page = "page", $redirect_to = null, $show = 'show' ) {
45
 
46
  global $wpmem, $wpmem_regchk, $post;
47
 
48
  $str = '';
49
 
50
+ if ( $page == "page" ) {
51
+
52
+ if ( $wpmem_regchk != "success" ) {
53
 
54
  $arr = get_option( 'wpmembers_dialogs' );
55
 
56
+ // This shown above blocked content.
57
  $str = '<p>' . __( stripslashes( $arr[0] ), 'wp-members' ) . '</p>';
58
 
59
  /**
68
  }
69
  }
70
 
71
+ // Create the default inputs.
72
  $default_inputs = array(
73
  array(
74
  'name' => __( 'Username' ),
127
  *
128
  * Loads the form for changing password.
129
  *
130
+ * @since 2.0.0
 
 
131
  *
132
  * @return string $str the generated html for the change password form.
133
  */
191
  *
192
  * Loads the form for resetting password.
193
  *
194
+ * @since 2.1.0
 
 
195
  *
196
  * @return string $str the generated html fo the reset password form.
197
  */
198
+ function wpmem_inc_resetpassword() {
199
+
200
+ // Create the default inputs.
201
  $default_inputs = array(
202
  array(
203
  'name' => __( 'Username' ),
636
  $val = htmlspecialchars( get_user_meta( $userdata->ID, 'description', 'true' ) );
637
  break;
638
 
639
+ case 'user_email':
640
+ case 'confirm_email':
641
  $val = $userdata->user_email;
642
  break;
643
 
644
+ case 'user_url':
645
  $val = esc_url( $userdata->user_url );
646
  break;
647
+
648
+ case 'display_name':
649
+ $val = htmlspecialchars( $userdata->display_name );
650
+ break;
651
 
652
  default:
653
  $val = htmlspecialchars( get_user_meta( $userdata->ID, $field[2], 'true' ) );
930
 
931
  // determine if reCAPTCHA should be another language
932
  $allowed_langs = array( 'nl', 'fr', 'de', 'pt', 'ru', 'es', 'tr' );
933
+ $locale = apply_filters( 'plugin_locale', get_locale(), 'wp-members' );
934
+ $compare_lang = strtolower( substr( $locale, -2 ) );
935
  $use_the_lang = ( in_array( $compare_lang, $allowed_langs ) ) ? $compare_lang : false;
936
  $lang = ( $use_the_lang ) ? ' lang : \'' . $use_the_lang . '\'' : '';
937
 
inc/shortcodes.php CHANGED
@@ -9,8 +9,8 @@
9
  * Copyright (c) 2006-2015 Chad Butler
10
  * WP-Members(tm) is a trademark of butlerblog.com
11
  *
12
- * @package WordPress
13
- * @subpackage WP-Members
14
  * @author Chad Butler
15
  * @copyright 2006-2015
16
  *
@@ -20,7 +20,6 @@
20
  * - wpmem_sc_logged_out
21
  * - wpmem_shortcode
22
  * - wpmem_do_sc_pages
23
- * - wpmem_do_sc_pages
24
  * - wpmem_sc_user_count
25
  */
26
 
@@ -46,87 +45,104 @@
46
  /**
47
  * Function for forms called by shortcode.
48
  *
49
- * @since 3.0
50
  *
51
- * @param $attr
52
- * @param $content
53
- * @param $tag
54
- * @return $content
 
 
 
55
  */
56
  function wpmem_sc_forms( $atts, $content = null, $tag = 'wpmem_form' ) {
57
 
58
- // Dependencies.
59
  global $wpmem, $wpmem_themsg;
 
 
 
 
60
  include_once( WPMEM_PATH . 'inc/core.php' );
 
 
 
 
61
  include_once( WPMEM_PATH . 'inc/dialogs.php' );
 
62
  // Defaults.
63
  $redirect_to = ( isset( $atts['redirect_to'] ) ) ? $atts['redirect_to'] : null;
64
  $texturize = ( isset( $atts['texturize'] ) ) ? $atts['texturize'] : false;
65
 
66
- switch ( $atts ) {
67
-
68
- case in_array( 'login', $atts ):
69
- if ( is_user_logged_in() ) {
70
- /*
71
- * If the user is logged in, return any nested content (if any)
72
- * or the default bullet links if no nested content.
73
- */
74
- $content = ( $content ) ? $content : wpmem_inc_memberlinks( 'login' );
75
- } else {
76
- /*
77
- * If the user is not logged in, return an error message if a login
78
- * error state exists, or return the login form.
79
- */
80
- $content = ( $wpmem->regchk == 'loginfailed' ) ? wpmem_inc_loginfailed() : wpmem_inc_login( 'login', $redirect_to );
81
- }
82
- break;
83
-
84
- case in_array( 'register', $atts ):
85
- if ( is_user_logged_in() ) {
86
- /*
87
- * If the user is logged in, return any nested content (if any)
88
- * or the default bullet links if no nested content.
89
- */
90
- $content = ( $content ) ? $content : wpmem_inc_memberlinks( 'register' );
91
- } else {
92
- // @todo Can this be moved into another function? Should $wpmem get an error message handler?
93
- if ( $wpmem->regchk == 'captcha' ) {
94
- global $wpmem_captcha_err;
95
- $wpmem_themsg = __( 'There was an error with the CAPTCHA form.' ) . '<br /><br />' . $wpmem_captcha_err;
96
- }
97
- $content = ( $wpmem_themsg || $wpmem->regchk == 'success' ) ? wpmem_inc_regmessage( $wpmem->regchk, $wpmem_themsg ) : '';
98
- $content .= ( $wpmem->regchk == 'success' ) ? wpmem_inc_login() : wpmem_inc_registration( 'new', '', $redirect_to );
99
- }
100
- break;
101
-
102
- case in_array( 'password', $atts ):
103
- $content = wpmem_page_pwd_reset( $wpmem->regchk, $content );
104
- break;
105
-
106
- case in_array( 'user_edit', $atts ):
107
- $content = wpmem_page_user_edit( $wpmem->regchk, $content );
108
- break;
109
-
110
- }
111
-
112
  /*
113
- * @todo - This is temporary for texturizing. Need to work it into an argument in the function call as
114
- * to whether the [wpmem_txt] shortcode is even included. For now, this will allow this function to be
115
- * tested as an include during the 3.0 alpha/beta testing period and a permanent solution can be worked
116
- * out for 3.x.x.
117
  */
118
- if ( array_key_exists( 'texturize', $atts ) && $atts['texturize'] == 'false' ) {
119
- $content = str_replace( array( '[wpmem_txt]', '[/wpmem_txt]' ), array( '', '' ), $content );
120
- }
121
- if ( strstr( $content, '[wpmem_txt]' ) ) {
122
- // Fixes the wptexturize.
123
- remove_filter( 'the_content', 'wpautop' );
124
- remove_filter( 'the_content', 'wptexturize' );
125
- add_filter( 'the_content', 'wpmem_texturize', 999 );
126
- }
127
- // @todo - Look into shortcode_unautop().
128
- /** End temporary texturize functions */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
129
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
130
  return do_shortcode( $content );
131
  }
132
 
@@ -144,6 +160,8 @@ function wpmem_sc_forms( $atts, $content = null, $tag = 'wpmem_form' ) {
144
  *
145
  * @since 3.0.0
146
  *
 
 
147
  * @param array $atts
148
  * @param string $content
149
  * @param string $tag
@@ -194,7 +212,7 @@ function wpmem_sc_logged_in( $atts, $content = null, $tag = 'wpmem_logged_in' )
194
 
195
  // If there is a status attribute of "sub" and the user is logged in.
196
  if ( ( isset( $atts['status'] ) ) && $atts['status'] == 'sub' && is_user_logged_in() ) {
197
- if ( $wpmem->use_exp == 1 ) {
198
  if ( ! wpmem_chk_exp() ) {
199
  $do_return = true;
200
  } elseif ( $atts['msg'] == true ) {
@@ -230,7 +248,9 @@ function wpmem_sc_logged_out( $atts, $content = null, $tag ) {
230
  /**
231
  * Displays login form when called by shortcode.
232
  *
233
- * @since 3.0
 
 
234
  *
235
  * @param $atts
236
  * @param $content
@@ -264,7 +284,9 @@ if ( ! function_exists( 'wpmem_shortcode' ) ):
264
  * is used. Also executes shortcodes for login status with the wpmem_logged_in tags
265
  * and fields when the wpmem_field tags are used.
266
  *
267
- * @since 2.4
 
 
268
  *
269
  * @param array $attr page|url|status|msg|field|id
270
  * @param string $content
@@ -366,13 +388,14 @@ if ( ! function_exists( 'wpmem_do_sc_pages' ) ):
366
  * But where that function handles general content, this function
367
  * handles building specific pages generated by shortcodes.
368
  *
369
- * @since 2.6
 
 
 
 
370
  *
371
  * @param string $page
372
  * @param string $redirect_to
373
- * @global object $wpmem
374
- * @global string $wpmem_themsg
375
- * @global object $post
376
  * @return string $content
377
  */
378
  function wpmem_do_sc_pages( $page, $redirect_to = null ) {
@@ -500,11 +523,14 @@ endif;
500
  /**
501
  * User count shortcode.
502
  *
503
- * @since 3.0
 
 
504
  *
505
- * @todo Evaluate this shortcode for full inclusion.
 
 
506
  */
507
- add_shortcode( 'wpmem_show_count', 'wpmem_sc_user_count' );
508
  function wpmem_sc_user_count( $atts, $content = null ) {
509
  global $wpdb;
510
  $do_query = ( $atts['key'] && $atts['value'] ) ? true : false;
9
  * Copyright (c) 2006-2015 Chad Butler
10
  * WP-Members(tm) is a trademark of butlerblog.com
11
  *
12
+ * @package WP-Members
13
+ * @subpackage WP-Members Shortcodes
14
  * @author Chad Butler
15
  * @copyright 2006-2015
16
  *
20
  * - wpmem_sc_logged_out
21
  * - wpmem_shortcode
22
  * - wpmem_do_sc_pages
 
23
  * - wpmem_sc_user_count
24
  */
25
 
45
  /**
46
  * Function for forms called by shortcode.
47
  *
48
+ * @since 3.0.0
49
  *
50
+ * @global object $wpmem The WP_Members object.
51
+ * @global string $wpmem_themsg The WP-Members message container.
52
+ *
53
+ * @param array $attr
54
+ * @param string $content
55
+ * @param string $tag
56
+ * @return string $content
57
  */
58
  function wpmem_sc_forms( $atts, $content = null, $tag = 'wpmem_form' ) {
59
 
 
60
  global $wpmem, $wpmem_themsg;
61
+
62
+ /**
63
+ * Load core functions if they are not already loaded.
64
+ */
65
  include_once( WPMEM_PATH . 'inc/core.php' );
66
+
67
+ /**
68
+ * Load dialog functions if they are not already loaded.
69
+ */
70
  include_once( WPMEM_PATH . 'inc/dialogs.php' );
71
+
72
  // Defaults.
73
  $redirect_to = ( isset( $atts['redirect_to'] ) ) ? $atts['redirect_to'] : null;
74
  $texturize = ( isset( $atts['texturize'] ) ) ? $atts['texturize'] : false;
75
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
76
  /*
77
+ * The [wpmem_form] shortcode requires additional tags (login, register, etc) that
78
+ * will be in the $atts array. If $atts is not an array, no additional tags were
79
+ * given, so there is nothing to render.
 
80
  */
81
+ if ( is_array( $atts ) ) {
82
+
83
+ // If $atts is an array, get the tag from the array so we know what form to render.
84
+ switch ( $atts ) {
85
+
86
+ case in_array( 'login', $atts ):
87
+ if ( is_user_logged_in() ) {
88
+ /*
89
+ * If the user is logged in, return any nested content (if any)
90
+ * or the default bullet links if no nested content.
91
+ */
92
+ $content = ( $content ) ? $content : wpmem_inc_memberlinks( 'login' );
93
+ } else {
94
+ /*
95
+ * If the user is not logged in, return an error message if a login
96
+ * error state exists, or return the login form.
97
+ */
98
+ $content = ( $wpmem->regchk == 'loginfailed' ) ? wpmem_inc_loginfailed() : wpmem_inc_login( 'login', $redirect_to );
99
+ }
100
+ break;
101
+
102
+ case in_array( 'register', $atts ):
103
+ if ( is_user_logged_in() ) {
104
+ /*
105
+ * If the user is logged in, return any nested content (if any)
106
+ * or the default bullet links if no nested content.
107
+ */
108
+ $content = ( $content ) ? $content : wpmem_inc_memberlinks( 'register' );
109
+ } else {
110
+ // @todo Can this be moved into another function? Should $wpmem get an error message handler?
111
+ if ( $wpmem->regchk == 'captcha' ) {
112
+ global $wpmem_captcha_err;
113
+ $wpmem_themsg = __( 'There was an error with the CAPTCHA form.' ) . '<br /><br />' . $wpmem_captcha_err;
114
+ }
115
+ $content = ( $wpmem_themsg || $wpmem->regchk == 'success' ) ? wpmem_inc_regmessage( $wpmem->regchk, $wpmem_themsg ) : '';
116
+ $content .= ( $wpmem->regchk == 'success' ) ? wpmem_inc_login() : wpmem_inc_registration( 'new', '', $redirect_to );
117
+ }
118
+ break;
119
 
120
+ case in_array( 'password', $atts ):
121
+ $content = wpmem_page_pwd_reset( $wpmem->regchk, $content );
122
+ break;
123
+
124
+ case in_array( 'user_edit', $atts ):
125
+ $content = wpmem_page_user_edit( $wpmem->regchk, $content );
126
+ break;
127
+
128
+ }
129
+
130
+ /*
131
+ * This is for texturizing. Need to work it into an argument in the function call as to whether the
132
+ * [wpmem_txt] shortcode is even included. @todo - Is this a temporary solution or is there something
133
+ * cleaner that can be worked out?
134
+ */
135
+ if ( array_key_exists( 'texturize', $atts ) && $atts['texturize'] == 'false' ) {
136
+ $content = str_replace( array( '[wpmem_txt]', '[/wpmem_txt]' ), array( '', '' ), $content );
137
+ }
138
+ if ( strstr( $content, '[wpmem_txt]' ) ) {
139
+ // Fixes the wptexturize.
140
+ remove_filter( 'the_content', 'wpautop' );
141
+ remove_filter( 'the_content', 'wptexturize' );
142
+ add_filter( 'the_content', 'wpmem_texturize', 999 );
143
+ }
144
+ // End texturize functions */
145
+ }
146
  return do_shortcode( $content );
147
  }
148
 
160
  *
161
  * @since 3.0.0
162
  *
163
+ * @global object $wpmem The WP_Members object.
164
+ *
165
  * @param array $atts
166
  * @param string $content
167
  * @param string $tag
212
 
213
  // If there is a status attribute of "sub" and the user is logged in.
214
  if ( ( isset( $atts['status'] ) ) && $atts['status'] == 'sub' && is_user_logged_in() ) {
215
+ if ( defined( 'WPMEM_EXP_MODULE' ) && $wpmem->use_exp == 1 ) {
216
  if ( ! wpmem_chk_exp() ) {
217
  $do_return = true;
218
  } elseif ( $atts['msg'] == true ) {
248
  /**
249
  * Displays login form when called by shortcode.
250
  *
251
+ * @since 3.0.0
252
+ *
253
+ * @global object $wpmem The WP_Members object.
254
  *
255
  * @param $atts
256
  * @param $content
284
  * is used. Also executes shortcodes for login status with the wpmem_logged_in tags
285
  * and fields when the wpmem_field tags are used.
286
  *
287
+ * @since 2.4.0
288
+ *
289
+ * @global object $wpmem The WP_Members object.
290
  *
291
  * @param array $attr page|url|status|msg|field|id
292
  * @param string $content
388
  * But where that function handles general content, this function
389
  * handles building specific pages generated by shortcodes.
390
  *
391
+ * @since 2.6.0
392
+ *
393
+ * @global object $wpmem The WP_Members object.
394
+ * @global string $wpmem_themsg The WP-Members message container.
395
+ * @global object $post The WordPress post object.
396
  *
397
  * @param string $page
398
  * @param string $redirect_to
 
 
 
399
  * @return string $content
400
  */
401
  function wpmem_do_sc_pages( $page, $redirect_to = null ) {
523
  /**
524
  * User count shortcode.
525
  *
526
+ * @since 3.0.0
527
+ *
528
+ * @global object $wpdb The WordPress database object.
529
  *
530
+ * @param array $atts Shortcode attributes.
531
+ * @param string $content The shortcode content.
532
+ * @return string $content
533
  */
 
534
  function wpmem_sc_user_count( $atts, $content = null ) {
535
  global $wpdb;
536
  $do_query = ( $atts['key'] && $atts['value'] ) ? true : false;
inc/utilities.php CHANGED
@@ -10,8 +10,8 @@
10
  * Copyright (c) 2006-2015 Chad Butler
11
  * WP-Members(tm) is a trademark of butlerblog.com
12
  *
13
- * @package WordPress
14
- * @subpackage WP-Members
15
  * @author Chad Butler
16
  * @copyright 2006-2015
17
  *
@@ -19,7 +19,7 @@
19
  * - wpmem_create_formfield
20
  * - wpmem_selected
21
  * - wpmem_chk_qstr
22
- * - wpmem_generatePassword
23
  * - wpmem_texturize
24
  * - wpmem_enqueue_style
25
  * - wpmem_do_excerpt
@@ -35,7 +35,7 @@ if ( ! function_exists( 'wpmem_create_formfield' ) ):
35
  *
36
  * Creates various form fields and returns them as a string.
37
  *
38
- * @since 1.8
39
  *
40
  * @param string $name The name of the field.
41
  * @param string $type The field type.
@@ -102,7 +102,7 @@ if ( ! function_exists( 'wpmem_selected' ) ):
102
  /**
103
  * Determines if a form field is selected (i.e. lists & checkboxes).
104
  *
105
- * @since 0.1
106
  *
107
  * @param string $value
108
  * @param string $valtochk
@@ -120,9 +120,8 @@ if ( ! function_exists( 'wpmem_chk_qstr' ) ):
120
  /**
121
  * Checks querystrings.
122
  *
123
- * @since 2.0
124
  *
125
- * @uses get_permalink
126
  * @param string $url
127
  * @return string $return_url
128
  */
@@ -145,7 +144,8 @@ if ( ! function_exists( 'wpmem_generatePassword' ) ):
145
  /**
146
  * Generates a random password.
147
  *
148
- * @since 2.0
 
149
  *
150
  * @return string The random password.
151
  */
@@ -192,9 +192,7 @@ if ( ! function_exists( 'wpmem_enqueue_style' ) ):
192
  *
193
  * @since 2.6
194
  *
195
- * @global $wpmem
196
- * @uses wp_register_style
197
- * @uses wp_enqueue_style
198
  */
199
  function wpmem_enqueue_style() {
200
  global $wpmem;
@@ -210,6 +208,8 @@ if ( ! function_exists( 'wpmem_do_excerpt' ) ):
210
  *
211
  * @since 2.6
212
  *
 
 
213
  * @param string $content
214
  * @return string $content
215
  */
@@ -277,10 +277,10 @@ if ( ! function_exists( 'wpmem_test_shortcode' ) ):
277
  /**
278
  * Tests $content for the presence of the [wp-members] shortcode.
279
  *
280
- * @since 2.6
 
 
281
  *
282
- * @global string $post
283
- * @uses get_shortcode_regex
284
  * @return bool
285
  *
286
  * @example http://codex.wordpress.org/Function_Reference/get_shortcode_regex
@@ -309,27 +309,24 @@ endif;
309
  * Sets an array of user meta fields to be excluded from update/insert.
310
  *
311
  * @since 2.9.3
 
312
  *
313
- * @param string $tag A tag so we know where the function is being used.
 
314
  */
315
  function wpmem_get_excluded_meta( $tag ) {
316
 
317
- /**
318
- * Filter the fields to be excluded when user is created/updated.
319
- *
320
- * @since 2.9.3
321
- *
322
- * @param array An array of the field meta names to exclude.
323
- * @param string $tag A tag so we know where the function is being used.
324
- */
325
- return apply_filters( 'wpmem_exclude_fields', array( 'password', 'confirm_password', 'confirm_email', 'password_confirm', 'email_confirm' ), $tag );
326
  }
327
 
328
 
329
  /**
330
  * Returns http:// or https:// depending on ssl.
331
  *
332
- * @ since 2.9.8
 
 
333
  */
334
  function wpmem_use_ssl() {
335
  return ( is_ssl() ) ? 'https://' : 'http://';
10
  * Copyright (c) 2006-2015 Chad Butler
11
  * WP-Members(tm) is a trademark of butlerblog.com
12
  *
13
+ * @package WP-Members
14
+ * @subpackage WP-Members Utility Functions
15
  * @author Chad Butler
16
  * @copyright 2006-2015
17
  *
19
  * - wpmem_create_formfield
20
  * - wpmem_selected
21
  * - wpmem_chk_qstr
22
+ * - wpmem_generatePassword (deprecated)
23
  * - wpmem_texturize
24
  * - wpmem_enqueue_style
25
  * - wpmem_do_excerpt
35
  *
36
  * Creates various form fields and returns them as a string.
37
  *
38
+ * @since 1.8.0
39
  *
40
  * @param string $name The name of the field.
41
  * @param string $type The field type.
102
  /**
103
  * Determines if a form field is selected (i.e. lists & checkboxes).
104
  *
105
+ * @since 0.1.0
106
  *
107
  * @param string $value
108
  * @param string $valtochk
120
  /**
121
  * Checks querystrings.
122
  *
123
+ * @since 2.0.0
124
  *
 
125
  * @param string $url
126
  * @return string $return_url
127
  */
144
  /**
145
  * Generates a random password.
146
  *
147
+ * @since 2.0.0
148
+ * @deprecated Unknown
149
  *
150
  * @return string The random password.
151
  */
192
  *
193
  * @since 2.6
194
  *
195
+ * @global object $wpmem The WP_Members object.
 
 
196
  */
197
  function wpmem_enqueue_style() {
198
  global $wpmem;
208
  *
209
  * @since 2.6
210
  *
211
+ * @global object $wpmem The WP_Members object.
212
+ *
213
  * @param string $content
214
  * @return string $content
215
  */
277
  /**
278
  * Tests $content for the presence of the [wp-members] shortcode.
279
  *
280
+ * @since 2.6.0
281
+ *
282
+ * @global $shortcode_tags
283
  *
 
 
284
  * @return bool
285
  *
286
  * @example http://codex.wordpress.org/Function_Reference/get_shortcode_regex
309
  * Sets an array of user meta fields to be excluded from update/insert.
310
  *
311
  * @since 2.9.3
312
+ * @since Unknown Now a wrapper for get_excluded_fields().
313
  *
314
+ * @param string $tag A tag so we know where the function is being used.
315
+ * @return array Array of fields to be excluded from the registration form.
316
  */
317
  function wpmem_get_excluded_meta( $tag ) {
318
 
319
+ global $wpmem;
320
+ return $wpmem->excluded_fields( $tag );
 
 
 
 
 
 
 
321
  }
322
 
323
 
324
  /**
325
  * Returns http:// or https:// depending on ssl.
326
  *
327
+ * @since 2.9.8
328
+ *
329
+ * @return string https://|http:// depending on whether ssl is being used.
330
  */
331
  function wpmem_use_ssl() {
332
  return ( is_ssl() ) ? 'https://' : 'http://';
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: cbutlerjr
3
  Tags: access, authentication, content, login, member, membership, password, protect, register, registration, restriction, subscriber
4
  Requires at least: 3.1
5
  Tested up to: 4.3.1
6
- Stable tag: 3.0.6
7
  License: GPLv2
8
 
9
  WP-Members&trade; is a free membership management framework for WordPress&reg; that restricts content to registered users.
@@ -111,7 +111,6 @@ Premium priority support is available at the plugin's site [RocketGeek.com](http
111
 
112
  == Upgrade Notice ==
113
 
114
- WP-Members 3.0.6 is a functional improvement release with minimal core changes.
115
  WP-Members 3.0.0 is a major version release. Please review the changelog: http://rkt.bz/v30
116
 
117
  == Screenshots ==
@@ -135,6 +134,17 @@ WP-Members 3.0.0 is a major version release. Please review the changelog: http:/
135
 
136
  == Changelog ==
137
 
 
 
 
 
 
 
 
 
 
 
 
138
  = 3.0.6 =
139
 
140
  * Updates to localization function - documented plugin_locale filter, wpmem_localization_file filter, and improved load_textdomain logic.
3
  Tags: access, authentication, content, login, member, membership, password, protect, register, registration, restriction, subscriber
4
  Requires at least: 3.1
5
  Tested up to: 4.3.1
6
+ Stable tag: 3.0.7
7
  License: GPLv2
8
 
9
  WP-Members&trade; is a free membership management framework for WordPress&reg; that restricts content to registered users.
111
 
112
  == Upgrade Notice ==
113
 
 
114
  WP-Members 3.0.0 is a major version release. Please review the changelog: http://rkt.bz/v30
115
 
116
  == Screenshots ==
134
 
135
  == Changelog ==
136
 
137
+ = 3.0.7 =
138
+
139
+ * Fix for use of display_name on profile update.
140
+ * Fix for newer installs (post WP 4.0) where WPLANG is not defined and reCAPTCHA is used.
141
+ * Fix in wpmem_form shortcode to skp if no additional tag exists.
142
+ * Fix to plugin_basename.
143
+ * Changes in core to use fields from WP_Members class (preparing for new form field process).
144
+ * Reviews and updates to code standards and inline documentation.
145
+ * Fix for password reset (typo in object name checking for moderated registration)
146
+ * Fix for PayPal extension (http://rkt.bz/r3); added logic to avoid errors if the PayPal extension is disabled but the main option setting remained turned on.
147
+
148
  = 3.0.6 =
149
 
150
  * Updates to localization function - documented plugin_locale filter, wpmem_localization_file filter, and improved load_textdomain logic.
wp-members.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: WP-Members
4
  Plugin URI: http://rocketgeek.com
5
  Description: WP access restriction and user registration. For more information on plugin features, refer to <a href="http://rocketgeek.com/plugins/wp-members/users-guide/">the online Users Guide</a>. A <a href="http://rocketgeek.com/plugins/wp-members/quick-start-guide/">Quick Start Guide</a> is also available. WP-Members(tm) is a trademark of butlerblog.com.
6
- Version: 3.0.6
7
  Author: Chad Butler
8
  Author URI: http://butlerblog.com/
9
  Text Domain: wp-members
@@ -62,7 +62,7 @@ License: GPLv2
62
 
63
 
64
  // Initialize constants.
65
- define( 'WPMEM_VERSION', '3.0.6' );
66
  define( 'WPMEM_DEBUG', false );
67
  define( 'WPMEM_DIR', plugin_dir_url ( __FILE__ ) );
68
  define( 'WPMEM_PATH', plugin_dir_path( __FILE__ ) );
@@ -86,6 +86,8 @@ register_activation_hook( __FILE__, 'wpmem_install' );
86
  * its features and options.
87
  *
88
  * @since 2.9.0
 
 
89
  */
90
  function wpmem_init() {
91
 
@@ -99,8 +101,12 @@ function wpmem_init() {
99
  */
100
  do_action( 'wpmem_pre_init' );
101
 
102
- // Load WP_Members class.
103
- include_once( WPMEM_PATH . 'inc/class-wp-members.php' );
 
 
 
 
104
  $wpmem = new WP_Members();
105
 
106
  /**
@@ -115,7 +121,7 @@ function wpmem_init() {
115
  *
116
  * @since 2.9.0
117
  *
118
- * @param string The path to wp-members-pluggable.php.
119
  */
120
  $wpmem_pluggable = apply_filters( 'wpmem_plugins_file', WP_PLUGIN_DIR . '/wp-members-pluggable.php' );
121
 
@@ -128,8 +134,10 @@ function wpmem_init() {
128
  $exp_module = ( in_array( 'wp-members-expiration/module.php', get_option( 'active_plugins' ) ) ) ? true : false;
129
  define( 'WPMEM_EXP_MODULE', $exp_module );
130
 
131
- // Load core file.
132
- include_once( WPMEM_PATH . 'inc/core.php' );
 
 
133
 
134
  // Load actions and filters.
135
  $wpmem->load_hooks();
@@ -170,6 +178,9 @@ function wpmem_chk_admin() {
170
  do_action( 'wpmem_pre_admin_init' );
171
 
172
  if ( is_multisite() && current_user_can( 'edit_theme_options' ) ) {
 
 
 
173
  require_once( WPMEM_PATH . 'admin/admin.php' );
174
  }
175
 
@@ -178,11 +189,30 @@ function wpmem_chk_admin() {
178
  * otherwise, load profile actions for non-admins.
179
  */
180
  if ( current_user_can( 'edit_users' ) ) {
 
 
 
 
181
  require_once( WPMEM_PATH . 'admin/admin.php' );
 
 
 
 
182
  require_once( WPMEM_PATH . 'admin/users.php' );
183
- include_once( WPMEM_PATH . 'admin/user-profile.php' );
 
 
 
 
 
184
  } else {
 
 
 
 
185
  require_once( WPMEM_PATH . 'inc/users.php' );
 
 
186
  add_action( 'show_user_profile', 'wpmem_user_profile' );
187
  add_action( 'edit_user_profile', 'wpmem_user_profile' );
188
  add_action( 'profile_update', 'wpmem_profile_update' );
@@ -193,7 +223,13 @@ function wpmem_chk_admin() {
193
  * meta boxes and custom post/page columns.
194
  */
195
  if ( current_user_can( 'edit_posts' ) ) {
196
- include_once( WPMEM_PATH . 'admin/post.php' );
 
 
 
 
 
 
197
  add_action( 'add_meta_boxes', 'wpmem_block_meta_add' );
198
  add_action( 'save_post', 'wpmem_block_meta_save' );
199
  add_filter( 'manage_posts_columns', 'wpmem_post_columns' );
@@ -229,9 +265,16 @@ function wpmem_admin_options() {
229
  * @since 2.5.2
230
  */
231
  function wpmem_install() {
 
 
 
 
232
  require_once( WPMEM_PATH . 'wp-members-install.php' );
 
 
233
  if ( is_multisite() ) {
234
- // if it is multisite, install options for each blog
 
235
  global $wpdb;
236
  $blogs = $wpdb->get_results(
237
  "SELECT blog_id
@@ -247,8 +290,10 @@ function wpmem_install() {
247
  wpmem_do_install();
248
  }
249
  switch_to_blog( $original_blog_id );
 
250
  } else {
251
- // normal single install
 
252
  wpmem_do_install();
253
  }
254
  }
@@ -268,9 +313,19 @@ add_action( 'wpmu_new_blog', 'wpmem_mu_new_site', 10, 6 );
268
  * @param $meta
269
  */
270
  function wpmem_mu_new_site( $blog_id, $user_id, $domain, $path, $site_id, $meta ) {
 
 
 
 
271
  require_once( WPMEM_PATH . 'wp-members-install.php' );
 
 
272
  switch_to_blog( $blog_id );
 
 
273
  wpmem_do_install();
 
 
274
  restore_current_blog();
275
  }
276
 
@@ -323,4 +378,4 @@ function wpmem_load_textdomain() {
323
  return;
324
  }
325
 
326
- // End of File.
3
  Plugin Name: WP-Members
4
  Plugin URI: http://rocketgeek.com
5
  Description: WP access restriction and user registration. For more information on plugin features, refer to <a href="http://rocketgeek.com/plugins/wp-members/users-guide/">the online Users Guide</a>. A <a href="http://rocketgeek.com/plugins/wp-members/quick-start-guide/">Quick Start Guide</a> is also available. WP-Members(tm) is a trademark of butlerblog.com.
6
+ Version: 3.0.7.2
7
  Author: Chad Butler
8
  Author URI: http://butlerblog.com/
9
  Text Domain: wp-members
62
 
63
 
64
  // Initialize constants.
65
+ define( 'WPMEM_VERSION', '3.0.7.2' );
66
  define( 'WPMEM_DEBUG', false );
67
  define( 'WPMEM_DIR', plugin_dir_url ( __FILE__ ) );
68
  define( 'WPMEM_PATH', plugin_dir_path( __FILE__ ) );
86
  * its features and options.
87
  *
88
  * @since 2.9.0
89
+ *
90
+ * @global object $wpmem The WP-Members object class.
91
  */
92
  function wpmem_init() {
93
 
101
  */
102
  do_action( 'wpmem_pre_init' );
103
 
104
+ /**
105
+ * Load the WP_Members class.
106
+ */
107
+ require_once( WPMEM_PATH . 'inc/class-wp-members.php' );
108
+
109
+ // Invoke the WP_Members class.
110
  $wpmem = new WP_Members();
111
 
112
  /**
121
  *
122
  * @since 2.9.0
123
  *
124
+ * @param string The path to WP-Members plugin functions file.
125
  */
126
  $wpmem_pluggable = apply_filters( 'wpmem_plugins_file', WP_PLUGIN_DIR . '/wp-members-pluggable.php' );
127
 
134
  $exp_module = ( in_array( 'wp-members-expiration/module.php', get_option( 'active_plugins' ) ) ) ? true : false;
135
  define( 'WPMEM_EXP_MODULE', $exp_module );
136
 
137
+ /**
138
+ * Load the WP-Members core functions file.
139
+ */
140
+ require_once( WPMEM_PATH . 'inc/core.php' );
141
 
142
  // Load actions and filters.
143
  $wpmem->load_hooks();
178
  do_action( 'wpmem_pre_admin_init' );
179
 
180
  if ( is_multisite() && current_user_can( 'edit_theme_options' ) ) {
181
+ /**
182
+ * Load the main admin file.
183
+ */
184
  require_once( WPMEM_PATH . 'admin/admin.php' );
185
  }
186
 
189
  * otherwise, load profile actions for non-admins.
190
  */
191
  if ( current_user_can( 'edit_users' ) ) {
192
+
193
+ /**
194
+ * Load the main admin file if not already loaded.
195
+ */
196
  require_once( WPMEM_PATH . 'admin/admin.php' );
197
+
198
+ /**
199
+ * Load the admin user functions.
200
+ */
201
  require_once( WPMEM_PATH . 'admin/users.php' );
202
+
203
+ /**
204
+ * Load the admin user profile functions.
205
+ */
206
+ require_once( WPMEM_PATH . 'admin/user-profile.php' );
207
+
208
  } else {
209
+
210
+ /**
211
+ * Load the admin user functions.
212
+ */
213
  require_once( WPMEM_PATH . 'inc/users.php' );
214
+
215
+ // User actions and filters.
216
  add_action( 'show_user_profile', 'wpmem_user_profile' );
217
  add_action( 'edit_user_profile', 'wpmem_user_profile' );
218
  add_action( 'profile_update', 'wpmem_profile_update' );
223
  * meta boxes and custom post/page columns.
224
  */
225
  if ( current_user_can( 'edit_posts' ) ) {
226
+
227
+ /**
228
+ * Load the admin post functions.
229
+ */
230
+ require_once( WPMEM_PATH . 'admin/post.php' );
231
+
232
+ // Post actions and filters.
233
  add_action( 'add_meta_boxes', 'wpmem_block_meta_add' );
234
  add_action( 'save_post', 'wpmem_block_meta_save' );
235
  add_filter( 'manage_posts_columns', 'wpmem_post_columns' );
265
  * @since 2.5.2
266
  */
267
  function wpmem_install() {
268
+
269
+ /**
270
+ * Load the install file.
271
+ */
272
  require_once( WPMEM_PATH . 'wp-members-install.php' );
273
+
274
+ // Multisite requires different install process.
275
  if ( is_multisite() ) {
276
+
277
+ // If it is multisite, install options for each blog.
278
  global $wpdb;
279
  $blogs = $wpdb->get_results(
280
  "SELECT blog_id
290
  wpmem_do_install();
291
  }
292
  switch_to_blog( $original_blog_id );
293
+
294
  } else {
295
+
296
+ // Single site install.
297
  wpmem_do_install();
298
  }
299
  }
313
  * @param $meta
314
  */
315
  function wpmem_mu_new_site( $blog_id, $user_id, $domain, $path, $site_id, $meta ) {
316
+
317
+ /**
318
+ * Load the install file.
319
+ */
320
  require_once( WPMEM_PATH . 'wp-members-install.php' );
321
+
322
+ // Switch to the new blog.
323
  switch_to_blog( $blog_id );
324
+
325
+ // Run the WP-Members install.
326
  wpmem_do_install();
327
+
328
+ // Switch back to the current blog.
329
  restore_current_blog();
330
  }
331
 
378
  return;
379
  }
380
 
381
+ // End of file.