From eaf2d06b33045668244d7fadef976e7aa7eb094a Mon Sep 17 00:00:00 2001 From: Subodh Rajpopat Date: Tue, 3 Nov 2026 16:03:09 +0530 Subject: [PATCH 1/9] Show the Black Friday offer notice from November 15 to 27 The offer notice now runs a list of dated campaigns. Halloween keeps showing through November 9; nothing shows from November 10 to 14; the Black Friday 2026 offer (code BFCM2026) shows from 00:00:00 on November 15 to 23:59:59 on November 27 in the site's time zone, then ends by itself. Black Friday has its own dismiss option, copy, godam.io/deals/ link with bfcm2026 tracking, and no Halloween art. Co-Authored-By: Claude Opus 5.5 --- assets/src/css/admin.scss | 7 +- inc/classes/class-offer-notice.php | 149 +++++++++++++++++++---------- tests/php/OfferNoticeTest.php | 86 +++++++++++++++-- 3 files changed, 181 insertions(+), 61 deletions(-) diff --git a/assets/src/css/admin.scss b/assets/src/css/admin.scss index 8c963b2c32..10b10f83c5 100644 --- a/assets/src/css/admin.scss +++ b/assets/src/css/admin.scss @@ -1205,7 +1205,7 @@ to ensure proper responsiveness and avoid layout issues. } } -/* Seasonal offer notice (Halloween 2026), shown on the Dashboard and Media Library. */ +/* Seasonal offer notice (Halloween and Black Friday 2026), shown on the Dashboard and Media Library. */ .rtgodam-offer-notice { position: relative; display: flex; @@ -1214,6 +1214,11 @@ to ensure proper responsiveness and avoid layout issues. border-left-color: #5d31ff; overflow: hidden; + // No drawing on the left: the text needs the usual notice padding instead. + &--no-art { + padding-left: 16px; + } + &__art { flex: none; width: 92px; diff --git a/inc/classes/class-offer-notice.php b/inc/classes/class-offer-notice.php index b6a470ec92..0273fbe643 100644 --- a/inc/classes/class-offer-notice.php +++ b/inc/classes/class-offer-notice.php @@ -2,10 +2,11 @@ /** * Seasonal offer notice shown in wp-admin to free and trial sites. * - * The current campaign is the Halloween 2026 offer: 50% off the first payment - * with the code SPOOKY50, through November 9. The message names the - * integrations the site already uses, so a LifterLMS site reads about course - * videos and a WooCommerce store about shoppable video. + * Each campaign has fixed dates, a code and its own dismissal: the Halloween + * 2026 offer (SPOOKY50, through November 9) and the Black Friday 2026 offer + * (BFCM2026, November 15 to 27). Nothing shows between or after them. The + * message names the integrations the site already uses, so a LifterLMS site + * reads about course videos and a WooCommerce store about shoppable video. * * @package GoDAM * @since 2.5.2 @@ -23,27 +24,43 @@ class Offer_Notice { /** - * Option that stores the dismissal for this campaign only. + * The campaigns, in date order. * - * A new key per campaign, so a site that dismissed an earlier offer still sees this one. + * `start` and `end` are the first and last moment the notice shows, in the site's time zone, + * matching the offer on godam.io. Each campaign has its own dismiss option, so a site that + * dismissed an earlier offer still sees the next one. `path` is the godam.io page the Claim + * button opens, and `utm` its tracking (`utm_content` is added per placement and message). * - * @var string - */ - const DISMISS_OPTION = 'rtgodam_offer_halloween_2026_dismissed'; - - /** - * Last moment the notice shows, in the site's time zone. Matches the offer on godam.io. + * @since n.e.x.t * - * @var string + * @var array */ - const END_TIME = '2026-11-09 23:59:59'; - - /** - * Offer code. - * - * @var string - */ - const CODE = 'SPOOKY50'; + const CAMPAIGNS = array( + 'halloween-2026' => array( + 'start' => '2026-10-28 00:00:00', + 'end' => '2026-11-09 23:59:59', + 'code' => 'SPOOKY50', + 'dismiss_option' => 'rtgodam_offer_halloween_2026_dismissed', + 'path' => '/pricing/', + 'utm' => array( + 'utm_campaign' => 'halloween-2026', + 'utm_source' => '', // The site's host, filled in at render. + 'utm_medium' => 'plugin', + ), + ), + 'bfcm-2026' => array( + 'start' => '2026-11-15 00:00:00', + 'end' => '2026-11-27 23:59:59', + 'code' => 'BFCM2026', + 'dismiss_option' => 'rtgodam_offer_bfcm_2026_dismissed', + 'path' => '/deals/', + 'utm' => array( + 'utm_source' => 'godam-plugin', + 'utm_medium' => 'admin-notice', + 'utm_campaign' => 'bfcm2026', + ), + ), + ); /** * AJAX action and nonce action for dismissing the notice. @@ -70,19 +87,34 @@ public static function should_show( $now = null, $user_data = null ) { return false; } - if ( get_option( self::DISMISS_OPTION, false ) ) { + $campaign = self::get_campaign( $now ); + if ( ! $campaign || get_option( self::CAMPAIGNS[ $campaign ]['dismiss_option'], false ) ) { return false; } + return self::is_free_or_trial_site( $user_data ); + } + + /** + * The campaign running at the given moment, in the site's time zone. + * + * @since n.e.x.t + * + * @param \DateTimeInterface|null $now The moment to check, now when null. Tests pass a fixed time. + * + * @return string|null A key of CAMPAIGNS, or null between and after campaigns. + */ + public static function get_campaign( $now = null ) { $timezone = wp_timezone(); $now = $now ? $now : new \DateTime( 'now', $timezone ); - $end_time = new \DateTime( self::END_TIME, $timezone ); - if ( $now > $end_time ) { - return false; + foreach ( self::CAMPAIGNS as $key => $campaign ) { + if ( $now >= new \DateTime( $campaign['start'], $timezone ) && $now <= new \DateTime( $campaign['end'], $timezone ) ) { + return $key; + } } - return self::is_free_or_trial_site( $user_data ); + return null; } /** @@ -233,21 +265,21 @@ public static function render( $placement, $now = null, $user_data = null ) { return; } + $campaign_key = self::get_campaign( $now ); + $campaign = self::CAMPAIGNS[ $campaign_key ]; + $is_halloween = 'halloween-2026' === $campaign_key; $integrations = self::get_active_integrations(); $message = self::get_message( $integrations ); $chips = array_slice( array_unique( array_column( $integrations, 'name' ) ), 0, 3 ); - $host = wp_parse_url( home_url(), PHP_URL_HOST ); - $claim_url = add_query_arg( - array( - 'utm_campaign' => 'halloween-2026', - 'utm_source' => $host, - 'utm_medium' => 'plugin', - 'utm_content' => $placement . '-' . $message['key'], - ), - RTGODAM_IO_API_BASE . '/pricing/' - ); + $utm = $campaign['utm']; + if ( '' === $utm['utm_source'] ) { + $utm['utm_source'] = wp_parse_url( home_url(), PHP_URL_HOST ); + } + $utm['utm_content'] = $placement . '-' . $message['key']; + $claim_url = add_query_arg( $utm, RTGODAM_IO_API_BASE . $campaign['path'] ); ?> -
+
+ +

- + + + + +

' . esc_html__( 'Get 50% off', 'godam' ) . '' - ), + sprintf( $title, '' . esc_html__( 'Get 50% off', 'godam' ) . '' ), array( 'span' => array() ) ); ?> @@ -299,12 +337,12 @@ public static function render( $placement, $now = null, $user_data = null ) { - @@ -312,7 +350,13 @@ public static function render( $placement, $now = null, $user_data = null ) {

- +

@@ -321,20 +365,25 @@ public static function render( $placement, $now = null, $user_data = null ) { } /** - * Save the dismissal for the whole site. + * Save the dismissal of the running campaign for the whole site. * * @since 2.5.2 * + * @param \DateTimeInterface|null $now The moment to check, now when empty. Tests pass a fixed time. + * * @return void */ - public static function dismiss() { + public static function dismiss( $now = null ) { check_ajax_referer( self::DISMISS_ACTION, 'nonce' ); if ( ! current_user_can( 'manage_options' ) ) { wp_send_json_error( array( 'message' => __( 'You are not allowed to dismiss this offer.', 'godam' ) ), 403 ); } - update_option( self::DISMISS_OPTION, time(), false ); + $campaign = self::get_campaign( $now instanceof \DateTimeInterface ? $now : null ); + if ( $campaign ) { + update_option( self::CAMPAIGNS[ $campaign ]['dismiss_option'], time(), false ); + } wp_send_json_success(); } diff --git a/tests/php/OfferNoticeTest.php b/tests/php/OfferNoticeTest.php index 0863255505..e2d405bfbb 100644 --- a/tests/php/OfferNoticeTest.php +++ b/tests/php/OfferNoticeTest.php @@ -1,10 +1,11 @@ assertTrue( Offer_Notice::should_show( $this->moment( '2026-10-29 10:00:00' ), $this->user_data() ) ); - $GLOBALS['rtgodam_stub']['options'][ Offer_Notice::DISMISS_OPTION ] = 1793170000; + $GLOBALS['rtgodam_stub']['options']['rtgodam_offer_halloween_2026_dismissed'] = 1793170000; $this->assertFalse( Offer_Notice::should_show( $this->moment( '2026-10-29 10:00:00' ), $this->user_data() ) ); } @@ -195,16 +196,16 @@ public function test_dismiss_rejects_a_bad_nonce_and_a_non_administrator_and_sav $GLOBALS['rtgodam_stub']['nonce_ok'] = false; $this->assertSame( 'bad nonce', $this->call_dismiss() ); - $this->assertArrayNotHasKey( Offer_Notice::DISMISS_OPTION, $GLOBALS['rtgodam_stub']['options'] ); + $this->assertSame( array(), $GLOBALS['rtgodam_stub']['options'] ); $GLOBALS['rtgodam_stub']['nonce_ok'] = true; $GLOBALS['rtgodam_stub']['caps'] = array( 'edit_posts' ); $this->assertSame( 'error 403', $this->call_dismiss() ); - $this->assertArrayNotHasKey( Offer_Notice::DISMISS_OPTION, $GLOBALS['rtgodam_stub']['options'] ); + $this->assertSame( array(), $GLOBALS['rtgodam_stub']['options'] ); $GLOBALS['rtgodam_stub']['caps'] = array( 'manage_options' ); - $this->assertSame( 'success', $this->call_dismiss() ); - $this->assertNotEmpty( $GLOBALS['rtgodam_stub']['options'][ Offer_Notice::DISMISS_OPTION ] ); + $this->assertSame( 'success', $this->call_dismiss( $this->moment( '2026-10-29 10:00:00' ) ) ); + $this->assertNotEmpty( $GLOBALS['rtgodam_stub']['options']['rtgodam_offer_halloween_2026_dismissed'] ); } public function test_render_prints_the_claim_link_with_its_tracking_and_nothing_for_a_paid_site() { @@ -233,6 +234,69 @@ public function test_render_prints_the_claim_link_with_its_tracking_and_nothing_ $this->assertSame( '', trim( ob_get_clean() ) ); } + public function test_black_friday_shows_from_the_first_second_of_november_15_to_the_last_of_november_27() { + foreach ( array( 'Asia/Kolkata', 'America/New_York' ) as $zone ) { + $timezone = new \DateTimeZone( $zone ); + $GLOBALS['rtgodam_stub']['timezone'] = $timezone; + + $at = static fn( $time ) => new \DateTime( $time, $timezone ); + + $this->assertFalse( Offer_Notice::should_show( $at( '2026-11-14 23:59:59' ), $this->user_data() ), $zone ); + $this->assertTrue( Offer_Notice::should_show( $at( '2026-11-15 00:00:00' ), $this->user_data() ), $zone ); + $this->assertTrue( Offer_Notice::should_show( $at( '2026-11-27 23:59:59' ), $this->user_data() ), $zone ); + $this->assertFalse( Offer_Notice::should_show( $at( '2026-11-28 00:00:00' ), $this->user_data() ), $zone ); + $this->assertSame( 'bfcm-2026', Offer_Notice::get_campaign( $at( '2026-11-20 12:00:00' ) ), $zone ); + } + } + + public function test_nothing_shows_between_halloween_and_black_friday_or_on_a_later_year() { + foreach ( array( '2026-11-10 00:00:00', '2026-11-12 12:00:00', '2026-11-14 23:59:59', '2027-11-20 12:00:00' ) as $time ) { + $this->assertNull( Offer_Notice::get_campaign( $this->moment( $time ) ), $time ); + $this->assertFalse( Offer_Notice::should_show( $this->moment( $time ), $this->user_data() ), $time ); + } + } + + public function test_a_halloween_dismissal_does_not_hide_black_friday_and_its_own_dismissal_does() { + $GLOBALS['rtgodam_stub']['options']['rtgodam_offer_halloween_2026_dismissed'] = 1793170000; + $this->assertTrue( Offer_Notice::should_show( $this->moment( '2026-11-20 12:00:00' ), $this->user_data() ) ); + + $GLOBALS['rtgodam_stub']['options']['rtgodam_offer_bfcm_2026_dismissed'] = 1793170000; + $this->assertFalse( Offer_Notice::should_show( $this->moment( '2026-11-20 12:00:00' ), $this->user_data() ) ); + } + + public function test_a_paid_site_never_sees_black_friday() { + $this->connect( 'Starter', gmdate( 'Y-m-d H:i:s', time() + 300 * DAY_IN_SECONDS ) ); + + $this->assertFalse( Offer_Notice::should_show( $this->moment( '2026-11-20 12:00:00' ), $this->user_data() ) ); + } + + public function test_black_friday_render_has_its_code_copy_and_deals_link_and_no_halloween_art() { + $this->stub_render(); + $GLOBALS['rtgodam_stub']['active_plugins'] = array( 'lifterlms/lifterlms.php' ); + + ob_start(); + Offer_Notice::render( 'media-library', $this->moment( '2026-11-20 12:00:00' ), $this->user_data() ); + $html = ob_get_clean(); + + $this->assertStringContainsString( 'https://godam.io/deals/?utm_source=godam-plugin&utm_medium=admin-notice&utm_campaign=bfcm2026&utm_content=media-library-lifterlms', $html ); + $this->assertStringContainsString( 'data-code="BFCM2026"', $html ); + $this->assertStringContainsString( 'Black Friday offer', $html ); + $this->assertStringContainsString( 'Black Friday deal: Get 50% off GoDAM', $html ); + $this->assertStringContainsString( 'Ends November 27 at 11:59 p.m. 50% off your first month or year on any plan.', $html ); + $this->assertStringContainsString( 'rtgodam-offer-notice--no-art', $html ); + $this->assertStringNotContainsString( 'rtgodam-offer-notice__art', $html ); + $this->assertStringNotContainsString( 'rtgodam-offer-notice__pumpkin', $html ); + $this->assertStringNotContainsString( 'SPOOKY50', $html ); + } + + public function test_dismissing_during_black_friday_saves_only_its_own_option() { + $this->stub_ajax(); + $GLOBALS['rtgodam_stub']['nonce_ok'] = true; + + $this->assertSame( 'success', $this->call_dismiss( $this->moment( '2026-11-20 12:00:00' ) ) ); + $this->assertSame( array( 'rtgodam_offer_bfcm_2026_dismissed' ), array_keys( $GLOBALS['rtgodam_stub']['options'] ) ); + } + /** * Stub the AJAX helpers dismiss() calls. Each one that ends a WordPress request throws instead. */ @@ -256,11 +320,13 @@ private function stub_ajax() { /** * Run dismiss() and return how it ended. * + * @param \DateTime|null $now The moment to dismiss at. + * * @return string */ - private function call_dismiss() { + private function call_dismiss( $now = null ) { try { - Offer_Notice::dismiss(); + Offer_Notice::dismiss( $now ); } catch ( \RuntimeException $e ) { return $e->getMessage(); } From 3f13f1668abce1822ca78e38406af3ae8c7243b1 Mon Sep 17 00:00:00 2001 From: Subodh Rajpopat Date: Tue, 3 Nov 2026 16:08:13 +0530 Subject: [PATCH 2/9] Read the clock once per render; keep Halloween's old start render() read the clock twice, so a campaign ending between the two reads could leave no campaign to render. Halloween's start moves to October 1, so it still shows from install as before. Adds a test for a dismiss between campaigns and for the AJAX call with no time. Co-Authored-By: Claude Opus 5.5 --- inc/classes/class-offer-notice.php | 5 ++++- tests/php/OfferNoticeTest.php | 11 +++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/inc/classes/class-offer-notice.php b/inc/classes/class-offer-notice.php index 0273fbe643..1b827353f3 100644 --- a/inc/classes/class-offer-notice.php +++ b/inc/classes/class-offer-notice.php @@ -37,7 +37,7 @@ class Offer_Notice { */ const CAMPAIGNS = array( 'halloween-2026' => array( - 'start' => '2026-10-28 00:00:00', + 'start' => '2026-10-01 00:00:00', // Before 2.5.2 shipped it: the notice showed from install. 'end' => '2026-11-09 23:59:59', 'code' => 'SPOOKY50', 'dismiss_option' => 'rtgodam_offer_halloween_2026_dismissed', @@ -261,6 +261,9 @@ public static function get_message( $integrations ) { * @return void */ public static function render( $placement, $now = null, $user_data = null ) { + // Read the clock once, so a campaign that ends mid-request cannot pass should_show() and then be gone. + $now = $now ? $now : new \DateTime( 'now', wp_timezone() ); + if ( ! self::should_show( $now, $user_data ) ) { return; } diff --git a/tests/php/OfferNoticeTest.php b/tests/php/OfferNoticeTest.php index e2d405bfbb..cccb215584 100644 --- a/tests/php/OfferNoticeTest.php +++ b/tests/php/OfferNoticeTest.php @@ -297,6 +297,17 @@ public function test_dismissing_during_black_friday_saves_only_its_own_option() $this->assertSame( array( 'rtgodam_offer_bfcm_2026_dismissed' ), array_keys( $GLOBALS['rtgodam_stub']['options'] ) ); } + public function test_dismissing_between_campaigns_saves_nothing_and_the_ajax_call_without_a_time_still_works() { + $this->stub_ajax(); + $GLOBALS['rtgodam_stub']['nonce_ok'] = true; + + $this->assertSame( 'success', $this->call_dismiss( $this->moment( '2026-11-12 12:00:00' ) ) ); + $this->assertSame( array(), $GLOBALS['rtgodam_stub']['options'] ); + + // WordPress's do_action() passes '' to a one-argument callback: it must read the real clock, not fail. + $this->assertSame( 'success', $this->call_dismiss( '' ) ); + } + /** * Stub the AJAX helpers dismiss() calls. Each one that ends a WordPress request throws instead. */ From 8072ada30069643328a27d75bbc16e12bf573c7b Mon Sep 17 00:00:00 2001 From: Subodh Rajpopat Date: Mon, 9 Nov 2026 11:41:33 +0530 Subject: [PATCH 3/9] Run the Black Friday notice from November 14 to 30 Cyber Monday is November 30, so the campaign window is now November 14 00:00:00 to November 30 23:59:59 in the site's time zone. The footer says "Ends November 30 at 11:59 p.m.". Co-Authored-By: Claude Opus 5.5 --- inc/classes/class-offer-notice.php | 8 ++++---- tests/php/OfferNoticeTest.php | 16 ++++++++-------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/inc/classes/class-offer-notice.php b/inc/classes/class-offer-notice.php index 1b827353f3..e02cd084de 100644 --- a/inc/classes/class-offer-notice.php +++ b/inc/classes/class-offer-notice.php @@ -4,7 +4,7 @@ * * Each campaign has fixed dates, a code and its own dismissal: the Halloween * 2026 offer (SPOOKY50, through November 9) and the Black Friday 2026 offer - * (BFCM2026, November 15 to 27). Nothing shows between or after them. The + * (BFCM2026, November 14 to 30). Nothing shows between or after them. The * message names the integrations the site already uses, so a LifterLMS site * reads about course videos and a WooCommerce store about shoppable video. * @@ -49,8 +49,8 @@ class Offer_Notice { ), ), 'bfcm-2026' => array( - 'start' => '2026-11-15 00:00:00', - 'end' => '2026-11-27 23:59:59', + 'start' => '2026-11-14 00:00:00', + 'end' => '2026-11-30 23:59:59', 'code' => 'BFCM2026', 'dismiss_option' => 'rtgodam_offer_bfcm_2026_dismissed', 'path' => '/deals/', @@ -357,7 +357,7 @@ public static function render( $placement, $now = null, $user_data = null ) { if ( $is_halloween ) { esc_html_e( 'Through November 9. Don\'t let this treat disappear!', 'godam' ); } else { - esc_html_e( 'Ends November 27 at 11:59 p.m. 50% off your first month or year on any plan.', 'godam' ); + esc_html_e( 'Ends November 30 at 11:59 p.m. 50% off your first month or year on any plan.', 'godam' ); } ?>

diff --git a/tests/php/OfferNoticeTest.php b/tests/php/OfferNoticeTest.php index cccb215584..62e28db0e9 100644 --- a/tests/php/OfferNoticeTest.php +++ b/tests/php/OfferNoticeTest.php @@ -5,7 +5,7 @@ * Joel's rules from the 2.5.2 release thread: a WP-admin notice, only for free * and trial sites (never paid), gone after each offer ends, and a message * picked by the integrations the site uses. Halloween runs through November 9, - * Black Friday from November 15 to 27 (the BFCM 2026 campaign doc). + * Black Friday from November 14 to 30 (the BFCM 2026 campaign doc). * * @package GoDAM */ @@ -234,23 +234,23 @@ public function test_render_prints_the_claim_link_with_its_tracking_and_nothing_ $this->assertSame( '', trim( ob_get_clean() ) ); } - public function test_black_friday_shows_from_the_first_second_of_november_15_to_the_last_of_november_27() { + public function test_black_friday_shows_from_the_first_second_of_november_14_to_the_last_of_november_30() { foreach ( array( 'Asia/Kolkata', 'America/New_York' ) as $zone ) { $timezone = new \DateTimeZone( $zone ); $GLOBALS['rtgodam_stub']['timezone'] = $timezone; $at = static fn( $time ) => new \DateTime( $time, $timezone ); - $this->assertFalse( Offer_Notice::should_show( $at( '2026-11-14 23:59:59' ), $this->user_data() ), $zone ); - $this->assertTrue( Offer_Notice::should_show( $at( '2026-11-15 00:00:00' ), $this->user_data() ), $zone ); - $this->assertTrue( Offer_Notice::should_show( $at( '2026-11-27 23:59:59' ), $this->user_data() ), $zone ); - $this->assertFalse( Offer_Notice::should_show( $at( '2026-11-28 00:00:00' ), $this->user_data() ), $zone ); + $this->assertFalse( Offer_Notice::should_show( $at( '2026-11-13 23:59:59' ), $this->user_data() ), $zone ); + $this->assertTrue( Offer_Notice::should_show( $at( '2026-11-14 00:00:00' ), $this->user_data() ), $zone ); + $this->assertTrue( Offer_Notice::should_show( $at( '2026-11-30 23:59:59' ), $this->user_data() ), $zone ); + $this->assertFalse( Offer_Notice::should_show( $at( '2026-12-01 00:00:00' ), $this->user_data() ), $zone ); $this->assertSame( 'bfcm-2026', Offer_Notice::get_campaign( $at( '2026-11-20 12:00:00' ) ), $zone ); } } public function test_nothing_shows_between_halloween_and_black_friday_or_on_a_later_year() { - foreach ( array( '2026-11-10 00:00:00', '2026-11-12 12:00:00', '2026-11-14 23:59:59', '2027-11-20 12:00:00' ) as $time ) { + foreach ( array( '2026-11-10 00:00:00', '2026-11-12 12:00:00', '2026-11-13 23:59:59', '2027-11-20 12:00:00' ) as $time ) { $this->assertNull( Offer_Notice::get_campaign( $this->moment( $time ) ), $time ); $this->assertFalse( Offer_Notice::should_show( $this->moment( $time ), $this->user_data() ), $time ); } @@ -282,7 +282,7 @@ public function test_black_friday_render_has_its_code_copy_and_deals_link_and_no $this->assertStringContainsString( 'data-code="BFCM2026"', $html ); $this->assertStringContainsString( 'Black Friday offer', $html ); $this->assertStringContainsString( 'Black Friday deal: Get 50% off GoDAM', $html ); - $this->assertStringContainsString( 'Ends November 27 at 11:59 p.m. 50% off your first month or year on any plan.', $html ); + $this->assertStringContainsString( 'Ends November 30 at 11:59 p.m. 50% off your first month or year on any plan.', $html ); $this->assertStringContainsString( 'rtgodam-offer-notice--no-art', $html ); $this->assertStringNotContainsString( 'rtgodam-offer-notice__art', $html ); $this->assertStringNotContainsString( 'rtgodam-offer-notice__pumpkin', $html ); From cec79bc2baf1fb27fbc23d8eb026758e144154f1 Mon Sep 17 00:00:00 2001 From: Subodh Rajpopat Date: Mon, 9 Nov 2026 18:53:11 +0530 Subject: [PATCH 4/9] Name both Black Friday and Cyber Monday in the offer notice The eyebrow now reads "Black Friday and Cyber Monday offer" and the title "Black Friday and Cyber Monday deal: Get 50% off GoDAM". Dates, code and tests are unchanged apart from the expected strings. --- inc/classes/class-offer-notice.php | 8 ++++---- tests/php/OfferNoticeTest.php | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/inc/classes/class-offer-notice.php b/inc/classes/class-offer-notice.php index e02cd084de..99c268acdb 100644 --- a/inc/classes/class-offer-notice.php +++ b/inc/classes/class-offer-notice.php @@ -3,8 +3,8 @@ * Seasonal offer notice shown in wp-admin to free and trial sites. * * Each campaign has fixed dates, a code and its own dismissal: the Halloween - * 2026 offer (SPOOKY50, through November 9) and the Black Friday 2026 offer - * (BFCM2026, November 14 to 30). Nothing shows between or after them. The + * 2026 offer (SPOOKY50, through November 9) and the Black Friday and Cyber Monday + * 2026 offer (BFCM2026, November 14 to 30). Nothing shows between or after them. The * message names the integrations the site already uses, so a LifterLMS site * reads about course videos and a WooCommerce store about shoppable video. * @@ -304,7 +304,7 @@ public static function render( $placement, $now = null, $user_data = null ) { - +

@@ -313,7 +313,7 @@ public static function render( $placement, $now = null, $user_data = null ) { /* translators: %s: the discount, shown in the accent colour, for example "Get 50% off". */ ? esc_html__( 'No tricks, just treats: %s GoDAM!', 'godam' ) /* translators: %s: the discount, shown in the accent colour, for example "Get 50% off". */ - : esc_html__( 'Black Friday deal: %s GoDAM', 'godam' ); + : esc_html__( 'Black Friday and Cyber Monday deal: %s GoDAM', 'godam' ); echo wp_kses( sprintf( $title, '' . esc_html__( 'Get 50% off', 'godam' ) . '' ), array( 'span' => array() ) diff --git a/tests/php/OfferNoticeTest.php b/tests/php/OfferNoticeTest.php index 62e28db0e9..1da541a2bd 100644 --- a/tests/php/OfferNoticeTest.php +++ b/tests/php/OfferNoticeTest.php @@ -5,7 +5,7 @@ * Joel's rules from the 2.5.2 release thread: a WP-admin notice, only for free * and trial sites (never paid), gone after each offer ends, and a message * picked by the integrations the site uses. Halloween runs through November 9, - * Black Friday from November 14 to 30 (the BFCM 2026 campaign doc). + * Black Friday and Cyber Monday from November 14 to 30 (the BFCM 2026 campaign doc). * * @package GoDAM */ @@ -280,8 +280,8 @@ public function test_black_friday_render_has_its_code_copy_and_deals_link_and_no $this->assertStringContainsString( 'https://godam.io/deals/?utm_source=godam-plugin&utm_medium=admin-notice&utm_campaign=bfcm2026&utm_content=media-library-lifterlms', $html ); $this->assertStringContainsString( 'data-code="BFCM2026"', $html ); - $this->assertStringContainsString( 'Black Friday offer', $html ); - $this->assertStringContainsString( 'Black Friday deal: Get 50% off GoDAM', $html ); + $this->assertStringContainsString( 'Black Friday and Cyber Monday offer', $html ); + $this->assertStringContainsString( 'Black Friday and Cyber Monday deal: Get 50% off GoDAM', $html ); $this->assertStringContainsString( 'Ends November 30 at 11:59 p.m. 50% off your first month or year on any plan.', $html ); $this->assertStringContainsString( 'rtgodam-offer-notice--no-art', $html ); $this->assertStringNotContainsString( 'rtgodam-offer-notice__art', $html ); From 85a471276061e935d2219d0245dd737482ed142e Mon Sep 17 00:00:00 2001 From: Subodh Rajpopat Date: Wed, 11 Nov 2026 11:12:16 +0530 Subject: [PATCH 5/9] Start the Black Friday notice on November 13 The campaign now runs November 13 00:00:00 to November 30 23:59:59 in the site's time zone. The footer ("Ends November 30") is unchanged. Co-Authored-By: Claude Opus 5.5 --- inc/classes/class-offer-notice.php | 4 ++-- tests/php/OfferNoticeTest.php | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/inc/classes/class-offer-notice.php b/inc/classes/class-offer-notice.php index 99c268acdb..ba4220f32c 100644 --- a/inc/classes/class-offer-notice.php +++ b/inc/classes/class-offer-notice.php @@ -4,7 +4,7 @@ * * Each campaign has fixed dates, a code and its own dismissal: the Halloween * 2026 offer (SPOOKY50, through November 9) and the Black Friday and Cyber Monday - * 2026 offer (BFCM2026, November 14 to 30). Nothing shows between or after them. The + * 2026 offer (BFCM2026, November 13 to 30). Nothing shows between or after them. The * message names the integrations the site already uses, so a LifterLMS site * reads about course videos and a WooCommerce store about shoppable video. * @@ -49,7 +49,7 @@ class Offer_Notice { ), ), 'bfcm-2026' => array( - 'start' => '2026-11-14 00:00:00', + 'start' => '2026-11-13 00:00:00', 'end' => '2026-11-30 23:59:59', 'code' => 'BFCM2026', 'dismiss_option' => 'rtgodam_offer_bfcm_2026_dismissed', diff --git a/tests/php/OfferNoticeTest.php b/tests/php/OfferNoticeTest.php index 1da541a2bd..54c58835ae 100644 --- a/tests/php/OfferNoticeTest.php +++ b/tests/php/OfferNoticeTest.php @@ -5,7 +5,7 @@ * Joel's rules from the 2.5.2 release thread: a WP-admin notice, only for free * and trial sites (never paid), gone after each offer ends, and a message * picked by the integrations the site uses. Halloween runs through November 9, - * Black Friday and Cyber Monday from November 14 to 30 (the BFCM 2026 campaign doc). + * Black Friday and Cyber Monday from November 13 to 30 (the BFCM 2026 campaign doc). * * @package GoDAM */ @@ -234,15 +234,15 @@ public function test_render_prints_the_claim_link_with_its_tracking_and_nothing_ $this->assertSame( '', trim( ob_get_clean() ) ); } - public function test_black_friday_shows_from_the_first_second_of_november_14_to_the_last_of_november_30() { + public function test_black_friday_shows_from_the_first_second_of_november_13_to_the_last_of_november_30() { foreach ( array( 'Asia/Kolkata', 'America/New_York' ) as $zone ) { $timezone = new \DateTimeZone( $zone ); $GLOBALS['rtgodam_stub']['timezone'] = $timezone; $at = static fn( $time ) => new \DateTime( $time, $timezone ); - $this->assertFalse( Offer_Notice::should_show( $at( '2026-11-13 23:59:59' ), $this->user_data() ), $zone ); - $this->assertTrue( Offer_Notice::should_show( $at( '2026-11-14 00:00:00' ), $this->user_data() ), $zone ); + $this->assertFalse( Offer_Notice::should_show( $at( '2026-11-12 23:59:59' ), $this->user_data() ), $zone ); + $this->assertTrue( Offer_Notice::should_show( $at( '2026-11-13 00:00:00' ), $this->user_data() ), $zone ); $this->assertTrue( Offer_Notice::should_show( $at( '2026-11-30 23:59:59' ), $this->user_data() ), $zone ); $this->assertFalse( Offer_Notice::should_show( $at( '2026-12-01 00:00:00' ), $this->user_data() ), $zone ); $this->assertSame( 'bfcm-2026', Offer_Notice::get_campaign( $at( '2026-11-20 12:00:00' ) ), $zone ); @@ -250,7 +250,7 @@ public function test_black_friday_shows_from_the_first_second_of_november_14_to_ } public function test_nothing_shows_between_halloween_and_black_friday_or_on_a_later_year() { - foreach ( array( '2026-11-10 00:00:00', '2026-11-12 12:00:00', '2026-11-13 23:59:59', '2027-11-20 12:00:00' ) as $time ) { + foreach ( array( '2026-11-10 00:00:00', '2026-11-11 12:00:00', '2026-11-12 23:59:59', '2027-11-20 12:00:00' ) as $time ) { $this->assertNull( Offer_Notice::get_campaign( $this->moment( $time ) ), $time ); $this->assertFalse( Offer_Notice::should_show( $this->moment( $time ), $this->user_data() ), $time ); } From 7db8be5b2e97fc8c8ed66484ff3e1c0f129ed115 Mon Sep 17 00:00:00 2001 From: Subodh Rajpopat Date: Wed, 11 Nov 2026 12:53:55 +0530 Subject: [PATCH 6/9] End the Black Friday notice on December 3 The sale window is now November 13 to December 3, so the notice keeps showing for three days after Cyber Monday (November 30). --- inc/classes/class-offer-notice.php | 6 +++--- tests/php/OfferNoticeTest.php | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/inc/classes/class-offer-notice.php b/inc/classes/class-offer-notice.php index ba4220f32c..2f4b3e54f4 100644 --- a/inc/classes/class-offer-notice.php +++ b/inc/classes/class-offer-notice.php @@ -4,7 +4,7 @@ * * Each campaign has fixed dates, a code and its own dismissal: the Halloween * 2026 offer (SPOOKY50, through November 9) and the Black Friday and Cyber Monday - * 2026 offer (BFCM2026, November 13 to 30). Nothing shows between or after them. The + * 2026 offer (BFCM2026, November 13 to December 3). Nothing shows between or after them. The * message names the integrations the site already uses, so a LifterLMS site * reads about course videos and a WooCommerce store about shoppable video. * @@ -50,7 +50,7 @@ class Offer_Notice { ), 'bfcm-2026' => array( 'start' => '2026-11-13 00:00:00', - 'end' => '2026-11-30 23:59:59', + 'end' => '2026-12-03 23:59:59', 'code' => 'BFCM2026', 'dismiss_option' => 'rtgodam_offer_bfcm_2026_dismissed', 'path' => '/deals/', @@ -357,7 +357,7 @@ public static function render( $placement, $now = null, $user_data = null ) { if ( $is_halloween ) { esc_html_e( 'Through November 9. Don\'t let this treat disappear!', 'godam' ); } else { - esc_html_e( 'Ends November 30 at 11:59 p.m. 50% off your first month or year on any plan.', 'godam' ); + esc_html_e( 'Ends December 3 at 11:59 p.m. 50% off your first month or year on any plan.', 'godam' ); } ?>

diff --git a/tests/php/OfferNoticeTest.php b/tests/php/OfferNoticeTest.php index 54c58835ae..349ce0b2ed 100644 --- a/tests/php/OfferNoticeTest.php +++ b/tests/php/OfferNoticeTest.php @@ -5,7 +5,7 @@ * Joel's rules from the 2.5.2 release thread: a WP-admin notice, only for free * and trial sites (never paid), gone after each offer ends, and a message * picked by the integrations the site uses. Halloween runs through November 9, - * Black Friday and Cyber Monday from November 13 to 30 (the BFCM 2026 campaign doc). + * Black Friday and Cyber Monday from November 13 to December 3 (the BFCM 2026 campaign doc). * * @package GoDAM */ @@ -234,7 +234,7 @@ public function test_render_prints_the_claim_link_with_its_tracking_and_nothing_ $this->assertSame( '', trim( ob_get_clean() ) ); } - public function test_black_friday_shows_from_the_first_second_of_november_13_to_the_last_of_november_30() { + public function test_black_friday_shows_from_the_first_second_of_november_13_to_the_last_of_december_3() { foreach ( array( 'Asia/Kolkata', 'America/New_York' ) as $zone ) { $timezone = new \DateTimeZone( $zone ); $GLOBALS['rtgodam_stub']['timezone'] = $timezone; @@ -243,8 +243,8 @@ public function test_black_friday_shows_from_the_first_second_of_november_13_to_ $this->assertFalse( Offer_Notice::should_show( $at( '2026-11-12 23:59:59' ), $this->user_data() ), $zone ); $this->assertTrue( Offer_Notice::should_show( $at( '2026-11-13 00:00:00' ), $this->user_data() ), $zone ); - $this->assertTrue( Offer_Notice::should_show( $at( '2026-11-30 23:59:59' ), $this->user_data() ), $zone ); - $this->assertFalse( Offer_Notice::should_show( $at( '2026-12-01 00:00:00' ), $this->user_data() ), $zone ); + $this->assertTrue( Offer_Notice::should_show( $at( '2026-12-03 23:59:59' ), $this->user_data() ), $zone ); + $this->assertFalse( Offer_Notice::should_show( $at( '2026-12-04 00:00:00' ), $this->user_data() ), $zone ); $this->assertSame( 'bfcm-2026', Offer_Notice::get_campaign( $at( '2026-11-20 12:00:00' ) ), $zone ); } } @@ -282,7 +282,7 @@ public function test_black_friday_render_has_its_code_copy_and_deals_link_and_no $this->assertStringContainsString( 'data-code="BFCM2026"', $html ); $this->assertStringContainsString( 'Black Friday and Cyber Monday offer', $html ); $this->assertStringContainsString( 'Black Friday and Cyber Monday deal: Get 50% off GoDAM', $html ); - $this->assertStringContainsString( 'Ends November 30 at 11:59 p.m. 50% off your first month or year on any plan.', $html ); + $this->assertStringContainsString( 'Ends December 3 at 11:59 p.m. 50% off your first month or year on any plan.', $html ); $this->assertStringContainsString( 'rtgodam-offer-notice--no-art', $html ); $this->assertStringNotContainsString( 'rtgodam-offer-notice__art', $html ); $this->assertStringNotContainsString( 'rtgodam-offer-notice__pumpkin', $html ); From 39a4ef2d11b9089121acc4dac4fa2d954727ad54 Mon Sep 17 00:00:00 2001 From: Subodh Rajpopat Date: Wed, 11 Nov 2026 13:32:41 +0530 Subject: [PATCH 7/9] Point the Black Friday Claim button to godam.io/pricing/ godam.io/deals/ does not exist (404), so the button now opens the pricing page, like the Halloween notice and the godam.io top bar. --- inc/classes/class-offer-notice.php | 2 +- tests/php/OfferNoticeTest.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/inc/classes/class-offer-notice.php b/inc/classes/class-offer-notice.php index 2f4b3e54f4..44256f9dad 100644 --- a/inc/classes/class-offer-notice.php +++ b/inc/classes/class-offer-notice.php @@ -53,7 +53,7 @@ class Offer_Notice { 'end' => '2026-12-03 23:59:59', 'code' => 'BFCM2026', 'dismiss_option' => 'rtgodam_offer_bfcm_2026_dismissed', - 'path' => '/deals/', + 'path' => '/pricing/', 'utm' => array( 'utm_source' => 'godam-plugin', 'utm_medium' => 'admin-notice', diff --git a/tests/php/OfferNoticeTest.php b/tests/php/OfferNoticeTest.php index 349ce0b2ed..009370a087 100644 --- a/tests/php/OfferNoticeTest.php +++ b/tests/php/OfferNoticeTest.php @@ -270,7 +270,7 @@ public function test_a_paid_site_never_sees_black_friday() { $this->assertFalse( Offer_Notice::should_show( $this->moment( '2026-11-20 12:00:00' ), $this->user_data() ) ); } - public function test_black_friday_render_has_its_code_copy_and_deals_link_and_no_halloween_art() { + public function test_black_friday_render_has_its_code_copy_and_pricing_link_and_no_halloween_art() { $this->stub_render(); $GLOBALS['rtgodam_stub']['active_plugins'] = array( 'lifterlms/lifterlms.php' ); @@ -278,7 +278,7 @@ public function test_black_friday_render_has_its_code_copy_and_deals_link_and_no Offer_Notice::render( 'media-library', $this->moment( '2026-11-20 12:00:00' ), $this->user_data() ); $html = ob_get_clean(); - $this->assertStringContainsString( 'https://godam.io/deals/?utm_source=godam-plugin&utm_medium=admin-notice&utm_campaign=bfcm2026&utm_content=media-library-lifterlms', $html ); + $this->assertStringContainsString( 'https://godam.io/pricing/?utm_source=godam-plugin&utm_medium=admin-notice&utm_campaign=bfcm2026&utm_content=media-library-lifterlms', $html ); $this->assertStringContainsString( 'data-code="BFCM2026"', $html ); $this->assertStringContainsString( 'Black Friday and Cyber Monday offer', $html ); $this->assertStringContainsString( 'Black Friday and Cyber Monday deal: Get 50% off GoDAM', $html ); From 306236428826aec902bea45f3da0fb4dbc9248f2 Mon Sep 17 00:00:00 2001 From: Subodh Rajpopat Date: Wed, 11 Nov 2026 14:30:17 +0530 Subject: [PATCH 8/9] Replace the ended Halloween offer with Black Friday Halloween 2026 ended on November 9, so its campaign entry, copy, spider and pumpkin drawings and their styles are removed. Black Friday is now the only campaign; the next offer replaces it the same way. Tests move to Black Friday dates and check that Halloween never shows again. --- assets/src/css/admin.scss | 25 +---------- inc/classes/class-offer-notice.php | 65 +++++----------------------- tests/php/OfferNoticeTest.php | 68 ++++++++++++++++-------------- 3 files changed, 48 insertions(+), 110 deletions(-) diff --git a/assets/src/css/admin.scss b/assets/src/css/admin.scss index 10b10f83c5..4958402976 100644 --- a/assets/src/css/admin.scss +++ b/assets/src/css/admin.scss @@ -1205,27 +1205,15 @@ to ensure proper responsiveness and avoid layout issues. } } -/* Seasonal offer notice (Halloween and Black Friday 2026), shown on the Dashboard and Media Library. */ +/* Seasonal offer notice (Black Friday 2026), shown on the Dashboard and Media Library. */ .rtgodam-offer-notice { position: relative; display: flex; gap: 8px; - padding: 14px 44px 14px 0; + padding: 14px 44px 14px 16px; border-left-color: #5d31ff; overflow: hidden; - // No drawing on the left: the text needs the usual notice padding instead. - &--no-art { - padding-left: 16px; - } - - &__art { - flex: none; - width: 92px; - height: 104px; - margin-top: -14px; - } - &__body p { margin: 0; padding: 0; @@ -1242,11 +1230,6 @@ to ensure proper responsiveness and avoid layout issues. color: #5d31ff; } - &__pumpkin { - width: 18px; - height: 18px; - } - .rtgodam-offer-notice__title { font-size: 20px; line-height: 1.25; @@ -1368,9 +1351,5 @@ to ensure proper responsiveness and avoid layout issues. & { padding-left: 12px; } - - &__art { - display: none; - } } } diff --git a/inc/classes/class-offer-notice.php b/inc/classes/class-offer-notice.php index 44256f9dad..a4952cc0e8 100644 --- a/inc/classes/class-offer-notice.php +++ b/inc/classes/class-offer-notice.php @@ -2,9 +2,9 @@ /** * Seasonal offer notice shown in wp-admin to free and trial sites. * - * Each campaign has fixed dates, a code and its own dismissal: the Halloween - * 2026 offer (SPOOKY50, through November 9) and the Black Friday and Cyber Monday - * 2026 offer (BFCM2026, November 13 to December 3). Nothing shows between or after them. The + * Each campaign has fixed dates, a code and its own dismissal: today only the + * Black Friday and Cyber Monday 2026 offer (BFCM2026, November 13 to December 3). + * Nothing shows outside a campaign's dates, so nothing repeats next year. The * message names the integrations the site already uses, so a LifterLMS site * reads about course videos and a WooCommerce store about shoppable video. * @@ -36,19 +36,7 @@ class Offer_Notice { * @var array */ const CAMPAIGNS = array( - 'halloween-2026' => array( - 'start' => '2026-10-01 00:00:00', // Before 2.5.2 shipped it: the notice showed from install. - 'end' => '2026-11-09 23:59:59', - 'code' => 'SPOOKY50', - 'dismiss_option' => 'rtgodam_offer_halloween_2026_dismissed', - 'path' => '/pricing/', - 'utm' => array( - 'utm_campaign' => 'halloween-2026', - 'utm_source' => '', // The site's host, filled in at render. - 'utm_medium' => 'plugin', - ), - ), - 'bfcm-2026' => array( + 'bfcm-2026' => array( 'start' => '2026-11-13 00:00:00', 'end' => '2026-12-03 23:59:59', 'code' => 'BFCM2026', @@ -270,50 +258,23 @@ public static function render( $placement, $now = null, $user_data = null ) { $campaign_key = self::get_campaign( $now ); $campaign = self::CAMPAIGNS[ $campaign_key ]; - $is_halloween = 'halloween-2026' === $campaign_key; $integrations = self::get_active_integrations(); $message = self::get_message( $integrations ); $chips = array_slice( array_unique( array_column( $integrations, 'name' ) ), 0, 3 ); $utm = $campaign['utm']; - if ( '' === $utm['utm_source'] ) { - $utm['utm_source'] = wp_parse_url( home_url(), PHP_URL_HOST ); - } + $utm['utm_content'] = $placement . '-' . $message['key']; $claim_url = add_query_arg( $utm, RTGODAM_IO_API_BASE . $campaign['path'] ); ?> -
- - - +

- - - - - - +

' . esc_html__( 'Get 50% off', 'godam' ) . '' ), array( 'span' => array() ) @@ -353,13 +314,7 @@ public static function render( $placement, $now = null, $user_data = null ) {

- +

diff --git a/tests/php/OfferNoticeTest.php b/tests/php/OfferNoticeTest.php index 009370a087..1754811fe0 100644 --- a/tests/php/OfferNoticeTest.php +++ b/tests/php/OfferNoticeTest.php @@ -4,8 +4,9 @@ * * Joel's rules from the 2.5.2 release thread: a WP-admin notice, only for free * and trial sites (never paid), gone after each offer ends, and a message - * picked by the integrations the site uses. Halloween runs through November 9, - * Black Friday and Cyber Monday from November 13 to December 3 (the BFCM 2026 campaign doc). + * picked by the integrations the site uses. Black Friday and Cyber Monday runs + * from November 13 to December 3 (the BFCM 2026 campaign doc). The Halloween 2026 + * campaign is removed: it ended on November 9 and must never show again. * * @package GoDAM */ @@ -79,31 +80,36 @@ private function connect( $plan, $end_date ) { ); } - public function test_a_free_site_admin_sees_it_before_the_offer_ends() { - $this->assertTrue( Offer_Notice::should_show( $this->moment( '2026-10-29 10:00:00' ), $this->user_data() ) ); + public function test_a_free_site_admin_sees_it_during_the_offer() { + $this->assertTrue( Offer_Notice::should_show( $this->moment( '2026-11-20 12:00:00' ), $this->user_data() ) ); } - public function test_it_shows_until_the_last_second_of_november_9_and_not_after() { - $this->assertTrue( Offer_Notice::should_show( $this->moment( '2026-11-09 23:59:59' ), $this->user_data() ) ); - $this->assertFalse( Offer_Notice::should_show( $this->moment( '2026-11-10 00:00:00' ), $this->user_data() ) ); + public function test_the_ended_halloween_offer_never_shows_again() { + foreach ( array( '2026-10-01 00:00:00', '2026-10-29 10:00:00', '2026-11-09 23:59:59' ) as $time ) { + $this->assertNull( Offer_Notice::get_campaign( $this->moment( $time ) ), $time ); + $this->assertFalse( Offer_Notice::should_show( $this->moment( $time ), $this->user_data() ), $time ); + } + $this->assertArrayNotHasKey( 'halloween-2026', Offer_Notice::CAMPAIGNS ); } public function test_the_end_follows_the_site_time_zone_not_utc() { - // A site in India: midnight on 10 Nov there is 18:30 UTC on 9 Nov. + // A site in India: midnight on 4 Dec there is 18:30 UTC on 3 Dec. $GLOBALS['rtgodam_stub']['timezone'] = new \DateTimeZone( 'Asia/Kolkata' ); - $this->assertTrue( Offer_Notice::should_show( $this->moment( '2026-11-09 18:29:59' ), $this->user_data() ) ); - $this->assertFalse( Offer_Notice::should_show( $this->moment( '2026-11-09 18:30:00' ), $this->user_data() ) ); + $this->assertTrue( Offer_Notice::should_show( $this->moment( '2026-12-03 18:29:59' ), $this->user_data() ) ); + $this->assertFalse( Offer_Notice::should_show( $this->moment( '2026-12-03 18:30:00' ), $this->user_data() ) ); - // A site in New York: still 9 Nov there when it is already 10 Nov in UTC. + // A site in New York: still 3 Dec there when it is already 4 Dec in UTC. $GLOBALS['rtgodam_stub']['timezone'] = new \DateTimeZone( 'America/New_York' ); - $this->assertTrue( Offer_Notice::should_show( $this->moment( '2026-11-10 04:59:59' ), $this->user_data() ) ); - $this->assertFalse( Offer_Notice::should_show( $this->moment( '2026-11-10 05:00:00' ), $this->user_data() ) ); + $this->assertTrue( Offer_Notice::should_show( $this->moment( '2026-12-04 04:59:59' ), $this->user_data() ) ); + $this->assertFalse( Offer_Notice::should_show( $this->moment( '2026-12-04 05:00:00' ), $this->user_data() ) ); } public function test_it_never_shows_on_a_later_year() { - $this->assertFalse( Offer_Notice::should_show( $this->moment( '2027-10-29 10:00:00' ), $this->user_data() ) ); + foreach ( array( '2027-10-29 10:00:00', '2027-11-13 00:00:00', '2027-11-26 12:00:00', '2027-12-01 12:00:00' ) as $time ) { + $this->assertFalse( Offer_Notice::should_show( $this->moment( $time ), $this->user_data() ), $time ); + } } public function test_a_trial_site_sees_it() { @@ -116,7 +122,7 @@ public function test_a_paid_site_never_sees_it() { $this->connect( 'Starter', gmdate( 'Y-m-d H:i:s', time() + 300 * DAY_IN_SECONDS ) ); $this->assertFalse( Offer_Notice::is_free_or_trial_site( $this->user_data() ) ); - $this->assertFalse( Offer_Notice::should_show( $this->moment( '2026-10-29 10:00:00' ), $this->user_data() ) ); + $this->assertFalse( Offer_Notice::should_show( $this->moment( '2026-11-20 12:00:00' ), $this->user_data() ) ); } public function test_a_connected_free_plan_whose_trial_has_ended_does_not_see_it() { @@ -128,15 +134,15 @@ public function test_a_connected_free_plan_whose_trial_has_ended_does_not_see_it public function test_only_administrators_see_it() { $GLOBALS['rtgodam_stub']['caps'] = array( 'edit_posts' ); - $this->assertFalse( Offer_Notice::should_show( $this->moment( '2026-10-29 10:00:00' ), $this->user_data() ) ); + $this->assertFalse( Offer_Notice::should_show( $this->moment( '2026-11-20 12:00:00' ), $this->user_data() ) ); } public function test_a_dismissed_notice_stays_hidden_and_an_old_offer_dismissal_does_not_hide_it() { $GLOBALS['rtgodam_stub']['options']['rtgodam-offer-banner'] = 0; - $this->assertTrue( Offer_Notice::should_show( $this->moment( '2026-10-29 10:00:00' ), $this->user_data() ) ); + $this->assertTrue( Offer_Notice::should_show( $this->moment( '2026-11-20 12:00:00' ), $this->user_data() ) ); - $GLOBALS['rtgodam_stub']['options']['rtgodam_offer_halloween_2026_dismissed'] = 1793170000; - $this->assertFalse( Offer_Notice::should_show( $this->moment( '2026-10-29 10:00:00' ), $this->user_data() ) ); + $GLOBALS['rtgodam_stub']['options']['rtgodam_offer_bfcm_2026_dismissed'] = 1793170000; + $this->assertFalse( Offer_Notice::should_show( $this->moment( '2026-11-20 12:00:00' ), $this->user_data() ) ); } public function test_lifterlms_wins_over_every_other_integration() { @@ -204,8 +210,8 @@ public function test_dismiss_rejects_a_bad_nonce_and_a_non_administrator_and_sav $this->assertSame( array(), $GLOBALS['rtgodam_stub']['options'] ); $GLOBALS['rtgodam_stub']['caps'] = array( 'manage_options' ); - $this->assertSame( 'success', $this->call_dismiss( $this->moment( '2026-10-29 10:00:00' ) ) ); - $this->assertNotEmpty( $GLOBALS['rtgodam_stub']['options']['rtgodam_offer_halloween_2026_dismissed'] ); + $this->assertSame( 'success', $this->call_dismiss( $this->moment( '2026-11-20 12:00:00' ) ) ); + $this->assertNotEmpty( $GLOBALS['rtgodam_stub']['options']['rtgodam_offer_bfcm_2026_dismissed'] ); } public function test_render_prints_the_claim_link_with_its_tracking_and_nothing_for_a_paid_site() { @@ -217,20 +223,19 @@ public function test_render_prints_the_claim_link_with_its_tracking_and_nothing_ } ob_start(); - Offer_Notice::render( 'dashboard', $this->moment( '2026-10-29 10:00:00' ), $this->user_data() ); + Offer_Notice::render( 'dashboard', $this->moment( '2026-11-20 12:00:00' ), $this->user_data() ); $html = ob_get_clean(); - $this->assertStringContainsString( 'utm_campaign=halloween-2026', $html ); + $this->assertStringContainsString( 'utm_campaign=bfcm2026', $html ); $this->assertStringContainsString( 'utm_content=dashboard-woocommerce', $html ); $this->assertStringContainsString( 'Works with WooCommerce', $html ); - $this->assertStringContainsString( 'data-code="SPOOKY50"', $html ); - // Sized in the markup, so a missing or stale admin.css cannot blow the drawings up to full width. - $this->assertStringContainsString( 'viewBox="0 0 92 104" width="92" height="104"', $html ); + $this->assertStringContainsString( 'data-code="BFCM2026"', $html ); + // Sized in the markup, so a missing or stale admin.css cannot blow the copy icon up to full width. $this->assertStringContainsString( 'viewBox="0 0 24 24" width="18" height="18"', $html ); $this->connect( 'Starter', gmdate( 'Y-m-d H:i:s', time() + 300 * DAY_IN_SECONDS ) ); ob_start(); - Offer_Notice::render( 'dashboard', $this->moment( '2026-10-29 10:00:00' ), $this->user_data() ); + Offer_Notice::render( 'dashboard', $this->moment( '2026-11-20 12:00:00' ), $this->user_data() ); $this->assertSame( '', trim( ob_get_clean() ) ); } @@ -249,14 +254,14 @@ public function test_black_friday_shows_from_the_first_second_of_november_13_to_ } } - public function test_nothing_shows_between_halloween_and_black_friday_or_on_a_later_year() { - foreach ( array( '2026-11-10 00:00:00', '2026-11-11 12:00:00', '2026-11-12 23:59:59', '2027-11-20 12:00:00' ) as $time ) { + public function test_nothing_shows_before_black_friday_or_on_a_later_year() { + foreach ( array( '2026-11-09 23:59:59', '2026-11-10 00:00:00', '2026-11-11 12:00:00', '2026-11-12 23:59:59', '2027-11-20 12:00:00' ) as $time ) { $this->assertNull( Offer_Notice::get_campaign( $this->moment( $time ) ), $time ); $this->assertFalse( Offer_Notice::should_show( $this->moment( $time ), $this->user_data() ), $time ); } } - public function test_a_halloween_dismissal_does_not_hide_black_friday_and_its_own_dismissal_does() { + public function test_an_old_halloween_dismissal_does_not_hide_black_friday_and_its_own_dismissal_does() { $GLOBALS['rtgodam_stub']['options']['rtgodam_offer_halloween_2026_dismissed'] = 1793170000; $this->assertTrue( Offer_Notice::should_show( $this->moment( '2026-11-20 12:00:00' ), $this->user_data() ) ); @@ -270,7 +275,7 @@ public function test_a_paid_site_never_sees_black_friday() { $this->assertFalse( Offer_Notice::should_show( $this->moment( '2026-11-20 12:00:00' ), $this->user_data() ) ); } - public function test_black_friday_render_has_its_code_copy_and_pricing_link_and_no_halloween_art() { + public function test_black_friday_render_has_its_code_copy_and_pricing_link_and_no_halloween_content() { $this->stub_render(); $GLOBALS['rtgodam_stub']['active_plugins'] = array( 'lifterlms/lifterlms.php' ); @@ -283,7 +288,6 @@ public function test_black_friday_render_has_its_code_copy_and_pricing_link_and_ $this->assertStringContainsString( 'Black Friday and Cyber Monday offer', $html ); $this->assertStringContainsString( 'Black Friday and Cyber Monday deal: Get 50% off GoDAM', $html ); $this->assertStringContainsString( 'Ends December 3 at 11:59 p.m. 50% off your first month or year on any plan.', $html ); - $this->assertStringContainsString( 'rtgodam-offer-notice--no-art', $html ); $this->assertStringNotContainsString( 'rtgodam-offer-notice__art', $html ); $this->assertStringNotContainsString( 'rtgodam-offer-notice__pumpkin', $html ); $this->assertStringNotContainsString( 'SPOOKY50', $html ); From de5d688516c5c8feff68f60217a435ec123de7fe Mon Sep 17 00:00:00 2001 From: Subodh Rajpopat Date: Wed, 11 Nov 2026 14:47:06 +0530 Subject: [PATCH 9/9] fix: tag the campaign list and get_campaign() with @since 2.8.1 Addresses review: https://github.com/rtCamp/godam/pull/2303#discussion_r4535918512 --- inc/classes/class-offer-notice.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/inc/classes/class-offer-notice.php b/inc/classes/class-offer-notice.php index a4952cc0e8..cb841935cf 100644 --- a/inc/classes/class-offer-notice.php +++ b/inc/classes/class-offer-notice.php @@ -31,7 +31,7 @@ class Offer_Notice { * dismissed an earlier offer still sees the next one. `path` is the godam.io page the Claim * button opens, and `utm` its tracking (`utm_content` is added per placement and message). * - * @since n.e.x.t + * @since 2.8.1 * * @var array */ @@ -86,7 +86,7 @@ public static function should_show( $now = null, $user_data = null ) { /** * The campaign running at the given moment, in the site's time zone. * - * @since n.e.x.t + * @since 2.8.1 * * @param \DateTimeInterface|null $now The moment to check, now when null. Tests pass a fixed time. *