WP-Members Membership Plugin - Version 3.1.3

Version Description

  • 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].
  • Fixed issue with calling PayPal extension functions if settings are enabled but the extension is disabled.
  • Updated some admin-side strings for translation.
  • Updated wpmem_redirect_to_login() to not check for wpmem_is_blocked(). Handling that outside the function will expand its usability.
  • 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.
  • Updated widget to check for wpmem_do_sidebar() instead of obsolete wpmem() function.
  • Updated email shortcodes used in new install.
  • Added new utility function wpmem_get() for checking posted variables and query strings with isset() and setting a default value.
  • Added a nonce to register redirect by shortcode parameter. This will lead to being able to display a success message on the redirected page.
  • Added redirect_to argument in wpmem_redirect_to_login().
  • Added generic registration error message.
  • Added [wpmem_form forgot_username] shortcode for displaying the forgot username form.
Download this release

Release Info

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

Code changes from version 3.1.2 to 3.1.3

admin/admin.php CHANGED
@@ -294,50 +294,4 @@ function wpmem_admin_enqueue_scripts( $hook ) {
294
  }
295
  }
296
 
297
-
298
- /**
299
- * Wrapper function for adding custom emails.
300
- *
301
- * @since 3.1.1
302
- *
303
- * @global object $wpmem The WP_Members object class.
304
- * @param string $tag Slug for the custom email.
305
- * @param string $heading Heading to display in admin panel.
306
- * @param string $subject_input Slug for the subject.
307
- * @param string $message_input Slug for the message body.
308
- */
309
- function wpmem_add_custom_email( $tag, $heading, $subject_input, $message_input ) {
310
- global $wpmem;
311
- $args = array(
312
- 'name' => $tag,
313
- 'heading' => $heading,
314
- 'subject_input' => $subject_input,
315
- 'body_input' => $message_input,
316
- );
317
- $wpmem->admin->add_email( $args );
318
- }
319
-
320
-
321
- /**
322
- * Wrapper function for adding custom dialogs.
323
- *
324
- * @since 3.1.1
325
- *
326
- * @param array $dialogs Dialog settings array.
327
- * @param string $tag Slug for dialog to be added.
328
- * @param string $msg The dialog message.
329
- * @param string $label Label for admin panel.
330
- * @return array $dialogs Dialog settings array with prepped custom dialog added.
331
- */
332
- function wpmem_add_custom_dialog( $dialogs, $tag, $msg, $label ) {
333
- if ( is_admin() && isset( $_GET['tab'] ) && 'dialogs' == $_GET['tab'] ) {
334
- $dialogs[ $tag ] = array(
335
- 'name' => $tag,
336
- 'label' => $label,
337
- 'value' => ( ! isset( $dialogs[ $tag ] ) ) ? $msg : $dialogs[ $tag ],
338
- );
339
- }
340
- return $dialogs;
341
- }
342
-
343
  // End of File.
294
  }
295
  }
296
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
297
  // End of File.
admin/includes/api.php ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * WP-Members Admin API Functions
4
+ *
5
+ * This file is part of the WP-Members plugin by Chad Butler
6
+ * You can find out more about this plugin at http://rocketgeek.com
7
+ * Copyright (c) 2006-2016 Chad Butler
8
+ * WP-Members(tm) is a trademark of butlerblog.com
9
+ *
10
+ * @package WP-Members
11
+ * @author Chad Butler
12
+ * @copyright 2006-2016
13
+ *
14
+ * Functions included:
15
+ * - wpmem_add_custom_email
16
+ * - wpmem_add_custom_dialog
17
+ */
18
+
19
+ /**
20
+ * Wrapper function for adding custom emails.
21
+ *
22
+ * @since 3.1.1
23
+ *
24
+ * @global object $wpmem The WP_Members object class.
25
+ * @param string $tag Slug for the custom email.
26
+ * @param string $heading Heading to display in admin panel.
27
+ * @param string $subject_input Slug for the subject.
28
+ * @param string $message_input Slug for the message body.
29
+ */
30
+ function wpmem_add_custom_email( $tag, $heading, $subject_input, $message_input ) {
31
+ global $wpmem;
32
+ $args = array(
33
+ 'name' => $tag,
34
+ 'heading' => $heading,
35
+ 'subject_input' => $subject_input,
36
+ 'body_input' => $message_input,
37
+ );
38
+ $wpmem->admin->add_email( $args );
39
+ }
40
+
41
+ /**
42
+ * Wrapper function for adding custom dialogs.
43
+ *
44
+ * @since 3.1.1
45
+ *
46
+ * @param array $dialogs Dialog settings array.
47
+ * @param string $tag Slug for dialog to be added.
48
+ * @param string $msg The dialog message.
49
+ * @param string $label Label for admin panel.
50
+ * @return array $dialogs Dialog settings array with prepped custom dialog added.
51
+ */
52
+ function wpmem_add_custom_dialog( $dialogs, $tag, $msg, $label ) {
53
+ if ( is_admin() && isset( $_GET['tab'] ) && 'dialogs' == $_GET['tab'] ) {
54
+ $dialogs[ $tag ] = array(
55
+ 'name' => $tag,
56
+ 'label' => $label,
57
+ 'value' => ( ! isset( $dialogs[ $tag ] ) ) ? $msg : $dialogs[ $tag ],
58
+ );
59
+ }
60
+ return $dialogs;
61
+ }
admin/includes/class-wp-members-admin-api.php CHANGED
@@ -87,6 +87,7 @@ class WP_Members_Admin_API {
87
  }
88
  require_once( WPMEM_PATH . 'inc/users.php' );
89
  require_once( WPMEM_PATH . 'admin/users.php' );
 
90
  }
91
 
92
  /**
@@ -182,8 +183,8 @@ class WP_Members_Admin_API {
182
  */
183
  function email_update( $args ) {
184
  $settings = array(
185
- 'subj' => ( isset( $_POST[ $args['subject_input'] ] ) ) ? $_POST[ $args['subject_input'] ] : '',
186
- 'body' => ( isset( $_POST[ $args['body_input'] ] ) ) ? $_POST[ $args['body_input'] ] : '',
187
  );
188
  update_option( $args['name'], $settings, true );
189
  $this->emails[ $args['name'] ]['subject_value'] = $settings['subj'];
@@ -413,7 +414,7 @@ class WP_Members_Admin_API {
413
  $this->current_form = $current_form;
414
  $this->current_form_fields = $fields;
415
  */
416
- $current_form = ( isset( $_GET['form'] ) ) ? $_GET['form'] : $form;
417
  $this->current_form = $current_form;
418
  global $wpmem;
419
  // Add numeric array form fields as associative
87
  }
88
  require_once( WPMEM_PATH . 'inc/users.php' );
89
  require_once( WPMEM_PATH . 'admin/users.php' );
90
+ require_once( WPMEM_PATH . 'admin/includes/api.php' );
91
  }
92
 
93
  /**
183
  */
184
  function email_update( $args ) {
185
  $settings = array(
186
+ 'subj' => wpmem_get( $args['subject_input'] ),
187
+ 'body' => wpmem_get( $args['body_input'] ),
188
  );
189
  update_option( $args['name'], $settings, true );
190
  $this->emails[ $args['name'] ]['subject_value'] = $settings['subj'];
414
  $this->current_form = $current_form;
415
  $this->current_form_fields = $fields;
416
  */
417
+ $current_form = wpmem_get( 'form', $form, 'get' ); //( isset( $_GET['form'] ) ) ? $_GET['form'] : $form;
418
  $this->current_form = $current_form;
419
  global $wpmem;
420
  // Add numeric array form fields as associative
admin/js/shortcodes_tinymce_4.js CHANGED
@@ -107,6 +107,12 @@
107
  editor.insertContent('[wpmem_logged_in][wpmem_form user_edit][/wpmem_logged_in]');
108
  }
109
  },
 
 
 
 
 
 
110
  ]
111
  },
112
  {
107
  editor.insertContent('[wpmem_logged_in][wpmem_form user_edit][/wpmem_logged_in]');
108
  }
109
  },
110
+ {
111
+ text: "Forgot Username"
112
+ onclick: function(){
113
+ editor.insertContent('[wpmem_logged_out][wpmem_form forgot_username][/wpmem_logged_out]');
114
+ }
115
+ },
116
  ]
117
  },
118
  {
admin/post.php CHANGED
@@ -146,8 +146,8 @@ function wpmem_posts_admin_notices() {
146
 
147
  global $pagenow, $post_type;
148
  if ( $pagenow == 'edit.php' && isset( $_REQUEST['a'] ) ) {
149
- $action = ( $_REQUEST['a'] == 'block' ) ? 'blocked' : 'unblocked';
150
- echo '<div class="updated"><p>' . $_REQUEST['n'] . ' ' . $post_type . ' ' . $action . '</p></div>';
151
  }
152
  }
153
 
146
 
147
  global $pagenow, $post_type;
148
  if ( $pagenow == 'edit.php' && isset( $_REQUEST['a'] ) ) {
149
+ $msg = ( $_REQUEST['a'] == 'block' ) ? sprintf( __( '%s blocked', 'wp-members' ), $post_type ) : sprintf( __( '%s unblocked', 'wp-members' ), $post_type );
150
+ echo '<div class="updated"><p>' . $_REQUEST['n'] . ' ' . $msg . '</p></div>';
151
  }
152
  }
153
 
admin/tab-fields.php CHANGED
@@ -71,13 +71,13 @@ function wpmem_a_field_reorder() {
71
  $wpmem_old_fields = get_option( 'wpmembers_fields' );
72
  for ( $row = 0; $row < count( $new_order ); $row++ ) {
73
  if ( $row > 0 ) {
74
- $key = $new_order[$row];
75
  $key = substr( $key, 15 );
76
 
77
  for ( $x = 0; $x < count( $wpmem_old_fields ); $x++ ) {
78
 
79
- if ( $wpmem_old_fields[$x][0] == $key ) {
80
- $wpmem_new_fields[$row - 1] = $wpmem_old_fields[$x];
81
  }
82
  }
83
  }
@@ -131,7 +131,7 @@ function wpmem_update_fields( $action ) {
131
  $wpmem_newfields[$nrow][$i] = $wpmem_fields[$row][$i];
132
  }
133
 
134
- $wpmem_newfields[$nrow][0] = $nrow + 1;
135
 
136
  $display_field = $wpmem_fields[$row][2] . "_display";
137
  $require_field = $wpmem_fields[$row][2] . "_required";
@@ -141,8 +141,8 @@ function wpmem_update_fields( $action ) {
141
  $wpmem_newfields[$nrow][4] = ( isset( $_POST[$display_field] ) ) ? $_POST[$display_field] : '';
142
  $wpmem_newfields[$nrow][5] = ( isset( $_POST[$require_field] ) ) ? $_POST[$require_field] : '';
143
  } else {
144
- $wpmem_newfields[$nrow][4] = 'y';
145
- $wpmem_newfields[$nrow][5] = 'y';
146
  }
147
 
148
  // @todo Does $chkreq get used anywhere?
@@ -156,7 +156,7 @@ function wpmem_update_fields( $action ) {
156
  if ( isset( $_POST[$checked_field] ) && $_POST[$checked_field] == 'y' ) {
157
  $wpmem_newfields[$nrow][8] = 'y';
158
  } else {
159
- $wpmem_newfields[$nrow][8] = 'n';
160
  }
161
  }
162
 
@@ -253,11 +253,11 @@ function wpmem_update_fields( $action ) {
253
  } else {
254
 
255
  for ( $row = 0; $row < count( $wpmem_fields ); $row++ ) {
256
- if ( $wpmem_fields[$row][2] == $_GET['edit'] ) {
257
- $arr[0] = $wpmem_fields[$row][0];
258
  //$x = ( $arr[3] == 'checkbox' ) ? 8 : ( ( $arr[3] == 'select' || $arr[3] == 'file' ) ? 7 : 6 );
259
  for ( $r = 0; $r < count( $arr ); $r++ ) {
260
- $wpmem_fields[$row][$r] = $arr[$r];
261
  }
262
  }
263
  }
@@ -283,7 +283,7 @@ function wpmem_update_fields( $action ) {
283
  * @param string $field_id The option name of the field to be edited
284
  */
285
  function wpmem_fields_edit_link( $field_id ) {
286
- return '<a href="' . get_admin_url() . 'options-general.php?page=wpmem-settings&amp;tab=fields&amp;edit=' . $field_id . '">' . __( 'Edit' ) . '</a>';
287
  }
288
 
289
 
@@ -444,11 +444,11 @@ Last Row|last_row<?php } } ?></textarea>
444
  </li>
445
  <li>
446
  <label>&nbsp;</label>
447
- <span class="description"><?php _e( 'Options should be Option Name|option_value,', 'wp-members' ); ?>
448
  </li>
449
  <li>
450
  <label>&nbsp;</label>
451
- <a href="http://rocketgeek.com/plugins/wp-members/users-guide/registration/choosing-fields/" target="_blank"><?php _e( 'Visit plugin site for more information', 'wp-members' ); ?></a></span>
452
  </li>
453
  <?php echo ( $mode == 'add' ) ? '</div>' : ''; ?>
454
  <?php } ?>
71
  $wpmem_old_fields = get_option( 'wpmembers_fields' );
72
  for ( $row = 0; $row < count( $new_order ); $row++ ) {
73
  if ( $row > 0 ) {
74
+ $key = $new_order[ $row ];
75
  $key = substr( $key, 15 );
76
 
77
  for ( $x = 0; $x < count( $wpmem_old_fields ); $x++ ) {
78
 
79
+ if ( $wpmem_old_fields[ $x ][0] == $key ) {
80
+ $wpmem_new_fields[ $row - 1 ] = $wpmem_old_fields[ $x ];
81
  }
82
  }
83
  }
131
  $wpmem_newfields[$nrow][$i] = $wpmem_fields[$row][$i];
132
  }
133
 
134
+ $wpmem_newfields[ $nrow ][0] = $nrow + 1;
135
 
136
  $display_field = $wpmem_fields[$row][2] . "_display";
137
  $require_field = $wpmem_fields[$row][2] . "_required";
141
  $wpmem_newfields[$nrow][4] = ( isset( $_POST[$display_field] ) ) ? $_POST[$display_field] : '';
142
  $wpmem_newfields[$nrow][5] = ( isset( $_POST[$require_field] ) ) ? $_POST[$require_field] : '';
143
  } else {
144
+ $wpmem_newfields[ $nrow ][4] = 'y';
145
+ $wpmem_newfields[ $nrow ][5] = 'y';
146
  }
147
 
148
  // @todo Does $chkreq get used anywhere?
156
  if ( isset( $_POST[$checked_field] ) && $_POST[$checked_field] == 'y' ) {
157
  $wpmem_newfields[$nrow][8] = 'y';
158
  } else {
159
+ $wpmem_newfields[ $nrow ][8] = 'n';
160
  }
161
  }
162
 
253
  } else {
254
 
255
  for ( $row = 0; $row < count( $wpmem_fields ); $row++ ) {
256
+ if ( $wpmem_fields[ $row ][2] == $_GET['edit'] ) {
257
+ $arr[0] = $wpmem_fields[ $row ][0];
258
  //$x = ( $arr[3] == 'checkbox' ) ? 8 : ( ( $arr[3] == 'select' || $arr[3] == 'file' ) ? 7 : 6 );
259
  for ( $r = 0; $r < count( $arr ); $r++ ) {
260
+ $wpmem_fields[ $row ][ $r ] = $arr[ $r ];
261
  }
262
  }
263
  }
283
  * @param string $field_id The option name of the field to be edited
284
  */
285
  function wpmem_fields_edit_link( $field_id ) {
286
+ return '<a href="' . add_query_arg( array( 'page' => 'wpmem-settings', 'tab' => 'fields', 'edit' => $field_id ), get_admin_url() . 'options-general.php' ) . '">' . __( 'Edit' ) . '</a>';
287
  }
288
 
289
 
444
  </li>
445
  <li>
446
  <label>&nbsp;</label>
447
+ <span class="description"><?php _e( 'Options should be Option Name|option_value,', 'wp-members' ); ?></span>
448
  </li>
449
  <li>
450
  <label>&nbsp;</label>
451
+ <span class="description"><a href="http://rocketgeek.com/plugins/wp-members/users-guide/registration/choosing-fields/" target="_blank"><?php _e( 'Visit plugin site for more information', 'wp-members' ); ?></a></span>
452
  </li>
453
  <?php echo ( $mode == 'add' ) ? '</div>' : ''; ?>
454
  <?php } ?>
admin/tab-options.php CHANGED
@@ -390,12 +390,12 @@ function wpmem_update_options() {
390
 
391
  $wpmem_newsettings = array(
392
  'version' => WPMEM_VERSION,
393
- 'notify' => ( isset( $_POST['wpmem_settings_notify'] ) ) ? $_POST['wpmem_settings_notify'] : 0,
394
- 'mod_reg' => ( isset( $_POST['wpmem_settings_moderate'] ) ) ? $_POST['wpmem_settings_moderate'] : 0,
395
- 'captcha' => ( isset( $_POST['wpmem_settings_captcha'] ) ) ? $_POST['wpmem_settings_captcha'] : 0,
396
- 'use_exp' => ( isset( $_POST['wpmem_settings_time_exp'] ) ) ? $_POST['wpmem_settings_time_exp'] : 0,
397
- 'use_trial' => ( isset( $_POST['wpmem_settings_trial'] ) ) ? $_POST['wpmem_settings_trial'] : 0,
398
- 'warnings' => ( isset( $_POST['wpmem_settings_ignore_warnings'] ) ) ? $_POST['wpmem_settings_ignore_warnings'] : 0,
399
  'user_pages' => array(
400
  'profile' => ( $msurl ) ? $msurl : '',
401
  'register' => ( $regurl ) ? $regurl : '',
@@ -403,7 +403,7 @@ function wpmem_update_options() {
403
  ),
404
  'cssurl' => ( $cssurl ) ? $cssurl : '',
405
  'style' => $wpmem_settings_style,
406
- 'attrib' => ( isset( $_POST['attribution'] ) ) ? $_POST['attribution'] : 0,
407
  );
408
 
409
  // Build an array of post types
390
 
391
  $wpmem_newsettings = array(
392
  'version' => WPMEM_VERSION,
393
+ 'notify' => wpmem_get( 'wpmem_settings_notify', 0 ),//( isset( $_POST['wpmem_settings_notify'] ) ) ? $_POST['wpmem_settings_notify'] : 0,
394
+ 'mod_reg' => wpmem_get( 'wpmem_settings_moderate', 0 ),//( isset( $_POST['wpmem_settings_moderate'] ) ) ? $_POST['wpmem_settings_moderate'] : 0,
395
+ 'captcha' => wpmem_get( 'wpmem_settings_captcha', 0 ),//( isset( $_POST['wpmem_settings_captcha'] ) ) ? $_POST['wpmem_settings_captcha'] : 0,
396
+ 'use_exp' => wpmem_get( 'wpmem_settings_time_exp', 0 ),//( isset( $_POST['wpmem_settings_time_exp'] ) ) ? $_POST['wpmem_settings_time_exp'] : 0,
397
+ 'use_trial' => wpmem_get( 'wpmem_settings_trial', 0 ),//( isset( $_POST['wpmem_settings_trial'] ) ) ? $_POST['wpmem_settings_trial'] : 0,
398
+ 'warnings' => wpmem_get( 'wpmem_settings_ignore_warnings', 0 ),//( isset( $_POST['wpmem_settings_ignore_warnings'] ) ) ? $_POST['wpmem_settings_ignore_warnings'] : 0,
399
  'user_pages' => array(
400
  'profile' => ( $msurl ) ? $msurl : '',
401
  'register' => ( $regurl ) ? $regurl : '',
403
  ),
404
  'cssurl' => ( $cssurl ) ? $cssurl : '',
405
  'style' => $wpmem_settings_style,
406
+ 'attrib' => wpmem_get( 'attribution', 0 ),//( isset( $_POST['attribution'] ) ) ? $_POST['attribution'] : 0,
407
  );
408
 
409
  // Build an array of post types
admin/users.php CHANGED
@@ -456,8 +456,10 @@ function wpmem_a_activate_user( $user_id, $chk_pass = false ) {
456
  }
457
 
458
  // If subscriptions can expire, and the user has no expiration date, set one.
459
- if( $wpmem->use_exp == 1 && ! get_user_meta( $user_id, 'expires', true ) ) {
460
- wpmem_set_exp( $user_id );
 
 
461
  }
462
 
463
  // Generate and send user approved email to user.
456
  }
457
 
458
  // If subscriptions can expire, and the user has no expiration date, set one.
459
+ if ( $wpmem->use_exp == 1 && ! get_user_meta( $user_id, 'expires', true ) ) {
460
+ if ( function_exists( 'wpmem_set_exp' ) ) {
461
+ wpmem_set_exp( $user_id );
462
+ }
463
  }
464
 
465
  // Generate and send user approved email to user.
inc/api.php CHANGED
@@ -31,14 +31,19 @@
31
  /**
32
  * Redirects a user to defined login page with return redirect.
33
  *
 
 
 
34
  * @since 3.0.2
35
  * @since 3.1.1 Moved to API.
 
 
 
36
  */
37
- function wpmem_redirect_to_login() {
38
- if ( ! is_user_logged_in() && wpmem_is_blocked() ) {
39
- $redirect_to = urlencode( wpmem_current_url() );
40
- $url = add_query_arg( 'redirect_to', $redirect_to, wpmem_login_url() );
41
- wp_redirect( $url );
42
  exit();
43
  }
44
  return;
@@ -114,14 +119,15 @@ function wpmem_profile_url( $a = false ) {
114
  * Returns an array of user pages.
115
  *
116
  * @since 3.1.2
 
117
  *
118
- * @return array $pages
119
  */
120
  function wpmem_user_pages() {
121
  $pages = array(
122
- trailingslashit( wpmem_login_url() ),
123
- trailingslashit( wpmem_register_url() ),
124
- trailingslashit( wpmem_profile_url() ),
125
  );
126
  return $pages;
127
  }
31
  /**
32
  * Redirects a user to defined login page with return redirect.
33
  *
34
+ * While a specific URL can be passed as an argument, the default will
35
+ * redirect the user back to the original page using wpmem_current_url().
36
+ *
37
  * @since 3.0.2
38
  * @since 3.1.1 Moved to API.
39
+ * @since 3.1.3 Added $redirect_to argument.
40
+ *
41
+ * @param string $redirect_to URL to redirect to (default: false).
42
  */
43
+ function wpmem_redirect_to_login( $redirect_to = false ) {
44
+ if ( ! is_user_logged_in() ) {
45
+ $redirect_to = ( $redirect_to ) ? $redirect_to : wpmem_current_url();
46
+ wp_redirect( wpmem_login_url( $redirect_to ) );
 
47
  exit();
48
  }
49
  return;
119
  * Returns an array of user pages.
120
  *
121
  * @since 3.1.2
122
+ * @since 3.1.3 Added array keys.
123
  *
124
+ * @return array $pages
125
  */
126
  function wpmem_user_pages() {
127
  $pages = array(
128
+ 'login' => trailingslashit( wpmem_login_url() ),
129
+ 'register' => trailingslashit( wpmem_register_url() ),
130
+ 'profile' => trailingslashit( wpmem_profile_url() ),
131
  );
132
  return $pages;
133
  }
inc/class-wp-members-widget.php CHANGED
@@ -96,7 +96,9 @@ class widget_wpmemwidget extends WP_Widget {
96
  echo $args['before_title'] . apply_filters( 'wpmem_widget_title', $title ) . $args['after_title'];
97
 
98
  // The Widget
99
- if ( function_exists( 'wpmem' ) ) { wpmem_do_sidebar( $redirect_to ); }
 
 
100
 
101
  echo '</div>';
102
  echo $args['after_widget'];
96
  echo $args['before_title'] . apply_filters( 'wpmem_widget_title', $title ) . $args['after_title'];
97
 
98
  // The Widget
99
+ if ( function_exists( 'wpmem_do_sidebar' ) ) {
100
+ wpmem_do_sidebar( $redirect_to );
101
+ }
102
 
103
  echo '</div>';
104
  echo $args['after_widget'];
inc/class-wp-members.php CHANGED
@@ -649,6 +649,7 @@ class WP_Members {
649
  'reg_email_match' => __( 'Emails did not match.', 'wp-members' ),
650
  'reg_empty_captcha' => __( 'You must complete the CAPTCHA form.', 'wp-members' ),
651
  'reg_invalid_captcha' => __( 'CAPTCHA was not valid.', 'wp-members' ),
 
652
 
653
  // Links.
654
  'profile_edit' => __( 'Edit My Information', 'wp-members' ),
649
  'reg_email_match' => __( 'Emails did not match.', 'wp-members' ),
650
  'reg_empty_captcha' => __( 'You must complete the CAPTCHA form.', 'wp-members' ),
651
  'reg_invalid_captcha' => __( 'CAPTCHA was not valid.', 'wp-members' ),
652
+ 'reg_generic' => __( 'There was an error processing the form.', 'wp-members' ),
653
 
654
  // Links.
655
  'profile_edit' => __( 'Edit My Information', 'wp-members' ),
inc/core.php CHANGED
@@ -468,11 +468,12 @@ function wpmem_wp_reg_validate( $errors, $sanitized_user_login, $user_email ) {
468
 
469
  foreach ( $wpmem->fields as $field ) {
470
  $is_error = false;
471
- if ( $field[5] == 'y' && $field[2] != 'user_email' && ! in_array( $field[2], $exclude ) ) {
472
- if ( ( $field[3] == 'checkbox' || $field[3] == 'multicheckbox' || $field[3] == 'multiselect' || $field[3] == 'radio' ) && ( ! isset( $_POST[ $field[2] ] ) ) ) {
 
473
  $is_error = true;
474
  }
475
- if ( ( $field[3] != 'checkbox' && $field[3] != 'multicheckbox' && $field[3] != 'multiselect' && $field[3] != 'radio' ) && ( ! $_POST[ $field[2] ] ) ) {
476
  $is_error = true;
477
  }
478
  if ( $is_error ) { $errors->add( 'wpmem_error', sprintf( $wpmem->get_text( 'reg_empty_field' ), __( $field[1], 'wp-members' ) ) ); }
468
 
469
  foreach ( $wpmem->fields as $field ) {
470
  $is_error = false;
471
+ $meta_key = $field[2];
472
+ if ( $field[5] == 'y' && $meta_key != 'user_email' && ! in_array( $meta_key, $exclude ) ) {
473
+ if ( ( $field[3] == 'checkbox' || $field[3] == 'multicheckbox' || $field[3] == 'multiselect' || $field[3] == 'radio' ) && ( ! isset( $_POST[ $meta_key ] ) ) ) {
474
  $is_error = true;
475
  }
476
+ if ( ( $field[3] != 'checkbox' && $field[3] != 'multicheckbox' && $field[3] != 'multiselect' && $field[3] != 'radio' ) && ( ! $_POST[ $meta_key ] ) ) {
477
  $is_error = true;
478
  }
479
  if ( $is_error ) { $errors->add( 'wpmem_error', sprintf( $wpmem->get_text( 'reg_empty_field' ), __( $field[1], 'wp-members' ) ) ); }
inc/dialogs.php CHANGED
@@ -19,6 +19,8 @@
19
  * - wpmem_inc_memberlinks
20
  * - wpmem_page_pwd_reset
21
  * - wpmem_page_user_edit
 
 
22
  */
23
 
24
 
19
  * - wpmem_inc_memberlinks
20
  * - wpmem_page_pwd_reset
21
  * - wpmem_page_user_edit
22
+ * - wpmem_page_forgot_username
23
+ * - wpmem_inc_forgotusername
24
  */
25
 
26
 
inc/email.php CHANGED
@@ -26,7 +26,11 @@ if ( ! function_exists( 'wpmem_inc_regemail' ) ):
26
  /**
27
  * Builds emails for the user.
28
  *
29
- * @since 1.8
 
 
 
 
30
  *
31
  * @global object $wpmem The WP_Members object.
32
  * @global string $wpmem_mail_from The email from address.
@@ -74,7 +78,7 @@ function wpmem_inc_regemail( $user_id, $password, $toggle, $wpmem_fields = null,
74
  break;
75
 
76
  case 4:
77
- // This is a password reset.
78
  $arr = get_option( 'wpmembers_email_getuser' );
79
  $arr['toggle'] = 'getuser';
80
  break;
@@ -239,8 +243,9 @@ function wpmem_inc_regemail( $user_id, $password, $toggle, $wpmem_fields = null,
239
 
240
  // Add custom field shortcodes.
241
  foreach ( $wpmem_fields as $field ) {
242
- $val = ( is_array( $field_data ) && 'y' == $field[4] ) ? $field_data[ $field[2] ] : get_user_meta( $user_id, $field[2], true );
243
- $shortcodes[ $field[2] ] = $val;
 
244
  }
245
 
246
  /**
@@ -339,20 +344,21 @@ function wpmem_notify_admin( $user_id, $wpmem_fields, $field_data = null ) {
339
 
340
  // Builds an array of the user data fields.
341
  $field_arr = array();
342
- foreach ( $wpmem_fields as $meta ) {
343
- if ( $meta[4] == 'y' ) {
344
- if ( ! in_array( $meta[2], wpmem_get_excluded_meta( 'email' ) ) ) {
345
- if ( ( $meta[2] != 'user_email' ) && ( $meta[2] != 'password' ) ) {
346
- if ( $meta[2] == 'user_url' ) {
 
347
  $val = esc_url( $user->user_url );
348
- } elseif ( in_array( $meta[2], $wp_user_fields ) ) {
349
- $val = esc_html( $user->{$meta[2]} );
350
- } elseif ( 'file' == $meta[3] || 'image' == $meta[3] ) {
351
- $val = wp_get_attachment_url( get_user_meta( $user_id, $meta[2], true ) );
352
  } else {
353
- $val = ( is_array( $field_data ) ) ? esc_html( $field_data[ $meta[2] ] ) : esc_html( get_user_meta( $user_id, $meta[2], true ) );
354
  }
355
- $field_arr[ $meta[1] ] = $val;
356
  }
357
  }
358
  }
@@ -425,8 +431,9 @@ function wpmem_notify_admin( $user_id, $wpmem_fields, $field_data = null ) {
425
  );
426
 
427
  // Add custom field shortcodes.
428
- foreach ( $wpmem_fields as $field ) {
429
- $val = ( is_array( $field_data ) && 'y' == $field[4] ) ? $field_data[ $field[2] ] : get_user_meta( $user_id, $field[2], true );
 
430
  $shortcodes[ $key ] = $val;
431
  }
432
 
@@ -451,8 +458,9 @@ function wpmem_notify_admin( $user_id, $wpmem_fields, $field_data = null ) {
451
 
452
  // Create the custom field shortcodes.
453
  foreach ( $wpmem_fields as $field ) {
454
- $shortcd[] = '[' . $field[2] . ']';
455
- $replace[] = ( is_array( $field_data ) && 'y' == $field[4] ) ? $field_data[ $field[2] ] : get_user_meta( $user_id, $field[2], true );
 
456
  }
457
 
458
  // Get the subject, body, and footer shortcodes.
26
  /**
27
  * Builds emails for the user.
28
  *
29
+ * @since 1.8.0
30
+ * @since 2.7.4 Added wpmem_email_headers and individual body/subject filters.
31
+ * @since 2.9.7 Major overhaul, added wpmem_email_filter filter.
32
+ * @since 3.1.0 Can filter in custom shortcodes with wpmem_email_shortcodes.
33
+ * @since 3.1.1 Added $custom argument for custom emails.
34
  *
35
  * @global object $wpmem The WP_Members object.
36
  * @global string $wpmem_mail_from The email from address.
78
  break;
79
 
80
  case 4:
81
+ // This is a retrieve username.
82
  $arr = get_option( 'wpmembers_email_getuser' );
83
  $arr['toggle'] = 'getuser';
84
  break;
243
 
244
  // Add custom field shortcodes.
245
  foreach ( $wpmem_fields as $field ) {
246
+ $meta_key = $field[2];
247
+ $val = ( is_array( $field_data ) && 'y' == $field[4] ) ? $field_data[ $meta_key ] : get_user_meta( $user_id, $meta_key, true );
248
+ $shortcodes[ $meta_key ] = $val;
249
  }
250
 
251
  /**
344
 
345
  // Builds an array of the user data fields.
346
  $field_arr = array();
347
+ foreach ( $wpmem_fields as $field ) {
348
+ if ( $field[4] == 'y' ) {
349
+ $meta_key = $field[2];
350
+ if ( ! in_array( $meta_key, wpmem_get_excluded_meta( 'email' ) ) ) {
351
+ if ( ( $meta_key != 'user_email' ) && ( $meta_key != 'password' ) ) {
352
+ if ( $meta_key == 'user_url' ) {
353
  $val = esc_url( $user->user_url );
354
+ } elseif ( in_array( $meta_key, $wp_user_fields ) ) {
355
+ $val = esc_html( $user->{$meta_key} );
356
+ } elseif ( 'file' == $field[3] || 'image' == $field[3] ) {
357
+ $val = wp_get_attachment_url( get_user_meta( $user_id, $meta_key, true ) );
358
  } else {
359
+ $val = ( is_array( $field_data ) ) ? esc_html( $field_data[ $meta_key ] ) : esc_html( get_user_meta( $user_id, $meta_key, true ) );
360
  }
361
+ $field_arr[ $field[1] ] = $val;
362
  }
363
  }
364
  }
431
  );
432
 
433
  // Add custom field shortcodes.
434
+ foreach ( $wpmem_fields as $field ) {
435
+ $meta_key = $field[2];
436
+ $val = ( is_array( $field_data ) && 'y' == $field[4] ) ? $field_data[ $meta_key ] : get_user_meta( $user_id, $meta_key, true );
437
  $shortcodes[ $key ] = $val;
438
  }
439
 
458
 
459
  // Create the custom field shortcodes.
460
  foreach ( $wpmem_fields as $field ) {
461
+ $meta_key = $field[2];
462
+ $shortcd[] = '[' . $meta_key . ']';
463
+ $replace[] = ( is_array( $field_data ) && 'y' == $field[4] ) ? $field_data[ $meta_key ] : get_user_meta( $user_id, $meta_key, true );
464
  }
465
 
466
  // Get the subject, body, and footer shortcodes.
inc/forms.php CHANGED
@@ -379,7 +379,7 @@ function wpmem_login_form( $page, $arr ) {
379
  foreach ( $rows as $row_item ) {
380
  $row = ( $row_item['row_before'] != '' ) ? $row_item['row_before'] . $args['n'] . $row_item['label'] . $args['n'] : $row_item['label'] . $args['n'];
381
  $row .= ( $row_item['field_before'] != '' ) ? $row_item['field_before'] . $args['n'] . $args['t'] . $row_item['field'] . $args['n'] . $row_item['field_after'] . $args['n'] : $row_item['field'] . $args['n'];
382
- $row .= ( $row_item['row_before'] != '' ) ? $row_item['row_after'] . $args['n'] : '';
383
  $form.= $row;
384
  }
385
 
@@ -675,25 +675,27 @@ function wpmem_inc_registration( $tag = 'new', $heading = '', $redirect_to = nul
675
 
676
  // Loop through the remaining fields.
677
  foreach ( $wpmem_fields as $field ) {
 
 
678
 
679
  // Start with a clean row.
680
  $val = ''; $label = ''; $input = ''; $field_before = ''; $field_after = '';
681
 
682
  // Skips user selected passwords for profile update.
683
  $pass_arr = array( 'password', 'confirm_password', 'password_confirm' );
684
- $do_row = ( $tag == 'edit' && in_array( $field[2], $pass_arr ) ) ? false : true;
685
 
686
  // Skips tos, makes tos field hidden on user edit page, unless they haven't got a value for tos.
687
- if ( $field[2] == 'tos' && $tag == 'edit' && ( get_user_meta( $userdata->ID, 'tos', true ) ) ) {
688
  $do_row = false;
689
- $hidden_tos = wpmem_create_formfield( $field[2], 'hidden', get_user_meta( $userdata->ID, 'tos', true ) );
690
  }
691
 
692
  // Handle hidden fields
693
  if ( 'hidden' == $field[3] ) {
694
  $do_row = false;
695
  $hidden.= $wpmem->forms->create_form_field( array(
696
- 'name' => $field[2],
697
  'type' => $field[3],
698
  'value' => $val,
699
  'compare' => $valtochk,
@@ -706,11 +708,11 @@ function wpmem_inc_registration( $tag = 'new', $heading = '', $redirect_to = nul
706
  if ( $field[4] == 'y' && $do_row == true ) {
707
 
708
  // Label for all but TOS.
709
- if ( $field[2] != 'tos' ) {
710
 
711
  $class = ( $field[3] == 'password' || $field[3] == 'email' || $field[3] == 'url' ) ? 'text' : $field[3];
712
 
713
- $label = '<label for="' . $field[2] . '" class="' . $class . '">' . __( $field[1], 'wp-members' );
714
  $label = ( $field[5] == 'y' ) ? $label . $args['req_mark'] : $label;
715
  $label = $label . '</label>';
716
 
@@ -719,7 +721,7 @@ function wpmem_inc_registration( $tag = 'new', $heading = '', $redirect_to = nul
719
  // Gets the field value for both edit profile and submitted reg w/ error.
720
  if ( ( $tag == 'edit' ) && ( $wpmem_regchk != 'updaterr' ) ) {
721
 
722
- switch ( $field[2] ) {
723
  case( 'description' ):
724
  $val = htmlspecialchars( get_user_meta( $userdata->ID, 'description', 'true' ) );
725
  break;
@@ -738,26 +740,26 @@ function wpmem_inc_registration( $tag = 'new', $heading = '', $redirect_to = nul
738
  break;
739
 
740
  default:
741
- $val = sanitize_text_field( get_user_meta( $userdata->ID, $field[2], 'true' ) );
742
  break;
743
  }
744
 
745
  } else {
746
  if ( 'file' == $field[3] ) {
747
- $val = ( isset( $_FILES[ $field[2] ]['name'] ) ) ? $_FILES[ $field[2] ]['name'] : '' ;
748
  } else {
749
- $val = ( isset( $_POST[ $field[2] ] ) ) ? $_POST[ $field[2] ] : '';
750
  }
751
  }
752
 
753
  // Does the tos field.
754
- if ( $field[2] == 'tos' ) {
755
 
756
- $val = ( isset( $_POST[ $field[2] ] ) ) ? $_POST[ $field[2] ] : '';
757
 
758
  // Should be checked by default? and only if form hasn't been submitted.
759
  $val = ( ! $_POST && $field[8] == 'y' ) ? $field[7] : $val;
760
- $input = wpmem_create_formfield( $field[2], $field[3], $field[7], $val );
761
  $input = ( $field[5] == 'y' ) ? $input . $args['req_mark'] : $input;
762
 
763
  // Determine if TOS is a WP page or not.
@@ -812,14 +814,14 @@ function wpmem_inc_registration( $tag = 'new', $heading = '', $redirect_to = nul
812
  }
813
  // @todo - come up with a way to handle file updates - user profile form does not support multitype
814
  $input.= '<br />' . $wpmem->get_text( 'profile_upload' ) . '<br />';
815
- $input.= wpmem_create_formfield( $field[2], $field[3], $val, $valtochk );
816
 
817
  } else {
818
 
819
  // For all other input types.
820
  //$input = wpmem_create_formfield( $field[2], $field[3], $val, $valtochk );
821
  $formfield_args = array(
822
- 'name' => $field[2],
823
  'type' => $field[3],
824
  'value' => $val,
825
  'compare' => $valtochk,
@@ -849,9 +851,9 @@ function wpmem_inc_registration( $tag = 'new', $heading = '', $redirect_to = nul
849
  $val = $valtochk;
850
  }
851
 
852
- $rows[$field[2]] = array(
853
  'order' => $field[0],
854
- 'meta' => $field[2],
855
  'type' => $field[3],
856
  'value' => $val,
857
  'values' => $values,
@@ -893,6 +895,8 @@ function wpmem_inc_registration( $tag = 'new', $heading = '', $redirect_to = nul
893
  * parts of a row without needing to parse through a string of HTML.
894
  *
895
  * @since 2.9.0
 
 
896
  *
897
  * @param array $rows {
898
  * An array containing the form rows.
379
  foreach ( $rows as $row_item ) {
380
  $row = ( $row_item['row_before'] != '' ) ? $row_item['row_before'] . $args['n'] . $row_item['label'] . $args['n'] : $row_item['label'] . $args['n'];
381
  $row .= ( $row_item['field_before'] != '' ) ? $row_item['field_before'] . $args['n'] . $args['t'] . $row_item['field'] . $args['n'] . $row_item['field_after'] . $args['n'] : $row_item['field'] . $args['n'];
382
+ $row .= ( $row_item['row_after'] != '' ) ? $row_item['row_after'] . $args['n'] : '';
383
  $form.= $row;
384
  }
385
 
675
 
676
  // Loop through the remaining fields.
677
  foreach ( $wpmem_fields as $field ) {
678
+
679
+ $meta_key = $field[2];
680
 
681
  // Start with a clean row.
682
  $val = ''; $label = ''; $input = ''; $field_before = ''; $field_after = '';
683
 
684
  // Skips user selected passwords for profile update.
685
  $pass_arr = array( 'password', 'confirm_password', 'password_confirm' );
686
+ $do_row = ( $tag == 'edit' && in_array( $meta_key, $pass_arr ) ) ? false : true;
687
 
688
  // Skips tos, makes tos field hidden on user edit page, unless they haven't got a value for tos.
689
+ if ( $meta_key == 'tos' && $tag == 'edit' && ( get_user_meta( $userdata->ID, 'tos', true ) ) ) {
690
  $do_row = false;
691
+ $hidden_tos = wpmem_create_formfield( $meta_key, 'hidden', get_user_meta( $userdata->ID, 'tos', true ) );
692
  }
693
 
694
  // Handle hidden fields
695
  if ( 'hidden' == $field[3] ) {
696
  $do_row = false;
697
  $hidden.= $wpmem->forms->create_form_field( array(
698
+ 'name' => $meta_key,
699
  'type' => $field[3],
700
  'value' => $val,
701
  'compare' => $valtochk,
708
  if ( $field[4] == 'y' && $do_row == true ) {
709
 
710
  // Label for all but TOS.
711
+ if ( $meta_key != 'tos' ) {
712
 
713
  $class = ( $field[3] == 'password' || $field[3] == 'email' || $field[3] == 'url' ) ? 'text' : $field[3];
714
 
715
+ $label = '<label for="' . $meta_key . '" class="' . $class . '">' . __( $field[1], 'wp-members' );
716
  $label = ( $field[5] == 'y' ) ? $label . $args['req_mark'] : $label;
717
  $label = $label . '</label>';
718
 
721
  // Gets the field value for both edit profile and submitted reg w/ error.
722
  if ( ( $tag == 'edit' ) && ( $wpmem_regchk != 'updaterr' ) ) {
723
 
724
+ switch ( $meta_key ) {
725
  case( 'description' ):
726
  $val = htmlspecialchars( get_user_meta( $userdata->ID, 'description', 'true' ) );
727
  break;
740
  break;
741
 
742
  default:
743
+ $val = sanitize_text_field( get_user_meta( $userdata->ID, $meta_key, 'true' ) );
744
  break;
745
  }
746
 
747
  } else {
748
  if ( 'file' == $field[3] ) {
749
+ $val = ( isset( $_FILES[ $meta_key ]['name'] ) ) ? $_FILES[ $meta_key ]['name'] : '' ;
750
  } else {
751
+ $val = ( isset( $_POST[ $meta_key ] ) ) ? $_POST[ $meta_key ] : '';
752
  }
753
  }
754
 
755
  // Does the tos field.
756
+ if ( $meta_key == 'tos' ) {
757
 
758
+ $val = ( isset( $_POST[ $meta_key ] ) ) ? $_POST[ $meta_key ] : '';
759
 
760
  // Should be checked by default? and only if form hasn't been submitted.
761
  $val = ( ! $_POST && $field[8] == 'y' ) ? $field[7] : $val;
762
+ $input = wpmem_create_formfield( $meta_key, $field[3], $field[7], $val );
763
  $input = ( $field[5] == 'y' ) ? $input . $args['req_mark'] : $input;
764
 
765
  // Determine if TOS is a WP page or not.
814
  }
815
  // @todo - come up with a way to handle file updates - user profile form does not support multitype
816
  $input.= '<br />' . $wpmem->get_text( 'profile_upload' ) . '<br />';
817
+ $input.= wpmem_create_formfield( $meta_key, $field[3], $val, $valtochk );
818
 
819
  } else {
820
 
821
  // For all other input types.
822
  //$input = wpmem_create_formfield( $field[2], $field[3], $val, $valtochk );
823
  $formfield_args = array(
824
+ 'name' => $meta_key,
825
  'type' => $field[3],
826
  'value' => $val,
827
  'compare' => $valtochk,
851
  $val = $valtochk;
852
  }
853
 
854
+ $rows[ $meta_key ] = array(
855
  'order' => $field[0],
856
+ 'meta' => $meta_key,
857
  'type' => $field[3],
858
  'value' => $val,
859
  'values' => $values,
895
  * parts of a row without needing to parse through a string of HTML.
896
  *
897
  * @since 2.9.0
898
+ * @since 3.0.9 Added $rows['label_text'].
899
+ * @since 3.1.0 Added $rows['key'].
900
  *
901
  * @param array $rows {
902
  * An array containing the form rows.
inc/register.php CHANGED
@@ -27,6 +27,10 @@ if ( ! function_exists( 'wpmem_registration' ) ):
27
  * Handles registering new users and updating existing users.
28
  *
29
  * @since 2.2.1
 
 
 
 
30
  *
31
  * @param string $tag Identifies 'register' or 'update'.
32
  * @global int $user_ID
@@ -352,7 +356,9 @@ function wpmem_registration( $tag ) {
352
 
353
  // Set user expiration, if used.
354
  if ( $wpmem->use_exp == 1 && $wpmem->mod_reg != 1 ) {
355
- wpmem_set_exp( $fields['ID'] );
 
 
356
  }
357
 
358
  // Handle file uploads, if any.
@@ -394,7 +400,9 @@ function wpmem_registration( $tag ) {
394
  }
395
 
396
  if ( isset( $_POST['redirect_to'] ) ) {
397
- wp_redirect( $_POST['redirect_to'] );
 
 
398
  exit();
399
  }
400
 
27
  * Handles registering new users and updating existing users.
28
  *
29
  * @since 2.2.1
30
+ * @since 2.7.2 Added pre/post process actions.
31
+ * @since 2.8.2 Added validation and data filters.
32
+ * @since 2.9.3 Added validation for multisite.
33
+ * @since 3.0.0 Moved from wp-members-register.php to /inc/register.php.
34
  *
35
  * @param string $tag Identifies 'register' or 'update'.
36
  * @global int $user_ID
356
 
357
  // Set user expiration, if used.
358
  if ( $wpmem->use_exp == 1 && $wpmem->mod_reg != 1 ) {
359
+ if ( function_exists( 'wpmem_set_exp' ) ) {
360
+ wpmem_set_exp( $fields['ID'] );
361
+ }
362
  }
363
 
364
  // Handle file uploads, if any.
400
  }
401
 
402
  if ( isset( $_POST['redirect_to'] ) ) {
403
+ $nonce_url = wp_nonce_url( $_POST['redirect_to'], 'register_redirect', 'nonce' );
404
+ $url = add_query_arg( 'reg', 'success', $nonce_url );
405
+ wp_redirect( $url );
406
  exit();
407
  }
408
 
inc/shortcodes.php CHANGED
@@ -25,6 +25,7 @@
25
  * - wpmem_sc_loginout
26
  * - wpmem_sc_fields
27
  * - wpmem_sc_logout
 
28
  */
29
 
30
 
@@ -50,6 +51,7 @@
50
  * Function for forms called by shortcode.
51
  *
52
  * @since 3.0.0
 
53
  *
54
  * @global object $wpmem The WP_Members object.
55
  * @global string $wpmem_themsg The WP-Members message container.
@@ -132,6 +134,10 @@ function wpmem_sc_forms( $atts, $content = null, $tag = 'wpmem_form' ) {
132
  case in_array( 'user_edit', $atts ):
133
  $content = wpmem_page_user_edit( $wpmem->regchk, $content );
134
  break;
 
 
 
 
135
 
136
  }
137
 
@@ -573,7 +579,7 @@ function wpmem_sc_loginout( $atts, $content, $tag ) {
573
  * @retrun string $content
574
  */
575
  function wpmem_sc_fields( $atts, $content, $tag ) {
576
- if ( isset( $atts['id'] ) ) {
577
  // We are getting some other user.
578
  if ( $atts['id'] == 'get' ) {
579
  $the_user_ID = ( isset( $_GET['uid'] ) ) ? $_GET['uid'] : '';
25
  * - wpmem_sc_loginout
26
  * - wpmem_sc_fields
27
  * - wpmem_sc_logout
28
+ * - wpmem_sc_tos
29
  */
30
 
31
 
51
  * Function for forms called by shortcode.
52
  *
53
  * @since 3.0.0
54
+ * @since 3.1.3 Added forgot_username shortcode.
55
  *
56
  * @global object $wpmem The WP_Members object.
57
  * @global string $wpmem_themsg The WP-Members message container.
134
  case in_array( 'user_edit', $atts ):
135
  $content = wpmem_page_user_edit( $wpmem->regchk, $content );
136
  break;
137
+
138
+ case in_array( 'forgot_username', $atts ):
139
+ $content = wpmem_page_forgot_username( $wpmem->regchk, $content );
140
+ break;
141
 
142
  }
143
 
579
  * @retrun string $content
580
  */
581
  function wpmem_sc_fields( $atts, $content, $tag ) {
582
+ if ( isset( $atts['id'] ) && false != $atts['id'] ) {
583
  // We are getting some other user.
584
  if ( $atts['id'] == 'get' ) {
585
  $the_user_ID = ( isset( $_GET['uid'] ) ) ? $_GET['uid'] : '';
inc/utilities.php CHANGED
@@ -17,16 +17,18 @@
17
  *
18
  * Functions included:
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
26
- * - wpmem_test_shortcode
27
  * - wpmem_get_excluded_meta
28
  * - wpmem_use_ssl
29
  * - wpmem_wp_reserved_terms
 
 
30
  */
31
 
32
 
@@ -439,4 +441,29 @@ function wpmem_write_log ( $log ) {
439
  }
440
 
441
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
442
  // End of file.
17
  *
18
  * Functions included:
19
  * - wpmem_create_formfield
20
+ * - wpmem_selected @deprecated 3.1.0 Use selected() or checked() instead.
21
+ * - wpmem_chk_qstr @deprecated 3.1.0 Use add_query_arg() instead.
22
+ * - wpmem_generatePassword @deprecated Unknown Use wp_generate_password() instead.
23
  * - wpmem_texturize
24
  * - wpmem_enqueue_style
25
  * - wpmem_do_excerpt
26
+ * - wpmem_test_shortcode @deprecated 3.1.2 Use has_shortcode() instead.
27
  * - wpmem_get_excluded_meta
28
  * - wpmem_use_ssl
29
  * - wpmem_wp_reserved_terms
30
+ * - wpmem_write_log
31
+ * - wpmem_get
32
  */
33
 
34
 
441
  }
442
 
443
 
444
+ /**
445
+ * Utility function to validate post.
446
+ *
447
+ * @since 3.1.3
448
+ *
449
+ * @todo Should this include trim? as an option? Perhaps that's better done on the returned result so that other escapes, etc could be done.
450
+ *
451
+ * @param string $tag The form field or query string.
452
+ * @param string $default The default value (optional).
453
+ * @param string $type post|get|request (optional).
454
+ * @return string
455
+ */
456
+ function wpmem_get( $tag, $default = '', $type = 'post' ) {
457
+ switch ( $type ) {
458
+ case 'post':
459
+ return ( isset( $_POST[ $tag ] ) ) ? $_POST[ $tag ] : $default;
460
+ break;
461
+ case 'get':
462
+ return ( isset( $_GET[ $tag ] ) ) ? $_GET[ $tag ] : $default;
463
+ break;
464
+ case 'request':
465
+ return ( isset( $_REQUEST[ $tag ] ) ) ? $_REQUEST[ $tag ] : $default;
466
+ break;
467
+ }
468
+ }
469
  // End of file.
inc/wp-registration.php CHANGED
@@ -33,16 +33,17 @@ function wpmem_do_wp_register_form() {
33
  $wpmem_fields = $wpmem->fields; //$wpmem_fields = get_option( 'wpmembers_fields' );
34
  if ( isset( $wpmem_fields ) && is_array( $wpmem_fields ) ) {
35
  foreach ( $wpmem_fields as $field ) {
36
- //for ( $row = 0; $row < count( $wpmem_fields ); $row++ ) {
 
37
 
38
  $req = ( $field[5] == 'y' ) ? ' <span class="req">' . __( '(required)' ) . '</span>' : '';
39
 
40
  // File fields not yet supported for this form.
41
- if ( $field[4] == 'y' && $field[2] != 'user_email' && $field[3] != 'file' && $field[3] != 'image' ) {
42
 
43
  if ( $field[3] == 'checkbox' ) {
44
 
45
- if ( $field[2] == 'tos' ) {
46
  $tos_content = stripslashes( get_option( 'wpmembers_tos' ) );
47
  if ( stristr( $tos_content, '[wp-members page="tos"' ) ) {
48
 
@@ -61,33 +62,33 @@ function wpmem_do_wp_register_form() {
61
 
62
  }
63
 
64
- $label = ( $field[2] == 'tos' ) ? $tos : __( $field[1], 'wp-members' );
65
 
66
- $val = ( isset( $_POST[ $field[2] ] ) ) ? $_POST[ $field[2] ] : '';
67
  $val = ( ! $_POST && $field[8] == 'y' ) ? $field[7] : $val;
68
 
69
  $row_before = '<p class="wpmem-checkbox">';
70
- $label = '<label for="' . $field[2] . '">' . $label . $req;
71
- $input = wpmem_create_formfield( $field[2], $field[3], $field[7], $val );
72
  $row_after = '</label></p>';
73
 
74
  } else {
75
 
76
  $row_before = '<p>';
77
- $label = '<label for="' . $field[2] . '">' . __( $field[1], 'wp-members' ) . $req . '<br />';
78
 
79
  // determine the field type and generate accordingly...
80
 
81
  switch ( $field[3] ) {
82
 
83
  case( 'select' ):
84
- $val = ( isset( $_POST[ $field[2] ] ) ) ? $_POST[ $field[2] ] : '';
85
- $input = wpmem_create_formfield( $field[2], $field[3], $field[7], $val );
86
  break;
87
 
88
  case( 'textarea' ):
89
- $input = '<textarea name="' . $field[2] . '" id="' . $field[2] . '" class="textarea">';
90
- $input.= ( isset( $_POST[ $field[2] ] ) ) ? esc_textarea( $_POST[ $field[2] ] ) : '';
91
  $input.= '</textarea>';
92
  break;
93
 
@@ -95,9 +96,9 @@ function wpmem_do_wp_register_form() {
95
  case( 'multicheckbox' ):
96
  case( 'radio' ):
97
  $row_before = '<p class="' . $field[3] . '">';
98
- $valtochk = ( isset( $_POST[ $field[2] ] ) ) ? $_POST[ $field[2] ] : '';
99
  $formfield_args = array(
100
- 'name' => $field[2],
101
  'type' => $field[3],
102
  'value' => $field[7],
103
  'compare' => $valtochk,
@@ -115,8 +116,8 @@ function wpmem_do_wp_register_form() {
115
  break;
116
 
117
  default:
118
- $input = '<input type="' . $field[3] . '" name="' . $field[2] . '" id="' . $field[2] . '" class="input" value="';
119
- $input.= ( isset( $_POST[ $field[2] ] ) ) ? esc_attr( $_POST[ $field[2] ] ) : '';
120
  $input.= '" size="25" />';
121
  break;
122
  }
@@ -126,7 +127,7 @@ function wpmem_do_wp_register_form() {
126
  }
127
 
128
  // if the row is set to display, add the row to the form array
129
- $rows[$field[2]] = array(
130
  'type' => $field[3],
131
  'row_before' => $row_before,
132
  'label' => $label,
@@ -174,14 +175,16 @@ function wpmem_do_wp_newuser_form() {
174
  $exclude = wpmem_get_excluded_meta( 'register' );
175
 
176
  foreach ( $wpmem_fields as $field ) {
 
 
177
 
178
- if ( $field[6] == 'n' && ! in_array( $field[2], $exclude ) ) {
179
 
180
  $req = ( $field[5] == 'y' ) ? ' <span class="description">' . __( '(required)' ) . '</span>' : '';
181
 
182
  echo '<tr>
183
  <th scope="row">
184
- <label for="' . $field[2] . '">' . __( $field[1], 'wp-members' ) . $req . '</label>
185
  </th>
186
  <td>';
187
 
@@ -190,28 +193,28 @@ function wpmem_do_wp_newuser_form() {
190
  switch ( $field[3] ) {
191
 
192
  case( 'select' ):
193
- $val = ( isset( $_POST[ $field[2] ] ) ) ? $_POST[ $field[2] ] : '';
194
- echo wpmem_create_formfield( $field[2], $field[3], $field[7], $val );
195
  break;
196
 
197
  case( 'textarea' ):
198
- echo '<textarea name="' . $field[2] . '" id="' . $field[2] . '" class="textarea">';
199
- echo ( isset( $_POST[ $field[2] ] ) ) ? esc_textarea( $_POST[ $field[2] ] ) : '';
200
  echo '</textarea>';
201
  break;
202
 
203
  case( 'checkbox' ):
204
- $val = ( isset( $_POST[ $field[2] ] ) ) ? $_POST[ $field[2] ] : '';
205
  $val = ( ! $_POST && $field[8] == 'y' ) ? $field[7] : $val;
206
- echo wpmem_create_formfield( $field[2], $field[3], $field[7], $val );
207
  break;
208
 
209
  case( 'multiselect' ):
210
  case( 'multicheckbox' ):
211
  case( 'radio' ):
212
- $valtochk = ( isset( $_POST[ $field[2] ] ) ) ? $_POST[ $field[2] ] : '';
213
  $formfield_args = array(
214
- 'name' => $field[2],
215
  'type' => $field[3],
216
  'value' => $field[7],
217
  'compare' => $valtochk,
@@ -228,7 +231,7 @@ function wpmem_do_wp_newuser_form() {
228
  break;
229
 
230
  default:
231
- echo '<input type="' . $field[3] . '" name="' . $field[2] . '" id="' . $field[2] . '" class="input" value="'; echo ( isset( $_POST[ $field[2] ] ) ) ? esc_attr( $_POST[ $field[2] ] ) : ''; echo '" size="25" />';
232
  break;
233
  }
234
 
33
  $wpmem_fields = $wpmem->fields; //$wpmem_fields = get_option( 'wpmembers_fields' );
34
  if ( isset( $wpmem_fields ) && is_array( $wpmem_fields ) ) {
35
  foreach ( $wpmem_fields as $field ) {
36
+
37
+ $meta_key = $field[2];
38
 
39
  $req = ( $field[5] == 'y' ) ? ' <span class="req">' . __( '(required)' ) . '</span>' : '';
40
 
41
  // File fields not yet supported for this form.
42
+ if ( $field[4] == 'y' && $meta_key != 'user_email' && $field[3] != 'file' && $field[3] != 'image' ) {
43
 
44
  if ( $field[3] == 'checkbox' ) {
45
 
46
+ if ( $meta_key == 'tos' ) {
47
  $tos_content = stripslashes( get_option( 'wpmembers_tos' ) );
48
  if ( stristr( $tos_content, '[wp-members page="tos"' ) ) {
49
 
62
 
63
  }
64
 
65
+ $label = ( $meta_key == 'tos' ) ? $tos : __( $field[1], 'wp-members' );
66
 
67
+ $val = ( isset( $_POST[ $meta_key ] ) ) ? $_POST[ $meta_key ] : '';
68
  $val = ( ! $_POST && $field[8] == 'y' ) ? $field[7] : $val;
69
 
70
  $row_before = '<p class="wpmem-checkbox">';
71
+ $label = '<label for="' . $meta_key . '">' . $label . $req;
72
+ $input = wpmem_create_formfield( $meta_key, $field[3], $field[7], $val );
73
  $row_after = '</label></p>';
74
 
75
  } else {
76
 
77
  $row_before = '<p>';
78
+ $label = '<label for="' . $meta_key . '">' . __( $field[1], 'wp-members' ) . $req . '<br />';
79
 
80
  // determine the field type and generate accordingly...
81
 
82
  switch ( $field[3] ) {
83
 
84
  case( 'select' ):
85
+ $val = ( isset( $_POST[ $meta_key ] ) ) ? $_POST[ $meta_key ] : '';
86
+ $input = wpmem_create_formfield( $meta_key, $field[3], $field[7], $val );
87
  break;
88
 
89
  case( 'textarea' ):
90
+ $input = '<textarea name="' . $meta_key . '" id="' . $meta_key . '" class="textarea">';
91
+ $input.= ( isset( $_POST[ $meta_key ] ) ) ? esc_textarea( $_POST[ $meta_key ] ) : '';
92
  $input.= '</textarea>';
93
  break;
94
 
96
  case( 'multicheckbox' ):
97
  case( 'radio' ):
98
  $row_before = '<p class="' . $field[3] . '">';
99
+ $valtochk = ( isset( $_POST[ $meta_key ] ) ) ? $_POST[ $meta_key ] : '';
100
  $formfield_args = array(
101
+ 'name' => $meta_key,
102
  'type' => $field[3],
103
  'value' => $field[7],
104
  'compare' => $valtochk,
116
  break;
117
 
118
  default:
119
+ $input = '<input type="' . $field[3] . '" name="' . $meta_key . '" id="' . $meta_key . '" class="input" value="';
120
+ $input.= ( isset( $_POST[ $meta_key ] ) ) ? esc_attr( $_POST[ $meta_key ] ) : '';
121
  $input.= '" size="25" />';
122
  break;
123
  }
127
  }
128
 
129
  // if the row is set to display, add the row to the form array
130
+ $rows[ $meta_key ] = array(
131
  'type' => $field[3],
132
  'row_before' => $row_before,
133
  'label' => $label,
175
  $exclude = wpmem_get_excluded_meta( 'register' );
176
 
177
  foreach ( $wpmem_fields as $field ) {
178
+
179
+ $meta_key = $field[2];
180
 
181
+ if ( $field[6] == 'n' && ! in_array( $meta_key, $exclude ) ) {
182
 
183
  $req = ( $field[5] == 'y' ) ? ' <span class="description">' . __( '(required)' ) . '</span>' : '';
184
 
185
  echo '<tr>
186
  <th scope="row">
187
+ <label for="' . $meta_key . '">' . __( $field[1], 'wp-members' ) . $req . '</label>
188
  </th>
189
  <td>';
190
 
193
  switch ( $field[3] ) {
194
 
195
  case( 'select' ):
196
+ $val = ( isset( $_POST[ $meta_key ] ) ) ? $_POST[ $meta_key ] : '';
197
+ echo wpmem_create_formfield( $meta_key, $field[3], $field[7], $val );
198
  break;
199
 
200
  case( 'textarea' ):
201
+ echo '<textarea name="' . $meta_key . '" id="' . $meta_key . '" class="textarea">';
202
+ echo ( isset( $_POST[ $meta_key ] ) ) ? esc_textarea( $_POST[ $meta_key ] ) : '';
203
  echo '</textarea>';
204
  break;
205
 
206
  case( 'checkbox' ):
207
+ $val = ( isset( $_POST[ $meta_key ] ) ) ? $_POST[ $meta_key ] : '';
208
  $val = ( ! $_POST && $field[8] == 'y' ) ? $field[7] : $val;
209
+ echo wpmem_create_formfield( $meta_key, $field[3], $field[7], $val );
210
  break;
211
 
212
  case( 'multiselect' ):
213
  case( 'multicheckbox' ):
214
  case( 'radio' ):
215
+ $valtochk = ( isset( $_POST[ $meta_key ] ) ) ? $_POST[ $meta_key ] : '';
216
  $formfield_args = array(
217
+ 'name' => $meta_key,
218
  'type' => $field[3],
219
  'value' => $field[7],
220
  'compare' => $valtochk,
231
  break;
232
 
233
  default:
234
+ echo '<input type="' . $field[3] . '" name="' . $meta_key . '" id="' . $meta_key . '" class="input" value="'; echo ( isset( $_POST[ $meta_key ] ) ) ? esc_attr( $_POST[ $meta_key ] ) : ''; echo '" size="25" />';
235
  break;
236
  }
237
 
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  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.5.2
6
- Stable tag: 3.1.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,9 +112,7 @@ Premium priority support is available at the plugin's site [RocketGeek.com](http
112
 
113
  == Upgrade Notice ==
114
 
115
- WP-Members 3.1.2 is primarily a feature update release with some fixes
116
- (see changelog). Minimum WP version is increased to 3.6.
117
- WP-Members 3.1.0 is a major verion release, 3.1.1 contains a db settings change, please review the changelog.
118
 
119
  == Screenshots ==
120
 
@@ -137,6 +135,25 @@ WP-Members 3.1.0 is a major verion release, 3.1.1 contains a db settings change,
137
 
138
  == Changelog ==
139
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
140
  = 3.1.2 =
141
 
142
  * Minimum WordPress version increased to 3.6.
2
  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
 
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
 
136
  == Changelog ==
137
 
138
+ = 3.1.3.1 =
139
+
140
+ * Fixes missing /admin/includes/api.php file.
141
+
142
+ = 3.1.3 =
143
+
144
+ * 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].
145
+ * Fixed issue with calling PayPal extension functions if settings are enabled but the extension is disabled.
146
+ * Updated some admin-side strings for translation.
147
+ * Updated wpmem_redirect_to_login() to __not__ check for wpmem_is_blocked(). Handling that outside the function will expand its usability.
148
+ * 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.
149
+ * Updated widget to check for wpmem_do_sidebar() instead of obsolete wpmem() function.
150
+ * Updated email shortcodes used in new install.
151
+ * Added new utility function wpmem_get() for checking posted variables and query strings with isset() and setting a default value.
152
+ * Added a nonce to register redirect by shortcode parameter. This will lead to being able to display a success message on the redirected page.
153
+ * Added redirect_to argument in wpmem_redirect_to_login().
154
+ * Added generic registration error message.
155
+ * Added [wpmem_form forgot_username] shortcode for displaying the forgot username form.
156
+
157
  = 3.1.2 =
158
 
159
  * Minimum WordPress version increased to 3.6.
wp-members-install.php CHANGED
@@ -307,11 +307,11 @@ You may wish to retain a copy for your records.
307
  username: [username]
308
  password: [password]
309
 
310
- You may login here:
311
  [reglink]
312
 
313
  You may change your password here:
314
- [members-area]
315
  ';
316
 
317
  $arr = array(
@@ -353,8 +353,8 @@ You may wish to retain a copy for your records.
353
  username: [username]
354
  password: [password]
355
 
356
- You may login and change your password here:
357
- [members-area]
358
 
359
  You originally registered at:
360
  [reglink]
307
  username: [username]
308
  password: [password]
309
 
310
+ You may log in here:
311
  [reglink]
312
 
313
  You may change your password here:
314
+ [user-profile]
315
  ';
316
 
317
  $arr = array(
353
  username: [username]
354
  password: [password]
355
 
356
+ You may log in and change your password here:
357
+ [user-profile]
358
 
359
  You originally registered at:
360
  [reglink]
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.2
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.2' );
66
  define( 'WPMEM_DEBUG', false );
67
  define( 'WPMEM_DIR', plugin_dir_url ( __FILE__ ) );
68
  define( 'WPMEM_PATH', plugin_dir_path( __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.1.3.1
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.3.1' );
66
  define( 'WPMEM_DEBUG', false );
67
  define( 'WPMEM_DIR', plugin_dir_url ( __FILE__ ) );
68
  define( 'WPMEM_PATH', plugin_dir_path( __FILE__ ) );