diff --git a/assets/src/css/admin.scss b/assets/src/css/admin.scss
index 8c963b2c32..4958402976 100644
--- a/assets/src/css/admin.scss
+++ b/assets/src/css/admin.scss
@@ -1205,22 +1205,15 @@ to ensure proper responsiveness and avoid layout issues.
}
}
-/* Seasonal offer notice (Halloween 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;
- &__art {
- flex: none;
- width: 92px;
- height: 104px;
- margin-top: -14px;
- }
-
&__body p {
margin: 0;
padding: 0;
@@ -1237,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;
@@ -1363,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 b6a470ec92..cb841935cf 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: 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.
*
* @package GoDAM
* @since 2.5.2
@@ -23,27 +24,31 @@
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.
- *
- * @var string
- */
- const END_TIME = '2026-11-09 23:59:59';
-
- /**
- * Offer code.
+ * @since 2.8.1
*
- * @var string
+ * @var array
*/
- const CODE = 'SPOOKY50';
+ const CAMPAIGNS = array(
+ 'bfcm-2026' => array(
+ 'start' => '2026-11-13 00:00:00',
+ 'end' => '2026-12-03 23:59:59',
+ 'code' => 'BFCM2026',
+ 'dismiss_option' => 'rtgodam_offer_bfcm_2026_dismissed',
+ 'path' => '/pricing/',
+ 'utm' => array(
+ 'utm_source' => 'godam-plugin',
+ 'utm_medium' => 'admin-notice',
+ 'utm_campaign' => 'bfcm2026',
+ ),
+ ),
+ );
/**
* AJAX action and nonce action for dismissing the notice.
@@ -70,19 +75,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 2.8.1
+ *
+ * @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;
}
/**
@@ -229,52 +249,34 @@ 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;
}
+ $campaign_key = self::get_campaign( $now );
+ $campaign = self::CAMPAIGNS[ $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'];
+
+ $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 +301,12 @@ public static function render( $placement, $now = null, $user_data = null ) {
-
@@ -312,7 +314,7 @@ public static function render( $placement, $now = null, $user_data = null ) {
-
+
@@ -321,20 +323,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..1754811fe0 100644
--- a/tests/php/OfferNoticeTest.php
+++ b/tests/php/OfferNoticeTest.php
@@ -1,10 +1,12 @@
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() {
@@ -115,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() {
@@ -127,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'][ Offer_Notice::DISMISS_OPTION ] = 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() {
@@ -195,16 +202,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-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() {
@@ -216,23 +223,95 @@ 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() ) );
}
+ 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;
+
+ $at = static fn( $time ) => new \DateTime( $time, $timezone );
+
+ $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-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 );
+ }
+ }
+
+ 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_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() ) );
+
+ $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_pricing_link_and_no_halloween_content() {
+ $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/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 );
+ $this->assertStringContainsString( 'Ends December 3 at 11:59 p.m. 50% off your first month or year on any plan.', $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'] ) );
+ }
+
+ 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.
*/
@@ -256,11 +335,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();
}