From be83492d9d6eb2b111ca1b3eadb55f326a49e04d Mon Sep 17 00:00:00 2001 From: girishpanchal30 Date: Thu, 14 Nov 2024 12:44:36 +0530 Subject: [PATCH] Hide SDK random promo notice --- inc/main.php | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/inc/main.php b/inc/main.php index ba10f637..cf9b99ad 100644 --- a/inc/main.php +++ b/inc/main.php @@ -92,7 +92,7 @@ public static function instance() { if ( null === self::$_instance ) { add_filter( 'themeisle_sdk_products', [ __CLASS__, 'register_sdk' ] ); - add_filter( 'themeisle_sdk_ran_promos', '__return_true' ); + add_filter( 'themeisle_sdk_ran_promos', [ __CLASS__, 'sdk_hide_promo_notice' ] ); add_filter( 'optimole-wp_uninstall_feedback_icon', [ __CLASS__, 'change_icon' ] ); add_filter( 'optimole_wp_uninstall_feedback_after_css', [ __CLASS__, 'adds_uf_css' ] ); add_filter( 'optimole_wp_feedback_review_message', [ __CLASS__, 'change_review_message' ] ); @@ -246,4 +246,19 @@ public function __clone() { public function __wakeup() { _doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'optimole-wp' ), '1.0.0' ); } + + /** + * Hide SDK promo notice for pro uses. + * + * @access public + */ + public static function sdk_hide_promo_notice() { + if ( self::$_instance->admin->settings->is_connected() ) { + $service_data = self::$_instance->admin->settings->get( 'service_data' ); + if ( isset( $service_data['plan'] ) && 'free' !== $service_data['plan'] ) { + return false; + } + } + return true; + } }