From 9220723bff3ec66276c96e7a1dd7aa9115230716 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Perona?= Date: Fri, 27 Oct 2023 10:38:45 -0400 Subject: [PATCH 01/13] add new upsell block --- views/notice-almost-over-quota.php | 39 -------------- views/page-bulk.php | 62 +++------------------- views/part-settings-account.php | 46 ++-------------- views/part-upsell.php | 85 ++++++++++++++++++++++++++++++ 4 files changed, 94 insertions(+), 138 deletions(-) delete mode 100755 views/notice-almost-over-quota.php create mode 100644 views/part-upsell.php diff --git a/views/notice-almost-over-quota.php b/views/notice-almost-over-quota.php deleted file mode 100755 index ff8ddb2a4..000000000 --- a/views/notice-almost-over-quota.php +++ /dev/null @@ -1,39 +0,0 @@ -print_template( 'notice-header', array( - 'classes' => array( 'imagify-flex-notice-content', 'error' ), -) ); - -$views = Imagify_Views::get_instance(); -?> -
-
- get_quota_icon(); ?> -
-

- ' . $views->get_quota_percent() . '%' - ); - ?> -

- -
-
-
-
-
-
-

- -

-
- -
-print_template( 'notice-footer', array( - 'dismissible' => 'almost-over-quota', -) ); diff --git a/views/page-bulk.php b/views/page-bulk.php index 2efd24fd7..a6657acef 100755 --- a/views/page-bulk.php +++ b/views/page-bulk.php @@ -88,8 +88,11 @@
@@ -100,60 +103,7 @@
- - plan_id ) { ?> -
-
- get_quota_icon(); ?> -
- -

- ' . $this->get_quota_percent() . '%' - ); - ?> -

- -
-
-
-
-
- -
-

- get_quota_percent() ) { - esc_html_e( 'Oops, It\'s Over!', 'imagify' ); - } elseif ( $this->get_quota_percent() <= 20 ) { - esc_html_e( 'Oops, It\'s almost over!', 'imagify' ); - } else { - esc_html_e( 'You\'re new to Imagify?', 'imagify' ); - } - ?> -

-

- - -
- -
- + print_template( 'part-upsell' ); ?>
diff --git a/views/part-settings-account.php b/views/part-settings-account.php index 3c9ed659e..f391591e5 100755 --- a/views/part-settings-account.php +++ b/views/part-settings-account.php @@ -15,9 +15,8 @@ } if ( Imagify_Requirements::is_api_key_valid() ) { - $user = imagify_get_cached_user(); - $unconsumed_quota = $user ? $user->get_percent_unconsumed_quota : false; - $hidden_class = ''; + $user = imagify_get_cached_user(); + $hidden_class = ''; if ( ! $user ) { // Lazyload user. @@ -31,46 +30,7 @@ } ?>
- - is_free() - && - Imagify_Requirements::is_api_key_valid() - ) { - ?> -
- -
-

- -

- -

- - -
-
- +print_template( 'part-upsell' ); ?> get_percent_unconsumed_quota() : 0; +$infinite = ( 15 === $imagify_user->plan_id || 17 === $imagify_user->plan_id ); +$upgrade = ''; +$price = ''; +$upgrade_link = ''; +$user_id = get_current_user_id(); +$notices = get_user_meta( $user_id, '_imagify_ignore_notices', true ); +$notices = $notices && is_array( $notices ) ? array_flip( $notices ) : []; + +if ( + $unconsumed_quota > 20 + && + isset( $notices[ 'upsell-banner' ] ) +) { + unset( $notices[ 'upsell-banner' ] ); + $notices = array_flip( $notices ); + $notices = array_filter( $notices ); + $notices = array_values( $notices ); + + update_user_meta( $user_id, '_imagify_ignore_notices', $notices ); +} + +if ( + Imagify_Requirements::is_api_key_valid() + && + ! $infinite + && + ! isset( $notices[ 'upsell-banner' ] ) + && + $unconsumed_quota <= 20 + ) { +?> +
+
+ get_quota_icon(); ?> +
+

+ ' . $this->get_quota_percent() . '%' + ); + ?> +

+ +
+
+
+
+
+ is_free() ) { + $upgrade = esc_html__( 'Upgrade your plan now for more!', 'imagify' ); + $price = esc_html__( 'From $4.99/month only, keep going with image optimization!', 'imagify' ); + $upgrade_link = 'https://app.imagify.io/subscription/?utm_source=plugin&utm_medium=upsell_banner'; + } elseif ( 16 === $imagify_user->plan_id || 18 === $imagify_user->plan_id ) { + $upgrade = esc_esc_html__html_e( 'Upgrade your plan now to keep optimizing your images.', 'imagify' ); + + if ( $imagify_user->is_monthly ) { + $price = esc_html__( 'For $9.99/month only, choose unlimited image optimization!', 'imagify' ); + $upgrade_link = 'https://app.imagify.io/subscription/plan_switch/?label=infinite&payment_plan=1&utm_source=plugin&utm_medium=upsell_banner'; + + } else { + $price = esc_html__( 'For $99.9/year only, choose unlimited image optimization!', 'imagify' ); + $upgrade_link = 'https://app.imagify.io/subscription/plan_switch/?label=infinite&payment_plan=2&utm_source=plugin&utm_medium=upsell_banner'; + } + } + ?> +

+

+ + + +
+ From d81bc66104bda2bb1a2aabdd07bff7224571a7a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Perona?= Date: Fri, 27 Oct 2023 10:38:54 -0400 Subject: [PATCH 02/13] add $is_monthly property --- classes/User/User.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/classes/User/User.php b/classes/User/User.php index 9e6813490..01320395b 100755 --- a/classes/User/User.php +++ b/classes/User/User.php @@ -101,6 +101,13 @@ class User { */ public $is_active; + /** + * If the account is monthly or yearly. + * + * @var bool + */ + public $is_monthly; + /** * Store a \WP_Error object if the request to fetch the user data failed. * False overwise. @@ -135,6 +142,7 @@ public function __construct() { $this->consumed_current_month_quota = $user->consumed_current_month_quota; $this->next_date_update = $user->next_date_update; $this->is_active = $user->is_active; + $this->is_monthly = $user->is_monthly; $this->error = false; } From c04d34508957a54b611c90949f88e0b5b74b9306 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Perona?= Date: Fri, 27 Oct 2023 10:39:04 -0400 Subject: [PATCH 03/13] remove old out of quota banner --- classes/Notices/Notices.php | 75 +------------------------------------ 1 file changed, 1 insertion(+), 74 deletions(-) diff --git a/classes/Notices/Notices.php b/classes/Notices/Notices.php index 79eeaf28b..203d7fbc5 100644 --- a/classes/Notices/Notices.php +++ b/classes/Notices/Notices.php @@ -67,8 +67,6 @@ class Notices { 'http-block-external', // This warning is displayed when the grid view is active on the library. Dismissible. 'grid-view', - // This warning is displayed to warn the user that the quota is almost consumed for the current month. Dismissible. - 'almost-over-quota', // This warning is displayed if the backup folder is not writable. NOT dismissible. 'backup-folder-not-writable', // This notice is displayed to rate the plugin after 100 optimizations & 7 days after the first installation. Dismissible. @@ -77,6 +75,7 @@ class Notices { 'wp-rocket', 'bulk-optimization-complete', 'bulk-optimization-running', + 'upsell-banner', ]; /** @@ -243,39 +242,6 @@ public function deactivate_plugin() { wp_send_json_success(); } - /** - * Renew the "almost-over-quota" notice when the consumed quota percent decreases back below 80%. - * - * @since 1.7 - */ - public function renew_almost_over_quota_notice() { - global $wpdb; - - $results = $wpdb->get_results( $wpdb->prepare( "SELECT umeta_id, user_id FROM $wpdb->usermeta WHERE meta_key = %s AND meta_value LIKE %s", self::DISMISS_META_NAME, '%almost-over-quota%' ) ); - - if ( ! $results ) { - return; - } - - // Prevent multiple queries to the DB by caching user metas. - $not_cached = []; - - foreach ( $results as $result ) { - if ( ! wp_cache_get( $result->umeta_id, 'user_meta' ) ) { - $not_cached[] = $result->umeta_id; - } - } - - if ( $not_cached ) { - update_meta_cache( 'user', $not_cached ); - } - - // Renew the notice for all users. - foreach ( $results as $result ) { - self::renew_notice( 'almost-over-quota', $result->user_id ); - } - } - /** ----------------------------------------------------------------------------------------- */ /** NOTICES ================================================================================= */ @@ -440,45 +406,6 @@ public function display_grid_view() { return $display; } - /** - * Tell if the 'almost-over-quota' notice should be displayed. - * - * @since 1.7.0 - * - * @return bool|object An Imagify user object. False otherwise. - */ - public function display_almost_over_quota() { - static $display; - - if ( isset( $display ) ) { - return $display; - } - - $display = false; - - if ( ! $this->user_can( 'almost-over-quota' ) ) { - return $display; - } - - if ( ! imagify_is_screen( 'imagify-settings' ) && ! imagify_is_screen( 'bulk' ) ) { - return $display; - } - - if ( self::notice_is_dismissed( 'almost-over-quota' ) ) { - return $display; - } - - $user = new User(); - - // Don't display the notice if the user's unconsumed quota is superior to 20%. - if ( $user->get_percent_unconsumed_quota() > 20 ) { - return $display; - } - - $display = $user; - return $display; - } - /** * Tell if the 'backup-folder-not-writable' notice should be displayed. * From bab678c121eb7eea12bd97383b56fad7ba79f1b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Perona?= Date: Fri, 27 Oct 2023 10:39:15 -0400 Subject: [PATCH 04/13] add new upsell dismiss --- assets/js/notices.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/js/notices.js b/assets/js/notices.js index 6ca397b9b..cf13be3c1 100755 --- a/assets/js/notices.js +++ b/assets/js/notices.js @@ -6,7 +6,7 @@ */ $( '.imagify-notice-dismiss' ).on( 'click.imagify', function( e ) { var $this = $( this ), - $parent = $this.parents( '.imagify-welcome, .imagify-notice, .imagify-rkt-notice' ), + $parent = $this.parents( '.imagify-welcome, .imagify-notice, .imagify-rkt-notice, .imagify-upsell' ), href = $this.attr( 'href' ); e.preventDefault(); From 7849564a96972894d43ef76d1f6206daf502f367 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Perona?= Date: Fri, 27 Oct 2023 10:39:22 -0400 Subject: [PATCH 05/13] update css for upsell block --- assets/css/admin.css | 38 ++++++++++++++++++++++++++++++++++++++ assets/css/bulk.css | 2 +- assets/css/options.css | 16 ++++++++++++++++ 3 files changed, 55 insertions(+), 1 deletion(-) diff --git a/assets/css/admin.css b/assets/css/admin.css index 29897c0e0..fb74f8a91 100755 --- a/assets/css/admin.css +++ b/assets/css/admin.css @@ -1543,3 +1543,41 @@ ul.imagify-datas-details.imagify-datas-details { padding-right: 0em; } } + +.imagify-upsell { + position:relative; + background: #c51161; + padding: 20px 40px; +} + +.imagify-upsell p { + color: #fff !important; +} + +.imagify-upsell-button { + display: block; + background: #fff; + border-radius: 5px; + color: #c51161 !important; + font-weight: bold; + padding: 10px; + text-align: center; + text-decoration: none; + text-transform: uppercase; +} + +.imagify-upsell-arrow::after { + content: '\2192'; + font-size: large; + margin-left: 5px; + vertical-align: top; +} + +.imagify-upsell-dismiss::before { + position: absolute; + top: 5px; + right: 5px; + content: "\2715"; + color: #2e3243; + font-size: 2em; +} diff --git a/assets/css/bulk.css b/assets/css/bulk.css index fa6063dc4..cf3685183 100755 --- a/assets/css/bulk.css +++ b/assets/css/bulk.css @@ -330,7 +330,7 @@ body[class*="_imagify-ngg-bulk-optimization"] .media-item .progress .bar { .imagify-col-content .imagify-meteo-icon { height: 64px; - margin: 15px 15px 15px 20px; + margin: 15px 15px 15px 0; } .imagify-col-content .imagify-section-title + p { diff --git a/assets/css/options.css b/assets/css/options.css index c1d6b2fb3..6da0e12ff 100755 --- a/assets/css/options.css +++ b/assets/css/options.css @@ -936,3 +936,19 @@ input:checked + label .imagify-fake-checkbox:after, margin-top: 20px; } } + +.imagify-col-content .imagify-space-left { + margin: 15px 30px 15px 0; +} + +.imagify-col-content .imagify-space-left p { + margin: 0 0 10px 0; + font-size: 19px; + font-weight: 500; + color: #343A49; +} + +.imagify-col-content .imagify-meteo-icon { + height: 64px; + margin: 15px 15px 15px 0; +} From b03169b60a65f309c4a1784ee7c2e10b1571b9ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Perona?= Date: Fri, 27 Oct 2023 10:46:03 -0400 Subject: [PATCH 06/13] fix PHPCS --- views/part-upsell.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/views/part-upsell.php b/views/part-upsell.php index c3b8fd18b..b74077423 100644 --- a/views/part-upsell.php +++ b/views/part-upsell.php @@ -17,9 +17,9 @@ if ( $unconsumed_quota > 20 && - isset( $notices[ 'upsell-banner' ] ) + isset( $notices['upsell-banner'] ) ) { - unset( $notices[ 'upsell-banner' ] ); + unset( $notices['upsell-banner'] ); $notices = array_flip( $notices ); $notices = array_filter( $notices ); $notices = array_values( $notices ); @@ -32,11 +32,11 @@ && ! $infinite && - ! isset( $notices[ 'upsell-banner' ] ) + ! isset( $notices['upsell-banner'] ) && $unconsumed_quota <= 20 ) { -?> + ?>
get_quota_icon(); ?> @@ -59,7 +59,7 @@ is_free() ) { $upgrade = esc_html__( 'Upgrade your plan now for more!', 'imagify' ); - $price = esc_html__( 'From $4.99/month only, keep going with image optimization!', 'imagify' ); + $price = esc_html__( 'From $4.99/month only, keep going with image optimization!', 'imagify' ); $upgrade_link = 'https://app.imagify.io/subscription/?utm_source=plugin&utm_medium=upsell_banner'; } elseif ( 16 === $imagify_user->plan_id || 18 === $imagify_user->plan_id ) { $upgrade = esc_esc_html__html_e( 'Upgrade your plan now to keep optimizing your images.', 'imagify' ); @@ -80,6 +80,6 @@
- From 2fa2c2f9c39ada99bddb1082073bb4a39fbe7b07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Perona?= Date: Fri, 27 Oct 2023 10:46:09 -0400 Subject: [PATCH 07/13] fix unit tests --- Tests/Unit/inc/classes/ImagifyUser/getError.php | 1 + Tests/Unit/inc/classes/ImagifyUser/getPercentConsumedQuota.php | 1 + Tests/Unit/inc/classes/ImagifyUser/isOverQuota.php | 3 +++ 3 files changed, 5 insertions(+) diff --git a/Tests/Unit/inc/classes/ImagifyUser/getError.php b/Tests/Unit/inc/classes/ImagifyUser/getError.php index c1e423e82..c13bf70b0 100644 --- a/Tests/Unit/inc/classes/ImagifyUser/getError.php +++ b/Tests/Unit/inc/classes/ImagifyUser/getError.php @@ -28,6 +28,7 @@ public function testShouldReturnFalseWhenFetchedUserData() { 'consumed_current_month_quota' => 123, 'next_date_update' => '', 'is_active' => 1, + 'is_monthly' => true, ]; Functions\when( 'get_imagify_user' )->justReturn( $userData ); diff --git a/Tests/Unit/inc/classes/ImagifyUser/getPercentConsumedQuota.php b/Tests/Unit/inc/classes/ImagifyUser/getPercentConsumedQuota.php index b1b656d1e..5d50b89a6 100644 --- a/Tests/Unit/inc/classes/ImagifyUser/getPercentConsumedQuota.php +++ b/Tests/Unit/inc/classes/ImagifyUser/getPercentConsumedQuota.php @@ -44,6 +44,7 @@ public function testShouldReturnQuotaWhenFetchedUserData() { 'consumed_current_month_quota' => 900, // Current consumed quota 90%. 'next_date_update' => '', 'is_active' => 1, + 'is_monthly' => true, ]; Functions\when( 'get_imagify_user' )->justReturn( $userData ); diff --git a/Tests/Unit/inc/classes/ImagifyUser/isOverQuota.php b/Tests/Unit/inc/classes/ImagifyUser/isOverQuota.php index 7169ca9c0..35f2bc20d 100644 --- a/Tests/Unit/inc/classes/ImagifyUser/isOverQuota.php +++ b/Tests/Unit/inc/classes/ImagifyUser/isOverQuota.php @@ -42,6 +42,7 @@ public function testShouldReturnFalseWhenPaidAccount() { 'consumed_current_month_quota' => 123, 'next_date_update' => '', 'is_active' => 1, + 'is_monthly' => true, ]; Functions\when( 'get_imagify_user' )->justReturn( $userData ); @@ -64,6 +65,7 @@ public function testShouldReturnFalseWhenFreeNotOverQuota() { 'consumed_current_month_quota' => 900, // Current consumed quota 90%. 'next_date_update' => '', 'is_active' => 1, + 'is_monthly' => true, ]; $this->createMocks( $userData, 90 ); @@ -86,6 +88,7 @@ public function testShouldReturnTrueWhenFreeOverQuota() { 'consumed_current_month_quota' => 1000, // Current consumed quota 100%. 'next_date_update' => '', 'is_active' => 1, + 'is_monthly' => true, ]; $this->createMocks( $userData, 100 ); From 1313d93f990399fff8be9ac2ff5613ddea97e080 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Perona?= Date: Tue, 31 Oct 2023 14:33:42 -0400 Subject: [PATCH 08/13] use constant & new methods --- views/part-upsell.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/views/part-upsell.php b/views/part-upsell.php index b74077423..178fd523f 100644 --- a/views/part-upsell.php +++ b/views/part-upsell.php @@ -6,7 +6,7 @@ $imagify_user = new User(); $unconsumed_quota = $imagify_user ? $imagify_user->get_percent_unconsumed_quota() : 0; -$infinite = ( 15 === $imagify_user->plan_id || 17 === $imagify_user->plan_id ); +$infinite = $imagify_user->is_infinite(); $upgrade = ''; $price = ''; $upgrade_link = ''; @@ -60,17 +60,16 @@ if ( $imagify_user->is_free() ) { $upgrade = esc_html__( 'Upgrade your plan now for more!', 'imagify' ); $price = esc_html__( 'From $4.99/month only, keep going with image optimization!', 'imagify' ); - $upgrade_link = 'https://app.imagify.io/subscription/?utm_source=plugin&utm_medium=upsell_banner'; - } elseif ( 16 === $imagify_user->plan_id || 18 === $imagify_user->plan_id ) { + $upgrade_link = IMAGIFY_APP_DOMAIN . '/subscription/?utm_source=plugin&utm_medium=upsell_banner'; + } elseif ( $imagify_user->is_growth() ) { $upgrade = esc_esc_html__html_e( 'Upgrade your plan now to keep optimizing your images.', 'imagify' ); if ( $imagify_user->is_monthly ) { $price = esc_html__( 'For $9.99/month only, choose unlimited image optimization!', 'imagify' ); - $upgrade_link = 'https://app.imagify.io/subscription/plan_switch/?label=infinite&payment_plan=1&utm_source=plugin&utm_medium=upsell_banner'; - + $upgrade_link = IMAGIFY_APP_DOMAIN . '/subscription/plan_switch/?label=infinite&payment_plan=1&utm_source=plugin&utm_medium=upsell_banner'; } else { $price = esc_html__( 'For $99.9/year only, choose unlimited image optimization!', 'imagify' ); - $upgrade_link = 'https://app.imagify.io/subscription/plan_switch/?label=infinite&payment_plan=2&utm_source=plugin&utm_medium=upsell_banner'; + $upgrade_link = IMAGIFY_APP_DOMAIN . '/subscription/plan_switch/?label=infinite&payment_plan=2&utm_source=plugin&utm_medium=upsell_banner'; } } ?> From 1ad55b5341f04291b92c25c3aedc438c607aa149 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Perona?= Date: Tue, 31 Oct 2023 14:33:49 -0400 Subject: [PATCH 09/13] add new methods for plans --- classes/User/User.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/classes/User/User.php b/classes/User/User.php index 01320395b..6786152ac 100755 --- a/classes/User/User.php +++ b/classes/User/User.php @@ -252,6 +252,24 @@ public function is_free() { return 1 === $this->plan_id; } + /** + * Check if the user is a growth account + * + * @return bool + */ + public function is_growth() { + return ( 16 === $this->plan_id || 18 === $this->plan_id ); + } + + /** + * Check if the user is an infinite account + * + * @return bool + */ + public function is_infinite() { + return ( 15 === $this->plan_id || 17 === $this->plan_id ); + } + /** * Check if the user has consumed all his/her quota. * From 1f9facb9eaf935bf35cf9419936f4db1ba156cca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Perona?= Date: Mon, 6 Nov 2023 08:20:46 -0500 Subject: [PATCH 10/13] fix icon color --- assets/css/admin.css | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/assets/css/admin.css b/assets/css/admin.css index fb74f8a91..f9ec99fdd 100755 --- a/assets/css/admin.css +++ b/assets/css/admin.css @@ -1581,3 +1581,7 @@ ul.imagify-datas-details.imagify-datas-details { color: #2e3243; font-size: 2em; } + +.imagify-upsell .imagify-meteo-icon { + filter: invert(100%) sepia(100%) saturate(0%) hue-rotate(104deg) brightness(103%) contrast(103%); +} From 35f0a72561414b21da42846930315bf09893815c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Perona?= Date: Mon, 6 Nov 2023 08:21:10 -0500 Subject: [PATCH 11/13] update notice renewal --- classes/Notices/Notices.php | 33 +++++++++++++++++++++++++++++++++ views/part-upsell.php | 17 ++--------------- 2 files changed, 35 insertions(+), 15 deletions(-) diff --git a/classes/Notices/Notices.php b/classes/Notices/Notices.php index 203d7fbc5..94f5caebd 100644 --- a/classes/Notices/Notices.php +++ b/classes/Notices/Notices.php @@ -242,6 +242,39 @@ public function deactivate_plugin() { wp_send_json_success(); } + /** + * Renew the "almost-over-quota" notice when the consumed quota percent decreases back below 80%. + * + * @since 1.7 + */ + public function renew_almost_over_quota_notice() { + global $wpdb; + + $results = $wpdb->get_results( $wpdb->prepare( "SELECT umeta_id, user_id FROM $wpdb->usermeta WHERE meta_key = %s AND meta_value LIKE %s", self::DISMISS_META_NAME, '%almost-over-quota%' ) ); + + if ( ! $results ) { + return; + } + + // Prevent multiple queries to the DB by caching user metas. + $not_cached = []; + + foreach ( $results as $result ) { + if ( ! wp_cache_get( $result->umeta_id, 'user_meta' ) ) { + $not_cached[] = $result->umeta_id; + } + } + + if ( $not_cached ) { + update_meta_cache( 'user', $not_cached ); + } + + // Renew the notice for all users. + foreach ( $results as $result ) { + self::renew_notice( 'upsell-banner', $result->user_id ); + } + } + /** ----------------------------------------------------------------------------------------- */ /** NOTICES ================================================================================= */ diff --git a/views/part-upsell.php b/views/part-upsell.php index 178fd523f..0fec94541 100644 --- a/views/part-upsell.php +++ b/views/part-upsell.php @@ -14,19 +14,6 @@ $notices = get_user_meta( $user_id, '_imagify_ignore_notices', true ); $notices = $notices && is_array( $notices ) ? array_flip( $notices ) : []; -if ( - $unconsumed_quota > 20 - && - isset( $notices['upsell-banner'] ) -) { - unset( $notices['upsell-banner'] ); - $notices = array_flip( $notices ); - $notices = array_filter( $notices ); - $notices = array_values( $notices ); - - update_user_meta( $user_id, '_imagify_ignore_notices', $notices ); -} - if ( Imagify_Requirements::is_api_key_valid() && @@ -62,7 +49,7 @@ $price = esc_html__( 'From $4.99/month only, keep going with image optimization!', 'imagify' ); $upgrade_link = IMAGIFY_APP_DOMAIN . '/subscription/?utm_source=plugin&utm_medium=upsell_banner'; } elseif ( $imagify_user->is_growth() ) { - $upgrade = esc_esc_html__html_e( 'Upgrade your plan now to keep optimizing your images.', 'imagify' ); + $upgrade = esc_html__( 'Upgrade your plan now to keep optimizing your images.', 'imagify' ); if ( $imagify_user->is_monthly ) { $price = esc_html__( 'For $9.99/month only, choose unlimited image optimization!', 'imagify' ); @@ -77,7 +64,7 @@

- +
Date: Tue, 7 Nov 2023 15:02:07 -0500 Subject: [PATCH 12/13] update value name --- classes/Notices/Notices.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/classes/Notices/Notices.php b/classes/Notices/Notices.php index 94f5caebd..37e15c496 100644 --- a/classes/Notices/Notices.php +++ b/classes/Notices/Notices.php @@ -250,8 +250,9 @@ public function deactivate_plugin() { public function renew_almost_over_quota_notice() { global $wpdb; - $results = $wpdb->get_results( $wpdb->prepare( "SELECT umeta_id, user_id FROM $wpdb->usermeta WHERE meta_key = %s AND meta_value LIKE %s", self::DISMISS_META_NAME, '%almost-over-quota%' ) ); + $results = $wpdb->get_results( $wpdb->prepare( "SELECT umeta_id, user_id FROM $wpdb->usermeta WHERE meta_key = %s AND meta_value LIKE %s", self::DISMISS_META_NAME, '%upsell%' ) ); + error_log( var_export( $results, true ) ); if ( ! $results ) { return; } From d9b76d4f67376108f9fa3467acc269913edf72ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Perona?= Date: Tue, 7 Nov 2023 15:03:57 -0500 Subject: [PATCH 13/13] remove error log --- classes/Notices/Notices.php | 1 - 1 file changed, 1 deletion(-) diff --git a/classes/Notices/Notices.php b/classes/Notices/Notices.php index 37e15c496..f97faca1e 100644 --- a/classes/Notices/Notices.php +++ b/classes/Notices/Notices.php @@ -252,7 +252,6 @@ public function renew_almost_over_quota_notice() { $results = $wpdb->get_results( $wpdb->prepare( "SELECT umeta_id, user_id FROM $wpdb->usermeta WHERE meta_key = %s AND meta_value LIKE %s", self::DISMISS_META_NAME, '%upsell%' ) ); - error_log( var_export( $results, true ) ); if ( ! $results ) { return; }