WP Review - Version 5.2.6

Version Description

Download this release

Release Info

Developer MyThemeShop
Plugin Icon 128x128 WP Review
Version 5.2.6
Comparing to
See all releases

Code changes from version 5.2.5 to 5.2.6

Files changed (3) hide show
  1. admin/class-wpr-review-notice.php +23 -5
  2. readme.txt +4 -1
  3. wp-review.php +2 -2
admin/class-wpr-review-notice.php CHANGED
@@ -13,11 +13,18 @@
13
  class WPR_Review_Notice {
14
 
15
  /**
16
- * Dismiss transient key.
17
  *
18
  * @var string
19
  */
20
- private $dismiss_transient_key = 'wpr_review_notice_dismiss';
 
 
 
 
 
 
 
21
 
22
  /**
23
  * Show the notice if number of reviews >= this value.
@@ -109,9 +116,9 @@ class WPR_Review_Notice {
109
  public function handle_dismiss() {
110
  $later = ! empty( $_POST['later'] );
111
  if ( $later ) {
112
- set_transient( $this->dismiss_transient_key, 1, MONTH_IN_SECONDS );
113
  } else {
114
- set_transient( $this->dismiss_transient_key, 1 );
115
  }
116
  }
117
 
@@ -119,9 +126,20 @@ class WPR_Review_Notice {
119
  * Checks if should show the notice.
120
  */
121
  private function should_show() {
122
- if ( get_transient( $this->dismiss_transient_key ) ) {
 
123
  return false;
124
  }
 
 
 
 
 
 
 
 
 
 
125
  $query = wp_review_get_reviews_query(
126
  'latest',
127
  array(
13
  class WPR_Review_Notice {
14
 
15
  /**
16
+ * Dismiss key.
17
  *
18
  * @var string
19
  */
20
+ private $dismiss_key = 'wpr_review_notice_dismiss';
21
+
22
+ /**
23
+ * Show on later date key.
24
+ *
25
+ * @var string
26
+ */
27
+ private $dismiss_later_key = 'wpr_review_notice_later';
28
 
29
  /**
30
  * Show the notice if number of reviews >= this value.
116
  public function handle_dismiss() {
117
  $later = ! empty( $_POST['later'] );
118
  if ( $later ) {
119
+ update_option( $this->dismiss_later_key, time() + MONTH_IN_SECONDS );
120
  } else {
121
+ update_option( $this->dismiss_key, '1' );
122
  }
123
  }
124
 
126
  * Checks if should show the notice.
127
  */
128
  private function should_show() {
129
+ // Backwards compatibility for transients used in versions <= 5.2.5
130
+ if ( get_transient( 'wpr_review_notice_dismiss' ) ) {
131
  return false;
132
  }
133
+
134
+ if ( get_option( $this->dismiss_key ) ) {
135
+ return false;
136
+ }
137
+
138
+ $later_date = absint( get_option( $this->dismiss_later_key ) );
139
+ if ( $later_date > time() ) {
140
+ return false;
141
+ }
142
+
143
  $query = wp_review_get_reviews_query(
144
  'latest',
145
  array(
readme.txt CHANGED
@@ -4,7 +4,7 @@ Creator's website link: http://mythemeshop.com/plugins/wp-review/
4
  Tags: review, schema.org, rating, schema, user rating, google rating, star rating, product review
5
  Requires at least: 4.0
6
  Tested up to: 5.2.2
7
- Stable tag: 5.2.5
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -103,6 +103,9 @@ Please disable all plugins and check if rating is working properly. Then you can
103
 
104
  == Changelog ==
105
 
 
 
 
106
  = v5.2.5 (Jul 26, 2019) =
107
  * Fixed review drafts showing up in the Widget
108
 
4
  Tags: review, schema.org, rating, schema, user rating, google rating, star rating, product review
5
  Requires at least: 4.0
6
  Tested up to: 5.2.2
7
+ Stable tag: 5.2.6
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
103
 
104
  == Changelog ==
105
 
106
+ = v5.2.6 (Aug 13, 2019) =
107
+ * Fixed the notice reappearing issue if transients are cleared or expired
108
+
109
  = v5.2.5 (Jul 26, 2019) =
110
  * Fixed review drafts showing up in the Widget
111
 
wp-review.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: WP Review
4
  * Plugin URI: http://mythemeshop.com/plugins/wp-review/
5
  * Description: Create reviews! Choose from stars, percentages or points for review scores. Supports Retina Display, WPMU and Unlimited Color Schemes.
6
- * Version: 5.2.5
7
  * Author: MyThemeShop
8
  * Author URI: http://mythemeshop.com/
9
  * Text Domain: wp-review
@@ -45,7 +45,7 @@ if ( version_compare( phpversion(), '5.6', '<' ) ) {
45
  }
46
 
47
  /* Plugin version */
48
- define( 'WP_REVIEW_PLUGIN_VERSION', '5.2.5' );
49
 
50
  /* Sets the custom db table name. */
51
  define( 'MTS_WP_REVIEW_DB_TABLE', 'mts_wp_reviews' );
3
  * Plugin Name: WP Review
4
  * Plugin URI: http://mythemeshop.com/plugins/wp-review/
5
  * Description: Create reviews! Choose from stars, percentages or points for review scores. Supports Retina Display, WPMU and Unlimited Color Schemes.
6
+ * Version: 5.2.6
7
  * Author: MyThemeShop
8
  * Author URI: http://mythemeshop.com/
9
  * Text Domain: wp-review
45
  }
46
 
47
  /* Plugin version */
48
+ define( 'WP_REVIEW_PLUGIN_VERSION', '5.2.6' );
49
 
50
  /* Sets the custom db table name. */
51
  define( 'MTS_WP_REVIEW_DB_TABLE', 'mts_wp_reviews' );