WP-Members Membership Plugin - Version 3.4.4.2

Version Description

  • Fixes an issue in the 3.4.4.1 release that calls an undefined function (wpmem_admin_options()).
Download this release

Release Info

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

Code changes from version 3.4.3.2 to 3.4.4.2

includes/admin/class-wp-members-admin-api.php CHANGED
@@ -127,7 +127,8 @@ class WP_Members_Admin_API {
127
  function load_hooks() {
128
 
129
  global $wpmem;
130
-
 
131
  add_action( 'admin_enqueue_scripts', array( $this, 'dashboard_enqueue_scripts' ) );
132
  add_filter( 'plugin_action_links', array( $this, 'plugin_links' ), 10, 2 );
133
 
@@ -199,6 +200,19 @@ class WP_Members_Admin_API {
199
  }
200
  } // End of load_hooks()
201
 
 
 
 
 
 
 
 
 
 
 
 
 
 
202
  /**
203
  * Add admin notices.
204
  *
127
  function load_hooks() {
128
 
129
  global $wpmem;
130
+
131
+ add_action( 'admin_menu', array( $this, 'add_options_page' ) ); // Adds admin menu
132
  add_action( 'admin_enqueue_scripts', array( $this, 'dashboard_enqueue_scripts' ) );
133
  add_filter( 'plugin_action_links', array( $this, 'plugin_links' ), 10, 2 );
134
 
200
  }
201
  } // End of load_hooks()
202
 
203
+ /**
204
+ * Adds the plugin options page and JavaScript.
205
+ *
206
+ * @since 2.5.2
207
+ * @since 3.4.4 Moved from wp-members.php/wpmem_admin_options() to main admin object.
208
+ */
209
+ function add_options_page() {
210
+ global $wpmem;
211
+ if ( ! is_multisite() || ( is_multisite() && current_user_can( 'edit_theme_options' ) ) ) {
212
+ $plugin_page = add_options_page( 'WP-Members', 'WP-Members', 'manage_options', 'wpmem-settings', 'wpmem_admin' );
213
+ }
214
+ }
215
+
216
  /**
217
  * Add admin notices.
218
  *
includes/class-wp-members-forms.php CHANGED
@@ -2069,7 +2069,7 @@ class WP_Members_Forms {
2069
  * Filter the arguments to override form defaults.
2070
  *
2071
  * @since 2.9.0
2072
- * @deprecated 3.3.0 Use wpmem_inc_{$form}_defaults instead.
2073
  *
2074
  * @param array $args An array of arguments to use. Default null. (login|changepassword|resetpassword|forgotusername)
2075
  */
2069
  * Filter the arguments to override form defaults.
2070
  *
2071
  * @since 2.9.0
2072
+ * @deprecated 3.3.0 Use wpmem_{$form}_form_defaults instead.
2073
  *
2074
  * @param array $args An array of arguments to use. Default null. (login|changepassword|resetpassword|forgotusername)
2075
  */
includes/class-wp-members-products.php CHANGED
@@ -212,6 +212,19 @@ class WP_Members_Products {
212
  // Only produce the product restricted message if access is false.
213
  if ( false === $access ) {
214
 
 
 
 
 
 
 
 
 
 
 
 
 
 
215
  $message = wpmem_get_access_message( $post_products );
216
 
217
  /**
@@ -219,6 +232,7 @@ class WP_Members_Products {
219
  *
220
  * @since 3.3.3
221
  * @since 3.3.4 Added $post_products
 
222
  *
223
  * @param array $product_restricted {
224
  * $type string $wrapper_before
@@ -232,12 +246,13 @@ class WP_Members_Products {
232
  * }
233
  */
234
  $product_restricted = apply_filters( 'wpmem_product_restricted_args', array(
 
235
  'wrapper_before' => '<div class="wpmem_msg">',
236
  'message' => $message,
237
  'wrapper_after' => '</div>',
238
  ), $post_products );
239
 
240
- $content = $product_restricted['wrapper_before'] . $product_restricted['message'] . $product_restricted['wrapper_after'];
241
 
242
  // Handle comments.
243
  add_filter( 'wpmem_securify_comments', '__return_false' );
212
  // Only produce the product restricted message if access is false.
213
  if ( false === $access ) {
214
 
215
+ // Set up excerpt if excerpts are set to display.
216
+ $excerpt = '';
217
+ if ( isset( $wpmem->show_excerpt[ $post->post_type ] ) && 1 == $wpmem->show_excerpt[ $post->post_type ] ) {
218
+
219
+ // @todo Can this be condensed or eliminated?
220
+ $len = strpos( $content, '<span id="more' );
221
+ if ( false === $len ) {
222
+ $excerpt = wpmem_do_excerpt( $content );
223
+ } else {
224
+ $excerpt = substr( $content, 0, $len );
225
+ }
226
+ }
227
+
228
  $message = wpmem_get_access_message( $post_products );
229
 
230
  /**
232
  *
233
  * @since 3.3.3
234
  * @since 3.3.4 Added $post_products
235
+ * @since 3.4.4 Added $excerpt
236
  *
237
  * @param array $product_restricted {
238
  * $type string $wrapper_before
246
  * }
247
  */
248
  $product_restricted = apply_filters( 'wpmem_product_restricted_args', array(
249
+ 'excerpt' => $excerpt,
250
  'wrapper_before' => '<div class="wpmem_msg">',
251
  'message' => $message,
252
  'wrapper_after' => '</div>',
253
  ), $post_products );
254
 
255
+ $content = $product_restricted['excerpt'] . $product_restricted['wrapper_before'] . $product_restricted['message'] . $product_restricted['wrapper_after'];
256
 
257
  // Handle comments.
258
  add_filter( 'wpmem_securify_comments', '__return_false' );
includes/class-wp-members-pwd-reset.php CHANGED
@@ -16,7 +16,7 @@ class WP_Members_Pwd_Reset {
16
  public $invalid_user;
17
  public $key_is_expired;
18
  private $reset_key;
19
- private $content = false;
20
 
21
  /**
22
  * Meta containers
@@ -57,7 +57,7 @@ class WP_Members_Pwd_Reset {
57
 
58
  add_filter( 'wpmem_email_filter', array( $this, 'add_reset_key_to_email' ), 10, 3 );
59
  add_action( 'template_redirect', array( $this, 'handle_reset' ), 20 );
60
- add_filter( 'the_content', array( $this, 'display_content' ), 100 );
61
  }
62
 
63
  function handle_reset() {
16
  public $invalid_user;
17
  public $key_is_expired;
18
  private $reset_key;
19
+ public $content = false;
20
 
21
  /**
22
  * Meta containers
57
 
58
  add_filter( 'wpmem_email_filter', array( $this, 'add_reset_key_to_email' ), 10, 3 );
59
  add_action( 'template_redirect', array( $this, 'handle_reset' ), 20 );
60
+ //add_filter( 'the_content', array( $this, 'display_content' ), 100 );
61
  }
62
 
63
  function handle_reset() {
includes/class-wp-members-shortcodes.php CHANGED
@@ -499,11 +499,15 @@ class WP_Members_Shortcodes {
499
  $content = wpmem_get_display_message( $wpmem->regchk, $wpmem_themsg );
500
  $content.= ( 'loginfailed' == $wpmem->regchk || 'success' == $wpmem->regchk ) ? wpmem_login_form() : wpmem_register_form();
501
 
502
- } elseif ( $wpmem->action == 'pwdreset' ) {
503
 
504
  $content = $this->render_pwd_reset( $wpmem->regchk, $content );
505
 
506
- } elseif( $wpmem->action == 'getusername' ) {
 
 
 
 
507
 
508
  $content = $this->render_forgot_username( $wpmem->regchk, $content );
509
 
@@ -892,6 +896,10 @@ class WP_Members_Shortcodes {
892
 
893
  return $this->render_forgot_username( $wpmem_regchk, $content );
894
 
 
 
 
 
895
  } else {
896
 
897
  switch( $wpmem_regchk ) {
499
  $content = wpmem_get_display_message( $wpmem->regchk, $wpmem_themsg );
500
  $content.= ( 'loginfailed' == $wpmem->regchk || 'success' == $wpmem->regchk ) ? wpmem_login_form() : wpmem_register_form();
501
 
502
+ } elseif ( 'pwdreset' == $wpmem->action ) {
503
 
504
  $content = $this->render_pwd_reset( $wpmem->regchk, $content );
505
 
506
+ } elseif ( 'set_password_from_key' == $wpmem->action ) {
507
+
508
+ $content = ( false != $wpmem->pwd_reset->content ) ? $wpmem->pwd_reset->content : $content;
509
+
510
+ } elseif ( 'getusername' == $wpmem->action ) {
511
 
512
  $content = $this->render_forgot_username( $wpmem->regchk, $content );
513
 
896
 
897
  return $this->render_forgot_username( $wpmem_regchk, $content );
898
 
899
+ } elseif ( 'set_password_from_key' == $wpmem->action ) {
900
+
901
+ return ( false != $wpmem->pwd_reset->content ) ? $wpmem->pwd_reset->content : $content;
902
+
903
  } else {
904
 
905
  switch( $wpmem_regchk ) {
includes/class-wp-members-user.php CHANGED
@@ -1077,7 +1077,7 @@ class WP_Members_User {
1077
  */
1078
  function get_user_products( $user_id = false, $obj = false ) {
1079
  global $wpmem;
1080
- $product_array = ( $obj ) ? $obj->membership->products : $wpmem->membership->products;
1081
  $user_id = ( ! $user_id ) ? get_current_user_id() : $user_id;
1082
  foreach ( $product_array as $product_meta => $product ) {
1083
  $user_product = get_user_meta( $user_id, '_wpmem_products_' . $product_meta, true );
1077
  */
1078
  function get_user_products( $user_id = false, $obj = false ) {
1079
  global $wpmem;
1080
+ $product_array = ( $obj ) ? $obj->membership->products : ( ( isset( $wpmem->membership->products ) ) ? $wpmem->membership->products : array() );
1081
  $user_id = ( ! $user_id ) ? get_current_user_id() : $user_id;
1082
  foreach ( $product_array as $product_meta => $product ) {
1083
  $user_product = get_user_meta( $user_id, '_wpmem_products_' . $product_meta, true );
includes/class-wp-members.php CHANGED
@@ -358,9 +358,6 @@ class WP_Members {
358
  $this->name = $this->path . 'wp-members.php';
359
  $this->slug = substr( basename( $this->name ), 0, -4 );
360
  $this->url = plugin_dir_url ( __DIR__ );
361
-
362
- // Load dependent files.
363
- $this->load_dependencies();
364
 
365
  $settings = get_option( 'wpmembers_settings' );
366
 
@@ -389,6 +386,9 @@ class WP_Members {
389
  $this->$key = $val;
390
  }
391
 
 
 
 
392
  // @todo Until I think of a better place to put this.
393
  $this->optin = get_option( 'wpmembers_optin' );
394
 
@@ -478,8 +478,7 @@ class WP_Members {
478
  add_action( 'wp_footer', array( $this, 'invisible_captcha' ) );
479
 
480
  if ( is_admin() ) {
481
- add_action( 'init', array( $this, 'load_admin' ) ); // @todo Check user role to load correct dashboard
482
- add_action( 'admin_menu', 'wpmem_admin_options' ); // Adds admin menu
483
  }
484
 
485
  if ( is_user_logged_in() ) {
@@ -655,15 +654,15 @@ class WP_Members {
655
  require_once( $this->path . 'includes/api/api-products.php' );
656
  require_once( $this->path . 'includes/api/api-users.php' );
657
  require_once( $this->path . 'includes/api/api-utilities.php' );
658
- require_once( $this->path . 'includes/deprecated.php' );
659
-
660
- require_once( $this->path . 'includes/legacy/dialogs.php' ); // File is totally deprecated at this point; eval for removal.
661
-
662
  if ( defined( 'WP_CLI' ) && WP_CLI ) {
663
  require_once( $this->path . 'includes/cli/class-wp-members-cli.php' );
664
  require_once( $this->path . 'includes/cli/class-wp-members-cli-user.php' );
665
  require_once( $this->path . 'includes/cli/class-wp-members-cli-settings.php' );
666
  }
 
 
 
667
  }
668
 
669
  /**
358
  $this->name = $this->path . 'wp-members.php';
359
  $this->slug = substr( basename( $this->name ), 0, -4 );
360
  $this->url = plugin_dir_url ( __DIR__ );
 
 
 
361
 
362
  $settings = get_option( 'wpmembers_settings' );
363
 
386
  $this->$key = $val;
387
  }
388
 
389
+ // Load dependent files.
390
+ $this->load_dependencies();
391
+
392
  // @todo Until I think of a better place to put this.
393
  $this->optin = get_option( 'wpmembers_optin' );
394
 
478
  add_action( 'wp_footer', array( $this, 'invisible_captcha' ) );
479
 
480
  if ( is_admin() ) {
481
+ add_action( 'init', array( $this, 'load_admin' ) ); // @todo Check user role to load correct dashboard
 
482
  }
483
 
484
  if ( is_user_logged_in() ) {
654
  require_once( $this->path . 'includes/api/api-products.php' );
655
  require_once( $this->path . 'includes/api/api-users.php' );
656
  require_once( $this->path . 'includes/api/api-utilities.php' );
657
+
 
 
 
658
  if ( defined( 'WP_CLI' ) && WP_CLI ) {
659
  require_once( $this->path . 'includes/cli/class-wp-members-cli.php' );
660
  require_once( $this->path . 'includes/cli/class-wp-members-cli-user.php' );
661
  require_once( $this->path . 'includes/cli/class-wp-members-cli-settings.php' );
662
  }
663
+
664
+ require_once( $this->path . 'includes/deprecated.php' );
665
+ require_once( $this->path . 'includes/legacy/dialogs.php' ); // File is totally deprecated at this point; eval for removal.
666
  }
667
 
668
  /**
includes/install.php CHANGED
@@ -804,7 +804,7 @@ function wpmem_onboarding_init( $action ) {
804
  'notice_heading' => __( 'Thank you for updating WP-Members, the original WordPress membership plugin.', 'wp-members' ),
805
  'notice_button' => __( 'Complete the update', 'wp-members' ),
806
  'show_release_notes' => true,
807
- 'release_notes_link' => "https://rocketgeek.com/release-announcements/wp-members-3-4-2/",
808
  ),
809
  );
810
  $wpmem_onboarding = new RocketGeek_Onboarding_Beta( $settings );
@@ -825,7 +825,7 @@ function wpmem_onboarding_opt_in() {
825
  // $onboarding_title = ( 'upgrade' == $args['param1'] ) ? __( 'WP-Members Upgrade', 'wp-members' ) : __( "WP-Members New Install", 'wp-members' );
826
  $install_state = get_option( 'wpmembers_install_state' );
827
  $onboarding_title = ( 'update_pending' == $install_state ) ? __( 'WP-Members Upgrade', 'wp-members' ) : __( "WP-Members New Install", 'wp-members' );
828
- $onboarding_release_notes = "https://rocketgeek.com/release-notes/wp-members-3-4-2/";
829
  $onboarding_version = $wpmem->version;
830
 
831
  $page = ( ! isset( $_POST['step'] ) ) ? 'step_1' : $_POST['step'];
804
  'notice_heading' => __( 'Thank you for updating WP-Members, the original WordPress membership plugin.', 'wp-members' ),
805
  'notice_button' => __( 'Complete the update', 'wp-members' ),
806
  'show_release_notes' => true,
807
+ 'release_notes_link' => "https://rocketgeek.com/release-announcements/wp-members-3-4-4/",
808
  ),
809
  );
810
  $wpmem_onboarding = new RocketGeek_Onboarding_Beta( $settings );
825
  // $onboarding_title = ( 'upgrade' == $args['param1'] ) ? __( 'WP-Members Upgrade', 'wp-members' ) : __( "WP-Members New Install", 'wp-members' );
826
  $install_state = get_option( 'wpmembers_install_state' );
827
  $onboarding_title = ( 'update_pending' == $install_state ) ? __( 'WP-Members Upgrade', 'wp-members' ) : __( "WP-Members New Install", 'wp-members' );
828
+ $onboarding_release_notes = "https://rocketgeek.com/release-notes/wp-members-3-4-4/";
829
  $onboarding_version = $wpmem->version;
830
 
831
  $page = ( ! isset( $_POST['step'] ) ) ? 'step_1' : $_POST['step'];
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: 4.0
5
  Tested up to: 6.0
6
- Stable tag: 3.4.3.2
7
 
8
  License: GPLv3
9
 
@@ -108,7 +108,7 @@ The FAQs are maintained at https://rocketgeek.com/plugins/wp-members/docs/faqs/
108
 
109
  == Upgrade Notice ==
110
 
111
- WP-Members 3.4.3 is a minor update. WP-Members 3.4.2.1 is a bug fix release. Backup prior to upgrading is recommended, but rollback is possible. See changelog for a list of updates. Minimum WP version is 4.0.
112
 
113
 
114
  == Screenshots ==
@@ -136,16 +136,26 @@ WP-Members 3.4.3 is a minor update. WP-Members 3.4.2.1 is a bug fix release. Bac
136
 
137
  * @todo WP-Members pluggable deprecated for use in theme functions.php (wpmem will be initialized when plugins are loaded). If you have any WP-Members pluggable functions that load in the theme functions.php, you'll need to move these to another location, such as a custom plugin file. Keep in mind, pluggable functions are no longer the preferred way of customizing (and have not been for many years) as most customizations, if not all, can be handled by using the plugin's filter and action hooks.
138
 
139
- = 3.4.3.2 =
140
 
141
- * Add [memberships] shortcode for admin notification email; this will include a list of memberships for the user in admin notification.
142
- * Move password reset link actions to template_redirect action. This should resolve issues that occur when multiple instances of the_content are run (i.e. the appearance of an invalid key message upon completing the password reset).
143
 
144
- = 3.4.3.1 =
145
 
 
 
 
 
 
 
 
 
 
 
146
  * Moves export class to main user object (previously loaded from admin files). @todo Export class file also remains in admin for backward compatibility if file is called directly.
147
  * Moves admin object load (back) to "init" action (from "admin_init") as later load can cause problems with extensions loading on the "wpmem_after_admin_init" action.
148
- * Fixes potential issue with [wpmem_field] shortcode if field does not have a defined type.
 
149
 
150
  = 3.4.3 =
151
 
3
  Tags: access, authentication, content, login, member, membership, password, protect, register, registration, restriction, subscriber
4
  Requires at least: 4.0
5
  Tested up to: 6.0
6
+ Stable tag: 3.4.4.2
7
 
8
  License: GPLv3
9
 
108
 
109
  == Upgrade Notice ==
110
 
111
+ WP-Members 3.4.4 is a minor update. 3.4.4.2 is a compatibility release for users of WP-Members Advanced Options. Backup prior to upgrading is recommended, but rollback is possible. See changelog for a list of updates. Minimum WP version is 4.0.
112
 
113
 
114
  == Screenshots ==
136
 
137
  * @todo WP-Members pluggable deprecated for use in theme functions.php (wpmem will be initialized when plugins are loaded). If you have any WP-Members pluggable functions that load in the theme functions.php, you'll need to move these to another location, such as a custom plugin file. Keep in mind, pluggable functions are no longer the preferred way of customizing (and have not been for many years) as most customizations, if not all, can be handled by using the plugin's filter and action hooks.
138
 
139
+ = 3.4.4.2 =
140
 
141
+ * Fixes an issue in the 3.4.4.1 release that calls an undefined function (wpmem_admin_options()).
 
142
 
143
+ = 3.4.4.1 =
144
 
145
+ * 3.4.4 is not compatible with WP-Members Advanced Options when redirect to login is used. This version corrects that issue by rolling back the change to only load membership restriction functions when the membership products setting is enabled. Users with WP-Members Advanced Options should update to 3.4.4.1.
146
+
147
+ = 3.4.4 =
148
+
149
+ * Adds excerpt to membership restricted content when excerpts are used and the user is logged in (should work the same as blocked content for a non-logged in user).
150
+ * Adds excerpt to wpmem_product_restricted_args arguments to be edited or removed using the filter.
151
+ * Adds [memberships] shortcode for admin notification email; this will include a list of memberships for the user in admin notification.
152
+ * Fixes potential issue with [wpmem_field] shortcode if field does not have a defined type.
153
+ * Updates to [wpmem_profile] and [wpmem_form password] for improved password reset.
154
+ * Moves password reset link actions to template_redirect action. This should resolve issues that occur when multiple instances of the_content are run (i.e. the appearance of an invalid key message upon completing the password reset).
155
  * Moves export class to main user object (previously loaded from admin files). @todo Export class file also remains in admin for backward compatibility if file is called directly.
156
  * Moves admin object load (back) to "init" action (from "admin_init") as later load can cause problems with extensions loading on the "wpmem_after_admin_init" action.
157
+ * Load dependencies after settings are loaded (allows for conditional loading of certain dependencies).
158
+ * Load membership/product restriction only if membership products setting is active.
159
 
160
  = 3.4.3 =
161
 
wp-members.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: WP-Members
4
  Plugin URI: https://rocketgeek.com
5
  Description: WP access restriction and user registration. For more information on plugin features, refer to <a href="https://rocketgeek.com/plugins/wp-members/docs/">the online Users Guide</a>. A <a href="https://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.4.3.2
7
  Author: Chad Butler
8
  Author URI: https://butlerblog.com/
9
  Text Domain: wp-members
@@ -58,7 +58,7 @@ if ( ! defined( 'ABSPATH' ) ) {
58
  }
59
 
60
  // Initialize constants.
61
- define( 'WPMEM_VERSION', '3.4.3.2' );
62
  define( 'WPMEM_DB_VERSION', '2.3.0' );
63
  define( 'WPMEM_PATH', plugin_dir_path( __FILE__ ) );
64
 
@@ -113,20 +113,6 @@ function wpmem_init() {
113
  do_action( 'wpmem_after_init' );
114
  }
115
 
116
-
117
- /**
118
- * Adds the plugin options page and JavaScript.
119
- *
120
- * @since 2.5.2
121
- */
122
- function wpmem_admin_options() {
123
- global $wpmem;
124
- if ( ! is_multisite() || ( is_multisite() && current_user_can( 'edit_theme_options' ) ) ) {
125
- $plugin_page = add_options_page( 'WP-Members', 'WP-Members', 'manage_options', 'wpmem-settings', 'wpmem_admin' );
126
- }
127
- }
128
-
129
-
130
  /**
131
  * Install the plugin options.
132
  *
3
  Plugin Name: WP-Members
4
  Plugin URI: https://rocketgeek.com
5
  Description: WP access restriction and user registration. For more information on plugin features, refer to <a href="https://rocketgeek.com/plugins/wp-members/docs/">the online Users Guide</a>. A <a href="https://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.4.4.2
7
  Author: Chad Butler
8
  Author URI: https://butlerblog.com/
9
  Text Domain: wp-members
58
  }
59
 
60
  // Initialize constants.
61
+ define( 'WPMEM_VERSION', '3.4.4.1' );
62
  define( 'WPMEM_DB_VERSION', '2.3.0' );
63
  define( 'WPMEM_PATH', plugin_dir_path( __FILE__ ) );
64
 
113
  do_action( 'wpmem_after_init' );
114
  }
115
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
116
  /**
117
  * Install the plugin options.
118
  *