Members - Version 3.1.6

Version Description

Download this release

Release Info

Developer caseproof
Plugin Icon 128x128 Members
Version 3.1.6
Comparing to
See all releases

Code changes from version 3.1.5 to 3.1.6

addons/members-block-permissions/src/Editor.php CHANGED
@@ -29,7 +29,7 @@ class Editor {
29
  * @return void
30
  */
31
  public function boot() {
32
- add_action( 'enqueue_block_editor_assets', [ $this, 'enqueue'] );
33
  }
34
 
35
  /**
29
  * @return void
30
  */
31
  public function boot() {
32
+ add_action( 'enqueue_block_editor_assets', [ $this, 'enqueue'], 1 );
33
  }
34
 
35
  /**
admin/class-review-prompt.php CHANGED
@@ -20,12 +20,20 @@ class ReviewPrompt {
20
 
21
  if ( ! empty( $_POST['type'] ) ) {
22
  if ( 'remove' === $_POST['type'] ) {
23
- update_option( 'members_review_prompt_removed', true );
 
 
 
 
 
 
24
  wp_send_json_success( array(
25
  'status' => 'removed'
26
  ) );
27
  } else if ( 'delay' === $_POST['type'] ) {
28
- set_transient( 'members_review_prompt_delay', true, WEEK_IN_SECONDS );
 
 
29
  wp_send_json_success( array(
30
  'status' => 'delayed'
31
  ) );
@@ -35,13 +43,24 @@ class ReviewPrompt {
35
 
36
  public function review_notice() {
37
 
 
 
 
 
 
38
  // Only show to admins
39
  if ( ! current_user_can( 'manage_options' ) ) {
40
  return;
41
  }
42
 
43
- // Notice has been removed or delayed
44
- if ( get_option( 'members_review_prompt_removed' ) || get_transient( 'members_review_prompt_delay' ) ) {
 
 
 
 
 
 
45
  return;
46
  }
47
 
@@ -51,6 +70,11 @@ class ReviewPrompt {
51
  return;
52
  }
53
 
 
 
 
 
 
54
  ?>
55
  <div class="notice notice-info is-dismissible members-review-notice" id="members_review_notice">
56
  <div id="members_review_intro">
@@ -61,25 +85,30 @@ class ReviewPrompt {
61
  <p><?php _e( 'That\'s awesome! Could you please do me a BIG favor and give it a 5-star rating on WordPress to help us spread the word and boost our motivation?', 'members' ); ?></p>
62
  <p style="font-weight: bold;">~ Blair Williams<br>Co-Founder &amp; CEO of MemberPress</p>
63
  <p>
64
- <a style="display: inline-block; margin-right: 10px;" href="https://wordpress.org/support/plugin/members/reviews/?filter=5#new-post" onclick="delayReviewPrompt('remove')" target="_blank"><?php esc_html_e( 'Okay, you deserve it', 'members' ); ?></a>
65
- <a style="display: inline-block; margin-right: 10px;" href="#" onclick="delayReviewPrompt('delay')"><?php esc_html_e( 'Nope, maybe later', 'members' ); ?></a>
66
- <a href="#" onclick="delayReviewPrompt('remove')"><?php esc_html_e( 'I already did', 'members' ); ?></a>
67
  </p>
68
  </div>
69
  <div id="members_review_no" style="display: none;">
70
  <p><?php _e( 'We\'re sorry to hear you aren\'t enjoying Members. We would love a chance to improve. Could you take a minute and let us know what we can do better?', 'members' ); ?></p>
71
  <p>
72
- <a style="display: inline-block; margin-right: 10px;" href="https://memberpress.com/plugins/members/plugin-feedback/?utm_source=members&utm_medium=link&utm_campaign=in_plugin&utm_content=request_review" onclick="delayReviewPrompt('remove')" target="_blank"><?php esc_html_e( 'Give Feedback', 'members' ); ?></a>
73
- <a href="#" onclick="delayReviewPrompt('delay')"><?php esc_html_e( 'No thanks', 'members' ); ?></a>
74
  </p>
75
  </div>
76
  </div>
77
  <script>
78
 
79
- function delayReviewPrompt(type, triggerClick = true) {
 
80
  if ( triggerClick ) {
81
  jQuery('#members_review_notice').fadeOut();
82
  }
 
 
 
 
83
  jQuery.ajax({
84
  url: ajaxurl,
85
  type: 'POST',
@@ -103,7 +132,7 @@ class ReviewPrompt {
103
  $('#members_review_' + selection).show();
104
  });
105
  $('body').on('click', '#members_review_notice .notice-dismiss', function(event) {
106
- delayReviewPrompt('delay', false);
107
  });
108
  });
109
  </script>
20
 
21
  if ( ! empty( $_POST['type'] ) ) {
22
  if ( 'remove' === $_POST['type'] ) {
23
+
24
+ delete_option( 'members_review_prompt_delay' );
25
+
26
+ $members_setttings = get_option( 'members_settings' );
27
+ $members_setttings['review_prompt_removed'] = true;
28
+ update_option( 'members_settings', $members_setttings );
29
+
30
  wp_send_json_success( array(
31
  'status' => 'removed'
32
  ) );
33
  } else if ( 'delay' === $_POST['type'] ) {
34
+ update_option( 'members_review_prompt_delay', array(
35
+ 'delayed_until' => time() + WEEK_IN_SECONDS
36
+ ) );
37
  wp_send_json_success( array(
38
  'status' => 'delayed'
39
  ) );
43
 
44
  public function review_notice() {
45
 
46
+ // Check for the constant to disable the prompt
47
+ if ( defined( 'MEMBERS_DISABLE_REVIEW_PROMPT' ) && true == MEMBERS_DISABLE_REVIEW_PROMPT ) {
48
+ return;
49
+ }
50
+
51
  // Only show to admins
52
  if ( ! current_user_can( 'manage_options' ) ) {
53
  return;
54
  }
55
 
56
+ // Notice has been delayed
57
+ $delayed_option = get_option( 'members_review_prompt_delay' );
58
+ if ( ! empty( $delayed_option['delayed_until'] ) && time() < $delayed_option['delayed_until'] ) {
59
+ return;
60
+ }
61
+
62
+ // Notice has been removed
63
+ if ( members_get_setting( 'review_prompt_removed' ) ) {
64
  return;
65
  }
66
 
70
  return;
71
  }
72
 
73
+ // Backwards compat
74
+ if ( get_option( 'members_review_prompt_removed' ) || get_transient( 'members_review_prompt_delay' ) ) {
75
+ return;
76
+ }
77
+
78
  ?>
79
  <div class="notice notice-info is-dismissible members-review-notice" id="members_review_notice">
80
  <div id="members_review_intro">
85
  <p><?php _e( 'That\'s awesome! Could you please do me a BIG favor and give it a 5-star rating on WordPress to help us spread the word and boost our motivation?', 'members' ); ?></p>
86
  <p style="font-weight: bold;">~ Blair Williams<br>Co-Founder &amp; CEO of MemberPress</p>
87
  <p>
88
+ <a style="display: inline-block; margin-right: 10px;" href="https://wordpress.org/support/plugin/members/reviews/?filter=5#new-post" onclick="delayReviewPrompt(event, 'remove', true, true)" target="_blank"><?php esc_html_e( 'Okay, you deserve it', 'members' ); ?></a>
89
+ <a style="display: inline-block; margin-right: 10px;" href="#" onclick="delayReviewPrompt(event, 'delay', true, false)"><?php esc_html_e( 'Nope, maybe later', 'members' ); ?></a>
90
+ <a href="#" onclick="delayReviewPrompt(event, 'remove', true, false)"><?php esc_html_e( 'I already did', 'members' ); ?></a>
91
  </p>
92
  </div>
93
  <div id="members_review_no" style="display: none;">
94
  <p><?php _e( 'We\'re sorry to hear you aren\'t enjoying Members. We would love a chance to improve. Could you take a minute and let us know what we can do better?', 'members' ); ?></p>
95
  <p>
96
+ <a style="display: inline-block; margin-right: 10px;" href="https://memberpress.com/plugins/members/plugin-feedback/?utm_source=members&utm_medium=link&utm_campaign=in_plugin&utm_content=request_review" onclick="delayReviewPrompt(event, 'remove', true, true)" target="_blank"><?php esc_html_e( 'Give Feedback', 'members' ); ?></a>
97
+ <a href="#" onclick="delayReviewPrompt(event, 'remove', true, false)"><?php esc_html_e( 'No thanks', 'members' ); ?></a>
98
  </p>
99
  </div>
100
  </div>
101
  <script>
102
 
103
+ function delayReviewPrompt(event, type, triggerClick = true, openLink = false) {
104
+ event.preventDefault();
105
  if ( triggerClick ) {
106
  jQuery('#members_review_notice').fadeOut();
107
  }
108
+ if ( openLink ) {
109
+ var href = event.target.href;
110
+ window.open(href, '_blank');
111
+ }
112
  jQuery.ajax({
113
  url: ajaxurl,
114
  type: 'POST',
132
  $('#members_review_' + selection).show();
133
  });
134
  $('body').on('click', '#members_review_notice .notice-dismiss', function(event) {
135
+ delayReviewPrompt(event, 'delay', false);
136
  });
137
  });
138
  </script>
admin/views/class-view-general.php CHANGED
@@ -62,6 +62,7 @@ class View_General extends View {
62
  add_settings_section( 'roles_caps', esc_html__( 'Roles and Capabilities', 'members' ), array( $this, 'section_roles_caps' ), 'members-settings' );
63
  add_settings_section( 'content_permissions', esc_html__( 'Content Permissions', 'members' ), '__return_false', 'members-settings' );
64
  add_settings_section( 'private_site', esc_html__( 'Private Site', 'members' ), '__return_false', 'members-settings' );
 
65
 
66
  /* === Settings Fields === */
67
 
@@ -80,6 +81,9 @@ class View_General extends View {
80
  add_settings_field( 'enable_private_feed', esc_html__( 'Disable Feed', 'members' ), array( $this, 'field_enable_private_feed' ), 'members-settings', 'private_site' );
81
  add_settings_field( 'private_feed_error', esc_html__( 'Feed Error Message', 'members' ), array( $this, 'field_private_feed_error' ), 'members-settings', 'private_site' );
82
 
 
 
 
83
  do_action( 'members_register_settings' );
84
  }
85
 
@@ -283,6 +287,23 @@ class View_General extends View {
283
  );
284
  }
285
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
286
  /**
287
  * Renders the settings page.
288
  *
62
  add_settings_section( 'roles_caps', esc_html__( 'Roles and Capabilities', 'members' ), array( $this, 'section_roles_caps' ), 'members-settings' );
63
  add_settings_section( 'content_permissions', esc_html__( 'Content Permissions', 'members' ), '__return_false', 'members-settings' );
64
  add_settings_section( 'private_site', esc_html__( 'Private Site', 'members' ), '__return_false', 'members-settings' );
65
+ add_settings_section( 'misc', esc_html__( 'Miscellaneous', 'members' ), '__return_false', 'members-settings' );
66
 
67
  /* === Settings Fields === */
68
 
81
  add_settings_field( 'enable_private_feed', esc_html__( 'Disable Feed', 'members' ), array( $this, 'field_enable_private_feed' ), 'members-settings', 'private_site' );
82
  add_settings_field( 'private_feed_error', esc_html__( 'Feed Error Message', 'members' ), array( $this, 'field_private_feed_error' ), 'members-settings', 'private_site' );
83
 
84
+ // Misc fields.
85
+ add_settings_field( 'review_prompt_removed', esc_html__( 'Disable Review Prompt', 'members' ), array( $this, 'field_remove_review_prompt' ), 'members-settings', 'misc' );
86
+
87
  do_action( 'members_register_settings' );
88
  }
89
 
287
  );
288
  }
289
 
290
+ /**
291
+ * Private feed error message field callback.
292
+ *
293
+ * @since 2.0.0
294
+ * @access public
295
+ * @return void
296
+ */
297
+ public function field_remove_review_prompt() {
298
+
299
+ ?>
300
+ <label>
301
+ <input type="checkbox" name="members_settings[review_prompt_removed]" value="1" <?php checked( members_get_setting( 'review_prompt_removed' ) ); ?> />
302
+ <?php esc_html_e( 'Permanently remove Members review prompt.', 'members' ); ?>
303
+ </label>
304
+ <?php
305
+ }
306
+
307
  /**
308
  * Renders the settings page.
309
  *
changelog.md CHANGED
@@ -1,5 +1,22 @@
1
  # Change Log
2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  ## 3.1.5 - 2021-03-25
4
 
5
  ### Fixed
1
  # Change Log
2
 
3
+ ## 3.1.6 - 2021-10-28
4
+
5
+ ### Fixed
6
+
7
+ - Using transients for review prompt causes the prompt to persist when dismissed; switched to using options instead
8
+ - Users widget not working in new block-based widgets editor
9
+
10
+ ### Changed
11
+
12
+ - WP Tested Up To version (5.8)
13
+
14
+ ### Added
15
+
16
+ - "Miscellaneous" settings section
17
+ - "Disable Review Prompt" setting to permanently remove the review prompt
18
+ - `MEMBERS_DISABLE_REVIEW_PROMPT` constant to permanently remove the review prompt
19
+
20
  ## 3.1.5 - 2021-03-25
21
 
22
  ### Fixed
inc/class-widget-users.php CHANGED
@@ -178,6 +178,13 @@ class Widget_Users extends \WP_Widget {
178
  */
179
  function form( $instance ) {
180
 
 
 
 
 
 
 
 
181
  // Merge the user-selected arguments with the defaults.
182
  $instance = wp_parse_args( (array) $instance, $this->defaults );
183
 
178
  */
179
  function form( $instance ) {
180
 
181
+ // We need to load our admin functions file to support the new block-based Widgets editor.
182
+ // This is because is_admin() does not work in REST requests, so it won't work in this new editor.
183
+ // Since we load these functions globally using is_admin(), they won't load here, so we have to require them.
184
+ // @see https://github.com/WordPress/gutenberg/issues/33443
185
+ // @see https://make.wordpress.org/core/2021/06/29/block-based-widgets-editor-in-wordpress-5-8/
186
+ require_once( members_plugin()->dir . 'admin/functions-admin.php' );
187
+
188
  // Merge the user-selected arguments with the defaults.
189
  $instance = wp_parse_args( (array) $instance, $this->defaults );
190
 
members.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Members
4
  * Plugin URI: https://memberpress.com/plugins/members
5
  * Description: A user and role management plugin that puts you in full control of your site's permissions. This plugin allows you to edit your roles and their capabilities, clone existing roles, assign multiple roles per user, block post content, or even make your site completely private.
6
- * Version: 3.1.5
7
  * Author: MemberPress
8
  * Author URI: https://memberpress.com
9
  * Text Domain: members
3
  * Plugin Name: Members
4
  * Plugin URI: https://memberpress.com/plugins/members
5
  * Description: A user and role management plugin that puts you in full control of your site's permissions. This plugin allows you to edit your roles and their capabilities, clone existing roles, assign multiple roles per user, block post content, or even make your site completely private.
6
+ * Version: 3.1.6
7
  * Author: MemberPress
8
  * Author URI: https://memberpress.com
9
  * Text Domain: members
readme.txt CHANGED
@@ -2,11 +2,11 @@
2
 
3
  Contributors: supercleanse
4
  Donate link: https://memberpress.com/plugins/members
5
- Tags: members, memberships, users, roles, capabilities, editor, security, access, permission, protect, restrict content, blocks
6
  Requires at least: 4.7
7
- Tested up to: 5.6
8
  Requires PHP: 5.6
9
- Stable tag: 3.1.5
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
2
 
3
  Contributors: supercleanse
4
  Donate link: https://memberpress.com/plugins/members
5
+ Tags: memberpress, member-type, access-control, permissions, members-only, security, membership-plan, memberships, roles, capabilities, editor, users, security, access, permission, protect, restrict content, blocks
6
  Requires at least: 4.7
7
+ Tested up to: 5.8
8
  Requires PHP: 5.6
9
+ Stable tag: 3.1.6
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12