diff --git a/admin/class-wpr-review-notice.php b/admin/class-wpr-review-notice.php index 432297a..c950f9b 100644 --- a/admin/class-wpr-review-notice.php +++ b/admin/class-wpr-review-notice.php @@ -13,11 +13,18 @@ class WPR_Review_Notice { /** - * Dismiss transient key. + * Dismiss key. * * @var string */ - private $dismiss_transient_key = 'wpr_review_notice_dismiss'; + private $dismiss_key = 'wpr_review_notice_dismiss'; + + /** + * Show on later date key. + * + * @var string + */ + private $dismiss_later_key = 'wpr_review_notice_later'; /** * Show the notice if number of reviews >= this value. @@ -109,9 +116,9 @@ public function show_notice() { public function handle_dismiss() { $later = ! empty( $_POST['later'] ); if ( $later ) { - set_transient( $this->dismiss_transient_key, 1, MONTH_IN_SECONDS ); + update_option( $this->dismiss_later_key, time() + MONTH_IN_SECONDS ); } else { - set_transient( $this->dismiss_transient_key, 1 ); + update_option( $this->dismiss_key, '1' ); } } @@ -119,9 +126,20 @@ public function handle_dismiss() { * Checks if should show the notice. */ private function should_show() { - if ( get_transient( $this->dismiss_transient_key ) ) { + // Backwards compatibility for transients used in versions <= 5.2.5 + if ( get_transient( 'wpr_review_notice_dismiss' ) ) { return false; } + + if ( get_option( $this->dismiss_key ) ) { + return false; + } + + $later_date = absint( get_option( $this->dismiss_later_key ) ); + if ( $later_date > time() ) { + return false; + } + $query = wp_review_get_reviews_query( 'latest', array( diff --git a/readme.txt b/readme.txt index d5f42ec..452c730 100755 --- a/readme.txt +++ b/readme.txt @@ -4,7 +4,7 @@ Creator's website link: http://mythemeshop.com/plugins/wp-review/ Tags: review, schema.org, rating, schema, user rating, google rating, star rating, product review Requires at least: 4.0 Tested up to: 5.2.2 -Stable tag: 5.2.5 +Stable tag: 5.2.6 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html @@ -103,6 +103,9 @@ Please disable all plugins and check if rating is working properly. Then you can == Changelog == += v5.2.6 (Aug 13, 2019) = +* Fixed the notice reappearing issue if transients are cleared or expired + = v5.2.5 (Jul 26, 2019) = * Fixed review drafts showing up in the Widget diff --git a/wp-review.php b/wp-review.php index 745a228..3f688b4 100755 --- a/wp-review.php +++ b/wp-review.php @@ -3,7 +3,7 @@ * Plugin Name: WP Review * Plugin URI: http://mythemeshop.com/plugins/wp-review/ * Description: Create reviews! Choose from stars, percentages or points for review scores. Supports Retina Display, WPMU and Unlimited Color Schemes. - * Version: 5.2.5 + * Version: 5.2.6 * Author: MyThemeShop * Author URI: http://mythemeshop.com/ * Text Domain: wp-review @@ -45,7 +45,7 @@ function wp_review_php_upgrade_notice() { } /* Plugin version */ -define( 'WP_REVIEW_PLUGIN_VERSION', '5.2.5' ); +define( 'WP_REVIEW_PLUGIN_VERSION', '5.2.6' ); /* Sets the custom db table name. */ define( 'MTS_WP_REVIEW_DB_TABLE', 'mts_wp_reviews' );