* @sicne 1.2.21 */ namespace Disco\Notice; class ReviewNotice { public function __construct() { add_action( 'admin_notices', [ $this, 'display_review_notice' ] ); } /** * Display the review notice if it hasn't been dismissed. * @throws \Exception * * @return void */ public function display_review_notice() { if ( ! is_user_logged_in() ) { return; // Do not show notice to non-logged-in users } $admin_page = get_current_screen(); if (( 'toplevel_page_disco-create-discount' !== $admin_page->id ) ) { return; } $user_id = get_current_user_id(); $dismiss_value = get_user_meta( $user_id, 'disco_review_dismissed', true ); // If 'never', don't show the notice if ( $dismiss_value === 'never' ) { return; } // If it's a timestamp, check if the snooze period has not yet expired if ( is_numeric( $dismiss_value ) && $dismiss_value > time() ) { return; } ?>
We’d really appreciate your ⭑⭑⭑⭑⭑ review! Your quick feedback helps us add even more great features. Tell us what you think and keep the fun going! 🥳