WP-Members Membership Plugin - Version 3.1.4

Version Description

  • Change to the way the PayPal extension is integrated with the main plugin. This allows for some necessary filename changes in the extension.
  • Added checks for PayPal extension function calls within the main plugin to avoid possible errors if it is deactivated.
  • New wpmem_is_tab() API function checks the current tab in the plugin's admin panel.
  • New wpmem_is_reg_page() API function checks if the page the user registered on is the registration page.
  • New wpmem_load_dropins() API function runs dropin load function.
  • Documentation updates, cleaned up and addressed several @todo tags.
  • Updated [wpmem_field] shortcode to display display values instead of stored values for select (dropdown), multiple select, multiple checkbox, and radio group field types.
  • Fixed bug in admin js file introduced when forgot username shortcode was added.
Download this release

Release Info

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

Code changes from version 3.1.3 to 3.1.4

admin/includes/api.php CHANGED
@@ -14,6 +14,7 @@
14
  * Functions included:
15
  * - wpmem_add_custom_email
16
  * - wpmem_add_custom_dialog
 
17
  */
18
 
19
  /**
@@ -58,4 +59,16 @@ function wpmem_add_custom_dialog( $dialogs, $tag, $msg, $label ) {
58
  );
59
  }
60
  return $dialogs;
 
 
 
 
 
 
 
 
 
 
 
 
61
  }
14
  * Functions included:
15
  * - wpmem_add_custom_email
16
  * - wpmem_add_custom_dialog
17
+ * - wpmem_is_tab
18
  */
19
 
20
  /**
59
  );
60
  }
61
  return $dialogs;
62
+ }
63
+
64
+ /**
65
+ * Checks the current tab being displayed in the admin panel.
66
+ *
67
+ * @since 3.1.4
68
+ *
69
+ * @param string $tab The tab slug.
70
+ * @return bool
71
+ */
72
+ function wpmem_is_tab( $tab ) {
73
+ return ( $tab == wpmem_get( 'tab', false, 'get' ) ) ? true : false;
74
  }
admin/js/shortcodes_tinymce_4.js CHANGED
@@ -108,7 +108,7 @@
108
  }
109
  },
110
  {
111
- text: "Forgot Username"
112
  onclick: function(){
113
  editor.insertContent('[wpmem_logged_out][wpmem_form forgot_username][/wpmem_logged_out]');
114
  }
108
  }
109
  },
110
  {
111
+ text: "Forgot Username",
112
  onclick: function(){
113
  editor.insertContent('[wpmem_logged_out][wpmem_form forgot_username][/wpmem_logged_out]');
114
  }
admin/tab-about.php CHANGED
@@ -50,11 +50,11 @@ function wpmem_a_build_about_tab() { ?>
50
  <div id="post-body-content">
51
  <div class="postbox">
52
  <div style="width:20%;max-width:300px;min-width:200px;padding:10px;margin:10px;border:#c4c4c4 1px solid;float:right;">
53
- <h4><a href="https://wordpress.org/plugins/wordpass/">WordPass</a></h4>
54
  <p>Default random passwords can be difficult to for users to use. WordPass simplifies this process by using words to create passwords. Passwords will be generated in the style of 2*Kayak29, 2Bigcranium2#, or %36POTATOE6.
55
  </p>
56
  <p>This plugin works with WordPress as well as with any plugin that uses the WordPress password generation function.</p>
57
- <p><strong><a href="https://wordpress.org/plugins/wordpass/">Try WordPass Free!</a></strong></p>
58
  </div>
59
  <h3><?php _e( 'About WP-Members', 'wp-members' ); ?></h3>
60
  <div class="inside">
50
  <div id="post-body-content">
51
  <div class="postbox">
52
  <div style="width:20%;max-width:300px;min-width:200px;padding:10px;margin:10px;border:#c4c4c4 1px solid;float:right;">
53
+ <h4><a href="http://rkt.bz/3O">WordPass</a></h4>
54
  <p>Default random passwords can be difficult to for users to use. WordPass simplifies this process by using words to create passwords. Passwords will be generated in the style of 2*Kayak29, 2Bigcranium2#, or %36POTATOE6.
55
  </p>
56
  <p>This plugin works with WordPress as well as with any plugin that uses the WordPress password generation function.</p>
57
+ <p><strong><a href="http://rkt.bz/3O">Try WordPass Free!</a></strong></p>
58
  </div>
59
  <h3><?php _e( 'About WP-Members', 'wp-members' ); ?></h3>
60
  <div class="inside">
admin/tab-captcha.php CHANGED
@@ -239,8 +239,8 @@ function wpmem_update_captcha() {
239
  $new_settings['really_simple'] = $settings['really_simple'];
240
  }
241
  $new_settings['recaptcha'] = array(
242
- 'public' => $_POST['wpmem_captcha_publickey'],
243
- 'private' => $_POST['wpmem_captcha_privatekey'],
244
  );
245
  if ( $update_type == 'recaptcha' && isset( $_POST['wpmem_captcha_theme'] ) ) {
246
  $new_settings['recaptcha']['theme'] = $_POST['wpmem_captcha_theme'];
239
  $new_settings['really_simple'] = $settings['really_simple'];
240
  }
241
  $new_settings['recaptcha'] = array(
242
+ 'public' => trim( $_POST['wpmem_captcha_publickey'] ),
243
+ 'private' => trim( $_POST['wpmem_captcha_privatekey'] ),
244
  );
245
  if ( $update_type == 'recaptcha' && isset( $_POST['wpmem_captcha_theme'] ) ) {
246
  $new_settings['recaptcha']['theme'] = $_POST['wpmem_captcha_theme'];
admin/tab-fields.php CHANGED
@@ -145,9 +145,6 @@ function wpmem_update_fields( $action ) {
145
  $wpmem_newfields[ $nrow ][5] = 'y';
146
  }
147
 
148
- // @todo Does $chkreq get used anywhere?
149
- // if ( $wpmem_newfields[$nrow][4] != 'y' && $wpmem_newfields[$nrow][5] == 'y' ) { $chkreq = "err"; }
150
- // @todo Changed above to this:
151
  $chkreq = ( $wpmem_newfields[$nrow][4] != 'y' && $wpmem_newfields[$nrow][5] == 'y' ) ? 'err' : false;
152
 
153
  $wpmem_newfields[$nrow][6] = $wpmem_fields[$row][6];
@@ -372,15 +369,12 @@ function wpmem_a_field_edit( $mode, $wpmem_fields = null, $field = null ) {
372
  </li>
373
  <li>
374
  <label>&nbsp;</label>
375
- <span class="description"><?php _e( 'Accepted file types should be set like this: jpg|jpeg|png|gif', 'wp-members' ); ?>
376
  </li>
377
  <?php echo ( $mode == 'add' ) ? '</div>' : ''; ?>
378
  <?php } ?>
379
  <?php if ( $mode == 'add' || ( $mode == 'edit' && $field_arr[3] == 'checkbox' ) ) { ?>
380
  <?php echo ( $mode == 'add' ) ? '<div id="wpmem_checkbox_info">' : ''; ?>
381
- <li>
382
- <strong><?php _e( 'Additional information for checkbox fields', 'wp-members' ); ?></strong>
383
- </li>
384
  <li>
385
  <label><?php _e( 'Checked by default?', 'wp-members' ); ?></label>
386
  <input type="checkbox" name="add_checked_default" value="y" <?php echo ( $mode == 'edit' && $field_arr[3] == 'checkbox' ) ? checked( 'y', $field_arr[8] ) : false; ?> />
@@ -398,9 +392,6 @@ function wpmem_a_field_edit( $mode, $wpmem_fields = null, $field = null ) {
398
  }
399
  if ( $mode == 'add' || ( $mode == 'edit' && $additional_settings ) ) { ?>
400
  <?php echo ( $mode == 'add' ) ? '<div id="wpmem_dropdown_info">' : ''; ?>
401
- <li>
402
- <strong><?php _e( 'Additional information for dropdown fields', 'wp-members' ); ?></strong>
403
- </li>
404
  <?php if ( $mode == 'add' || ( $mode == 'edit' && $delimiter_settings ) ) {
405
  echo ( $mode == 'add' ) ? '<div id="wpmem_delimiter_info">' : '';
406
  if ( isset( $field_arr[8] ) && ( "|" == $field_arr[8] || "," == $field_arr[8] ) ) {
@@ -419,7 +410,7 @@ function wpmem_a_field_edit( $mode, $wpmem_fields = null, $field = null ) {
419
  <?php echo ( $mode == 'add' ) ? '</div>' : '';
420
  } ?>
421
  <li>
422
- <label style="vertical-align:top"><?php _e( 'For dropdown, array of values:', 'wp-members' ); ?></label>
423
  <textarea name="add_dropdown_value" rows="5" cols="40"><?php
424
  // Accomodate editing the current dropdown values or create dropdown value example.
425
  if ( $mode == 'edit' ) {
145
  $wpmem_newfields[ $nrow ][5] = 'y';
146
  }
147
 
 
 
 
148
  $chkreq = ( $wpmem_newfields[$nrow][4] != 'y' && $wpmem_newfields[$nrow][5] == 'y' ) ? 'err' : false;
149
 
150
  $wpmem_newfields[$nrow][6] = $wpmem_fields[$row][6];
369
  </li>
370
  <li>
371
  <label>&nbsp;</label>
372
+ <span class="description"><?php _e( 'Accepted file types should be set like this: jpg|jpeg|png|gif', 'wp-members' ); ?></span>
373
  </li>
374
  <?php echo ( $mode == 'add' ) ? '</div>' : ''; ?>
375
  <?php } ?>
376
  <?php if ( $mode == 'add' || ( $mode == 'edit' && $field_arr[3] == 'checkbox' ) ) { ?>
377
  <?php echo ( $mode == 'add' ) ? '<div id="wpmem_checkbox_info">' : ''; ?>
 
 
 
378
  <li>
379
  <label><?php _e( 'Checked by default?', 'wp-members' ); ?></label>
380
  <input type="checkbox" name="add_checked_default" value="y" <?php echo ( $mode == 'edit' && $field_arr[3] == 'checkbox' ) ? checked( 'y', $field_arr[8] ) : false; ?> />
392
  }
393
  if ( $mode == 'add' || ( $mode == 'edit' && $additional_settings ) ) { ?>
394
  <?php echo ( $mode == 'add' ) ? '<div id="wpmem_dropdown_info">' : ''; ?>
 
 
 
395
  <?php if ( $mode == 'add' || ( $mode == 'edit' && $delimiter_settings ) ) {
396
  echo ( $mode == 'add' ) ? '<div id="wpmem_delimiter_info">' : '';
397
  if ( isset( $field_arr[8] ) && ( "|" == $field_arr[8] || "," == $field_arr[8] ) ) {
410
  <?php echo ( $mode == 'add' ) ? '</div>' : '';
411
  } ?>
412
  <li>
413
+ <label style="vertical-align:top"><?php _e( 'Values (Displayed|Stored):', 'wp-members' ); ?></label>
414
  <textarea name="add_dropdown_value" rows="5" cols="40"><?php
415
  // Accomodate editing the current dropdown values or create dropdown value example.
416
  if ( $mode == 'edit' ) {
admin/user-profile.php CHANGED
@@ -253,7 +253,11 @@ function wpmem_admin_update() {
253
  }
254
  }
255
 
256
- ( defined( 'WPMEM_EXP_MODULE' ) && $wpmem->use_exp == 1 ) ? wpmem_a_extend_user( $user_id ) : '';
 
 
 
 
257
 
258
  /**
259
  * Fires after the user profile is updated.
@@ -325,7 +329,9 @@ global $wpmem;
325
  */
326
  if ( defined( 'WPMEM_EXP_MODULE' ) && $wpmem->use_exp == 1 ) {
327
  if ( ( $wpmem->mod_reg == 1 && get_user_meta( $user_id, 'active', true ) == 1 ) || ( $wpmem->mod_reg != 1 ) ) {
328
- wpmem_a_extenduser( $user_id );
 
 
329
  }
330
  }
331
  }
253
  }
254
  }
255
 
256
+ if ( defined( 'WPMEM_EXP_MODULE' ) && $wpmem->use_exp == 1 ) {
257
+ if ( function_exists( 'wpmem_a_extenduser' ) ) {
258
+ wpmem_a_extend_user( $user_id );
259
+ }
260
+ }
261
 
262
  /**
263
  * Fires after the user profile is updated.
329
  */
330
  if ( defined( 'WPMEM_EXP_MODULE' ) && $wpmem->use_exp == 1 ) {
331
  if ( ( $wpmem->mod_reg == 1 && get_user_meta( $user_id, 'active', true ) == 1 ) || ( $wpmem->mod_reg != 1 ) ) {
332
+ if ( function_exists( 'wpmem_a_extenduser' ) ) {
333
+ wpmem_a_extenduser( $user_id );
334
+ }
335
  }
336
  }
337
  }
changelog.txt CHANGED
@@ -1,3 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  = 3.1.2 =
2
 
3
  * Minimum WordPress version increased to 3.6.
1
+ = 3.1.4 =
2
+
3
+ * Change to the way the PayPal extension is integrated with the main plugin. This allows for some necessary filename changes in the extension.
4
+ * Added checks for PayPal extension function calls within the main plugin to avoid possible errors if it is deactivated.
5
+ * New wpmem_is_tab() API function checks the current tab in the plugin's admin panel.
6
+ * New wpmem_is_reg_page() API function checks if the page the user registered on is the registration page.
7
+ * New wpmem_load_dropins() API function runs dropin load function.
8
+ * Documentation updates, cleaned up and addressed several @todo tags.
9
+ * Updated [wpmem_field] shortcode to display display values instead of stored values for select (dropdown), multiple select, multiple checkbox, and radio group field types.
10
+ * Fixed bug in admin js file introduced when forgot username shortcode was added.
11
+
12
+ = 3.1.3 =
13
+
14
+ * Fixed issue with display of [wp-members] field tag. Note: although this tag should remain operable, the tag is officially obsolete since 2.9.8 and should be used as [wpmem_field].
15
+ * Fixed issue with calling PayPal extension functions if settings are enabled but the extension is disabled.
16
+ * Updated some admin-side strings for translation.
17
+ * Updated wpmem_redirect_to_login() to __not__ check for wpmem_is_blocked(). Handling that outside the function will expand its usability.
18
+ * Updated row_after logic in login form function so that it can be used for adding tags at the end of a row w/o adding a tag at the beginning.
19
+ * Updated widget to check for wpmem_do_sidebar() instead of obsolete wpmem() function.
20
+ * Updated email shortcodes used in new install.
21
+ * Added new utility function wpmem_get() for checking posted variables and query strings with isset() and setting a default value.
22
+ * Added a nonce to register redirect by shortcode parameter. This will lead to being able to display a success message on the redirected page.
23
+ * Added redirect_to argument in wpmem_redirect_to_login().
24
+ * Added generic registration error message.
25
+ * Added [wpmem_form forgot_username] shortcode for displaying the forgot username form.
26
+
27
  = 3.1.2 =
28
 
29
  * Minimum WordPress version increased to 3.6.
inc/api.php CHANGED
@@ -25,6 +25,8 @@
25
  * - wpmem_user_has_role
26
  * - wpmem_create_membership_number
27
  * - wpmem_login_status
 
 
28
  */
29
 
30
 
@@ -280,4 +282,38 @@ function wpmem_login_status( $echo = true ) {
280
  }
281
  return $status;
282
  }
283
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25
  * - wpmem_user_has_role
26
  * - wpmem_create_membership_number
27
  * - wpmem_login_status
28
+ * - wpmem_is_reg_page
29
+ * - wpmem_load_dropins
30
  */
31
 
32
 
282
  }
283
  return $status;
284
  }
285
+ }
286
+
287
+
288
+ /**
289
+ * Compares wpmem_reg_page value with the register page URL.
290
+ *
291
+ * @since 3.1.4
292
+ *
293
+ * @param string|int $check_page
294
+ * @return bool
295
+ */
296
+ function wpmem_is_reg_page( $check ) {
297
+ if ( ! is_int( $check ) ) {
298
+ global $wpdb;
299
+ $sql = "SELECT ID FROM $wpdb->posts WHERE post_name = '$check' AND post_status = 'publish' LIMIT 1";
300
+ $arr = $wpdb->get_results( $sql, ARRAY_A );
301
+ $check = $arr[0]['ID'];
302
+ }
303
+ $reg_page = wpmem_get( 'wpmem_reg_page' );
304
+ $check_page = get_permalink( $check );
305
+ return ( $check_page == $reg_page ) ? true : false;
306
+ }
307
+
308
+
309
+ /**
310
+ * Wrapper for load_dropins()
311
+ *
312
+ * @since 3.1.4
313
+ */
314
+ function wpmem_load_dropins() {
315
+ global $wpmem;
316
+ $wpmem->load_dropins();
317
+ }
318
+
319
+ // End of file.
inc/class-wp-members.php CHANGED
@@ -79,6 +79,9 @@ class WP_Members {
79
  * Plugin initialization function to load shortcodes.
80
  *
81
  * @since 3.0.0
 
 
 
82
  */
83
  function load_shortcodes() {
84
 
@@ -86,9 +89,6 @@ class WP_Members {
86
  * Load the shortcode functions.
87
  *
88
  * @since 3.0.0
89
- * @since 3.0.7 Added wpmem_show_count.
90
- * @since 3.1.0 Added wpmem_profile.
91
- * @since 3.1.1 Added wpmem_loginout.
92
  */
93
  require_once( WPMEM_PATH . 'inc/shortcodes.php' );
94
 
@@ -157,11 +157,11 @@ class WP_Members {
157
  function load_dropins() {
158
 
159
  /**
160
- * Filters the dropin file folder.
161
  *
162
  * @since 3.0.0
163
  *
164
- * @param string $folder The dropin file folder.
165
  */
166
  $folder = apply_filters( 'wpmem_dropin_folder', WP_PLUGIN_DIR . '/wp-members-dropins/' );
167
 
@@ -171,7 +171,7 @@ class WP_Members {
171
  }
172
 
173
  /**
174
- * Fires after dropins load (for adding additional dropings).
175
  *
176
  * @since 3.0.0
177
  */
@@ -225,14 +225,18 @@ class WP_Members {
225
  /**
226
  * Gets the regchk value.
227
  *
 
 
 
 
 
 
228
  * @since 3.0.0
229
  *
230
  * @global string $wpmem_a The WP-Members action variable.
231
  *
232
- * @param string $action The action being done.
233
  * @return string The regchk value.
234
- *
235
- * @todo Describe regchk.
236
  */
237
  function get_regchk( $action ) {
238
 
@@ -282,7 +286,7 @@ class WP_Members {
282
  */
283
  $regchk = apply_filters( 'wpmem_regchk', $regchk, $action );
284
 
285
- // @todo Remove legacy global variable.
286
  global $wpmem_regchk;
287
  $wpmem_regchk = $regchk;
288
 
79
  * Plugin initialization function to load shortcodes.
80
  *
81
  * @since 3.0.0
82
+ * @since 3.0.7 Added wpmem_show_count.
83
+ * @since 3.1.0 Added wpmem_profile.
84
+ * @since 3.1.1 Added wpmem_loginout.
85
  */
86
  function load_shortcodes() {
87
 
89
  * Load the shortcode functions.
90
  *
91
  * @since 3.0.0
 
 
 
92
  */
93
  require_once( WPMEM_PATH . 'inc/shortcodes.php' );
94
 
157
  function load_dropins() {
158
 
159
  /**
160
+ * Filters the drop-in file folder.
161
  *
162
  * @since 3.0.0
163
  *
164
+ * @param string $folder The drop-in file folder.
165
  */
166
  $folder = apply_filters( 'wpmem_dropin_folder', WP_PLUGIN_DIR . '/wp-members-dropins/' );
167
 
171
  }
172
 
173
  /**
174
+ * Fires after dropins load (for adding additional drop-ins).
175
  *
176
  * @since 3.0.0
177
  */
225
  /**
226
  * Gets the regchk value.
227
  *
228
+ * regchk is a legacy variable that contains information about the current
229
+ * action being performed. Login, logout, password, registration, profile
230
+ * update functions all return a specific value that is stored in regchk.
231
+ * This value and information about the current action can then be used to
232
+ * determine what content is to be displayed by the securify function.
233
+ *
234
  * @since 3.0.0
235
  *
236
  * @global string $wpmem_a The WP-Members action variable.
237
  *
238
+ * @param string $action The current action.
239
  * @return string The regchk value.
 
 
240
  */
241
  function get_regchk( $action ) {
242
 
286
  */
287
  $regchk = apply_filters( 'wpmem_regchk', $regchk, $action );
288
 
289
+ // Legacy global variable for use with older extensions.
290
  global $wpmem_regchk;
291
  $wpmem_regchk = $regchk;
292
 
inc/core.php CHANGED
@@ -154,9 +154,9 @@ function wpmem_login() {
154
 
155
  // Determine where to put the user after login.
156
  if ( isset( $_POST['redirect_to'] ) ) {
157
- $redirect_to = trim( $_POST['redirect_to'] );
158
  } else {
159
- $redirect_to = $_SERVER['REQUEST_URI'] . ( ( isset( $_SERVER['QUERY_STRING'] ) ) ? $_SERVER['QUERY_STRING'] : '' );
160
  }
161
 
162
  /**
@@ -463,7 +463,6 @@ function wpmem_wp_reg_validate( $errors, $sanitized_user_login, $user_email ) {
463
  global $wpmem;
464
 
465
  // Get any meta fields that should be excluded.
466
- // @todo This needs to change to $wpmem->excluded_fields($tag).
467
  $exclude = wpmem_get_excluded_meta( 'register' );
468
 
469
  foreach ( $wpmem->fields as $field ) {
@@ -502,7 +501,6 @@ function wpmem_wp_reg_finalize( $user_id ) {
502
  $add_new = ( isset( $_POST['action'] ) && $_POST['action'] == 'createuser' ) ? true : false;
503
  if ( $native_reg || $add_new ) {
504
  // Get any excluded meta fields.
505
- // @todo This needs to change to $wpmem->excluded_fields($tag).
506
  $exclude = wpmem_get_excluded_meta( 'register' );
507
  foreach ( $wpmem->fields as $meta ) {
508
  if ( isset( $_POST[ $meta[2] ] ) && ! in_array( $meta[2], $exclude ) && 'file' != $meta[3] && 'image' != $meta[3] ) {
154
 
155
  // Determine where to put the user after login.
156
  if ( isset( $_POST['redirect_to'] ) ) {
157
+ $redirect_to = esc_url( trim( $_POST['redirect_to'] ) );
158
  } else {
159
+ $redirect_to = esc_url( $_SERVER['REQUEST_URI'] . ( ( isset( $_SERVER['QUERY_STRING'] ) ) ? $_SERVER['QUERY_STRING'] : '' ) );
160
  }
161
 
162
  /**
463
  global $wpmem;
464
 
465
  // Get any meta fields that should be excluded.
 
466
  $exclude = wpmem_get_excluded_meta( 'register' );
467
 
468
  foreach ( $wpmem->fields as $field ) {
501
  $add_new = ( isset( $_POST['action'] ) && $_POST['action'] == 'createuser' ) ? true : false;
502
  if ( $native_reg || $add_new ) {
503
  // Get any excluded meta fields.
 
504
  $exclude = wpmem_get_excluded_meta( 'register' );
505
  foreach ( $wpmem->fields as $meta ) {
506
  if ( isset( $_POST[ $meta[2] ] ) && ! in_array( $meta[2], $exclude ) && 'file' != $meta[3] && 'image' != $meta[3] ) {
inc/dialogs.php CHANGED
@@ -53,7 +53,7 @@ function wpmem_inc_loginfailed() {
53
  'p_before' => '<p>',
54
  'message' => $wpmem->get_text( 'login_failed' ),
55
  'p_after' => '</p>',
56
- 'link' => '<a href="' . $_SERVER['REQUEST_URI'] . '">' . $wpmem->get_text( 'login_failed_link' ) . '</a>',
57
  );
58
 
59
  /**
53
  'p_before' => '<p>',
54
  'message' => $wpmem->get_text( 'login_failed' ),
55
  'p_after' => '</p>',
56
+ 'link' => '<a href="' . esc_url( $_SERVER['REQUEST_URI'] ) . '">' . $wpmem->get_text( 'login_failed_link' ) . '</a>',
57
  );
58
 
59
  /**
inc/forms.php CHANGED
@@ -33,24 +33,24 @@ if ( ! function_exists( 'wpmem_inc_login' ) ):
33
  * Loads the login form for user login.
34
  *
35
  * @since 1.8
 
36
  *
37
- * @global object $wpmem The WP_Members object.
38
- * @global string $wpmem_regchk The WP-Members message container.
39
  * @global object $post The WordPress Post object.
40
- *
41
- * @param string $page
42
- * @param string $redirect_to
43
- * @return string $str The generated html for the login form.
 
44
  */
45
  function wpmem_inc_login( $page = "page", $redirect_to = null, $show = 'show' ) {
46
 
47
- global $wpmem, $wpmem_regchk, $post;
48
 
49
  $str = '';
50
 
51
  if ( $page == "page" ) {
52
 
53
- if ( $wpmem_regchk != "success" ) {
54
 
55
  $dialogs = get_option( 'wpmembers_dialogs' );
56
 
@@ -98,7 +98,7 @@ function wpmem_inc_login( $page = "page", $redirect_to = null, $show = 'show' )
98
  */
99
  $default_inputs = apply_filters( 'wpmem_inc_login_inputs', $default_inputs );
100
 
101
- $defaults = array(
102
  'heading' => $wpmem->get_text( 'login_heading' ),
103
  'action' => 'login',
104
  'button_text' => $wpmem->get_text( 'login_button' ),
33
  * Loads the login form for user login.
34
  *
35
  * @since 1.8
36
+ * @since 3.1.4 Global $wpmem_regchk no longer needed.
37
  *
 
 
38
  * @global object $post The WordPress Post object.
39
+ * @global object $wpmem The WP_Members object.
40
+ * @param string $page If the form is being displayed in place of blocked content. Default: page.
41
+ * @param string $redirect_to Redirect URL. Default: null.
42
+ * @param string $show If the form is being displayed in place of blocked content. Default: show.
43
+ * @return string $str The generated html for the login form.
44
  */
45
  function wpmem_inc_login( $page = "page", $redirect_to = null, $show = 'show' ) {
46
 
47
+ global $post, $wpmem;
48
 
49
  $str = '';
50
 
51
  if ( $page == "page" ) {
52
 
53
+ if ( $wpmem->regchk != "success" ) {
54
 
55
  $dialogs = get_option( 'wpmembers_dialogs' );
56
 
98
  */
99
  $default_inputs = apply_filters( 'wpmem_inc_login_inputs', $default_inputs );
100
 
101
+ $defaults = array(
102
  'heading' => $wpmem->get_text( 'login_heading' ),
103
  'action' => 'login',
104
  'button_text' => $wpmem->get_text( 'login_button' ),
inc/register.php CHANGED
@@ -251,7 +251,7 @@ function wpmem_registration( $tag ) {
251
  $privatekey = $wpmem_captcha['recaptcha']['private'];
252
 
253
  // Validate the captcha.
254
- $response = file_get_contents( "https://www.google.com/recaptcha/api/siteverify?secret=" . $privatekey . "&response=" . $captcha . "&remoteip=" . $_SERVER['REMOTE_ADDR'] );
255
 
256
  // Decode the json response.
257
  $response = json_decode( $response, true );
@@ -259,6 +259,12 @@ function wpmem_registration( $tag ) {
259
  // If captcha validation was unsuccessful.
260
  if ( $response['success'] == false ) {
261
  $wpmem_themsg = $wpmem->get_text( 'reg_invalid_captcha' );
 
 
 
 
 
 
262
  return "empty"; exit();
263
  }
264
  }
251
  $privatekey = $wpmem_captcha['recaptcha']['private'];
252
 
253
  // Validate the captcha.
254
+ $response = wp_remote_fopen( "https://www.google.com/recaptcha/api/siteverify?secret=" . $privatekey . "&response=" . $captcha . "&remoteip=" . $_SERVER['REMOTE_ADDR'] );
255
 
256
  // Decode the json response.
257
  $response = json_decode( $response, true );
259
  // If captcha validation was unsuccessful.
260
  if ( $response['success'] == false ) {
261
  $wpmem_themsg = $wpmem->get_text( 'reg_invalid_captcha' );
262
+ if ( WP_DEBUG && isset( $response['error-codes'] ) ) {
263
+ $wpmem_themsg.= '<br /><br />';
264
+ foreach( $response['error-codes'] as $code ) {
265
+ $wpmem_themsg.= "Error code: " . $code . "<br />";
266
+ }
267
+ }
268
  return "empty"; exit();
269
  }
270
  }
inc/shortcodes.php CHANGED
@@ -28,25 +28,6 @@
28
  * - wpmem_sc_tos
29
  */
30
 
31
-
32
- /**
33
- @todo:
34
-
35
- New shortcodes will include [wpmem_form] to display various forms.
36
-
37
- Forms to be called with single attribute, such as [wpmem_form login] or [wpmem_form register]
38
-
39
- Forms should nest for logged in state as well, so we can do:
40
- [wpmem_form login]This would be logged in content.[/wpmem_form]
41
-
42
- Need to have a single stage password reset?
43
-
44
- Need to have a form for forgotten username. This would be a totally new process.
45
- [wpmem_form forgot_username]?
46
-
47
- */
48
-
49
-
50
  /**
51
  * Function for forms called by shortcode.
52
  *
@@ -591,6 +572,22 @@ function wpmem_sc_fields( $atts, $content, $tag ) {
591
  $the_user_ID = get_current_user_id();
592
  }
593
  $user_info = get_userdata( $the_user_ID );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
594
 
595
  if ( isset( $atts['underscores'] ) && 'off' == $atts['underscores'] && $user_info ) {
596
  $user_info->{$atts['field']} = str_replace( '_', ' ', $user_info->{$atts['field']} );
28
  * - wpmem_sc_tos
29
  */
30
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
  /**
32
  * Function for forms called by shortcode.
33
  *
572
  $the_user_ID = get_current_user_id();
573
  }
574
  $user_info = get_userdata( $the_user_ID );
575
+
576
+ // @todo - Need a long term scalable solution that fits with new fields array.
577
+ global $wpmem;
578
+ if ( ! isset( $wpmem->field_keys ) ) {
579
+ $wpmem->field_keys = $wpmem->api->get_field_keys_by_meta();
580
+ }
581
+ if ( isset( $wpmem->field_keys[ $atts['field'] ] ) ) {
582
+ $field_type = $wpmem->fields[ $wpmem->field_keys[ $atts['field'] ] ][3];
583
+ }
584
+ $array_fields = array( 'select', 'multiselect', 'multicheckbox', 'radio' );
585
+ if ( isset( $field_type ) && in_array( $field_type, $array_fields ) ) {
586
+ $display_values = $wpmem->api->get_select_display_values( $atts['field'] );
587
+ $user_info->{$atts['field']} = $display_values[ $user_info->{$atts['field']} ];
588
+ }
589
+ // @todo - End todo.
590
+
591
 
592
  if ( isset( $atts['underscores'] ) && 'off' == $atts['underscores'] && $user_info ) {
593
  $user_info->{$atts['field']} = str_replace( '_', ' ', $user_info->{$atts['field']} );
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.6
5
  Tested up to: 4.6.0
6
- Stable tag: 3.1.3.1
7
  License: GPLv2
8
 
9
  WP-Members&trade; is a free membership management framework for WordPress&reg; that restricts content to registered users.
@@ -112,7 +112,8 @@ Premium priority support is available at the plugin's site [RocketGeek.com](http
112
 
113
  == Upgrade Notice ==
114
 
115
- WP-Members 3.1.3 is primarily a fix update (see changelog). Minimum WP version is 3.6.
 
116
 
117
  == Screenshots ==
118
 
@@ -135,9 +136,25 @@ WP-Members 3.1.3 is primarily a fix update (see changelog). Minimum WP version i
135
 
136
  == Changelog ==
137
 
138
- = 3.1.3.1 =
139
 
140
- * Fixes missing /admin/includes/api.php file.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
141
 
142
  = 3.1.3 =
143
 
3
  Tags: access, authentication, content, login, member, membership, password, protect, register, registration, restriction, subscriber
4
  Requires at least: 3.6
5
  Tested up to: 4.6.0
6
+ Stable tag: 3.1.4.2
7
  License: GPLv2
8
 
9
  WP-Members&trade; is a free membership management framework for WordPress&reg; that restricts content to registered users.
112
 
113
  == Upgrade Notice ==
114
 
115
+ WP-Members 3.1.4.2 addresses an issue with loading the PayPal extension from the 3.1.4 update.
116
+ WP-Members 3.1.4 is primarily a feature update (see changelog). Minimum WP version is 3.6.
117
 
118
  == Screenshots ==
119
 
136
 
137
  == Changelog ==
138
 
139
+ = 3.1.4.2 =
140
 
141
+ * Addressed an issue with the change to the way the PayPal extension is now loaded in 3.1.4. This update allows for backward compatibility with versions of the PayPal extension (expirations module) prior to version 0.7.0.
142
+ * Updates to reCAPTCHA2. Trims keys on save to avoid possible copy/paste whitespace issues, displays API error code(s) if WP_DEBUG is turned on, change use of file_get_contents() to wp_remote_fopen() for broader acceptable use.
143
+
144
+ = 3.1.4.1 =
145
+
146
+ * Corrected an issue with the [wpmem_field] shortcode where fields that are not actually saved in the plugin's fields array (fields found in the plugin's fields tab) would not display.
147
+
148
+ = 3.1.4 =
149
+
150
+ * Change to the way the PayPal extension is integrated with the main plugin. This allows for some necessary filename changes in the extension.
151
+ * Added checks for PayPal extension function calls within the main plugin to avoid possible errors if it is deactivated.
152
+ * New wpmem_is_tab() API function checks the current tab in the plugin's admin panel.
153
+ * New wpmem_is_reg_page() API function checks if the page the user registered on is the registration page.
154
+ * New wpmem_load_dropins() API function runs dropin load function.
155
+ * Documentation updates, cleaned up and addressed several @todo tags.
156
+ * Updated [wpmem_field] shortcode to display display values instead of stored values for select (dropdown), multiple select, multiple checkbox, and radio group field types.
157
+ * Fixed bug in admin js file introduced when forgot username shortcode was added.
158
 
159
  = 3.1.3 =
160
 
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.1.3.1
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.1.3.1' );
66
  define( 'WPMEM_DEBUG', false );
67
  define( 'WPMEM_DIR', plugin_dir_url ( __FILE__ ) );
68
  define( 'WPMEM_PATH', plugin_dir_path( __FILE__ ) );
@@ -134,15 +134,7 @@ function wpmem_init() {
134
  }
135
 
136
  // Preload the expiration module, if available.
137
- $exp_plugin = 'wp-members-expiration/module.php';
138
- $exp_active = ( in_array( $exp_plugin, get_option( 'active_plugins' ) ) ) ? true : false;
139
- // Check multisite network active
140
- if ( is_multisite() ) {
141
- if ( ! function_exists( 'is_plugin_active_for_network' ) ) {
142
- require_once( ABSPATH . '/wp-admin/includes/plugin.php' );
143
- }
144
- $exp_active = ( is_plugin_active_for_network( $exp_plugin ) ) ? true : $exp_active;
145
- }
146
  define( 'WPMEM_EXP_MODULE', $exp_active );
147
 
148
  /**
@@ -315,7 +307,7 @@ function wpmem_mu_new_site( $blog_id, $user_id, $domain, $path, $site_id, $meta
315
  */
316
  function wpmem_load_textdomain() {
317
 
318
- // @todo See: https://ulrich.pogson.ch/load-theme-plugin-translations for notes on changes.
319
 
320
  // Plugin textdomain.
321
  $domain = 'wp-members';
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.1.4.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.1.4.2' );
66
  define( 'WPMEM_DEBUG', false );
67
  define( 'WPMEM_DIR', plugin_dir_url ( __FILE__ ) );
68
  define( 'WPMEM_PATH', plugin_dir_path( __FILE__ ) );
134
  }
135
 
136
  // Preload the expiration module, if available.
137
+ $exp_active = ( function_exists( 'wpmem_exp_init' ) || function_exists( 'wpmem_set_exp' ) ) ? true : false;
 
 
 
 
 
 
 
 
138
  define( 'WPMEM_EXP_MODULE', $exp_active );
139
 
140
  /**
307
  */
308
  function wpmem_load_textdomain() {
309
 
310
+ // @see: https://ulrich.pogson.ch/load-theme-plugin-translations for notes on changes.
311
 
312
  // Plugin textdomain.
313
  $domain = 'wp-members';