diff --git a/inc/Admin.php b/inc/Admin.php index fb81b41..1af480e 100644 --- a/inc/Admin.php +++ b/inc/Admin.php @@ -13,12 +13,21 @@ * Admin class. */ class Admin { + + /** + * Property to suspend the survey. + * Change it to true to enable it. + * + * @var bool + */ + private $suspend_survey = false; + /** * Admin constructor. */ public function __construct() { - $this->setup_otter_notice(); $this->add_install_time(); + add_action( 'admin_init', array( $this, 'handle_notices' ) ); } /** @@ -37,14 +46,23 @@ private function add_install_time() { /** - * Setup the Otter Blocks notice. + * Handle admin notices in Neve FSE. * * @return void */ - public function setup_otter_notice() { + public function handle_notices() { add_action( 'admin_notices', array( $this, 'render_welcome_notice' ), 0 ); - add_action( 'admin_notices', array( $this, 'render_survey_notice' ) ); add_action( 'wp_ajax_neve_fse_dismiss_welcome_notice', array( $this, 'remove_welcome_notice' ) ); + + /** + * Do not show any other message on Themes page if Neve FSE promo is enabled. + */ + global $pagenow; + $current_promotion = apply_filters( 'themeisle_sdk_current_promotion', '' ); + if ( 'neve-fse-themes-popular' === $current_promotion && 'themes.php' === $pagenow ) { + return; + } + add_action( 'admin_notices', array( $this, 'render_survey_notice' ) ); add_action( 'wp_ajax_neve_fse_dismiss_survey_notice', array( $this, 'remove_survey_notice' ) ); } @@ -55,6 +73,10 @@ public function setup_otter_notice() { */ public function should_show_survey_notice() { + if ( $this->suspend_survey ) { + return false; + } + // Notice was dismissed. if ( get_option( Constants::CACHE_KEYS['dismissed-survey-notice'], 'no' ) === 'yes' ) { return false;