Repository navigation
Show the Black Friday and Cyber Monday offer notice from November 13 to December 3 - #2303
Conversation
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 <noreply@anthropic.com>
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 <noreply@anthropic.com>
🔍 WordPress Plugin Check Report
📊 Report
|
| 📍 Line | 🔖 Check | 💬 Message |
|---|---|---|
0 |
mismatched_plugin_name | Plugin name "GoDAM - Video Hosting for LMS & Online Courses" is different from the name declared in plugin header "GoDAM". |
📁 assets/build/pages/video-editor.min.js (1 warning)
| 📍 Line | 🔖 Check | 💬 Message |
|---|---|---|
2 |
react_removed_api | This file calls "ReactDOM.findDOMNode", which was removed in React 19 and stops working once WordPress upgrades React. Use a ref on the element instead. |
📁 assets/build/css/main.css (1 warning)
| 📍 Line | 🔖 Check | 💬 Message |
|---|---|---|
0 |
EnqueuedStylesScope | This style is being loaded in all contexts. |
📁 assets/src/libs/analytics.min.js (5 warnings)
| 📍 Line | 🔖 Check | 💬 Message |
|---|---|---|
0 |
EnqueuedScriptsScope | This script is being loaded in all frontend contexts. |
0 |
NonBlockingScripts.NoStrategy | This script on http://localhost:8880 (with handle analytics-library) is loaded in the footer. Consider a defer or async script loading strategy instead. |
0 |
NonBlockingScripts.NoStrategy | This script on http://localhost:8880/2026/11/11/hello-world/ (with handle analytics-library) is loaded in the footer. Consider a defer or async script loading strategy instead. |
0 |
NonBlockingScripts.NoStrategy | This script on http://localhost:8880/sample-page/ (with handle analytics-library) is loaded in the footer. Consider a defer or async script loading strategy instead. |
0 |
NonBlockingScripts.NoStrategy | This script on http://localhost:8880/demo-attachment-post/ (with handle analytics-library) is loaded in the footer. Consider a defer or async script loading strategy instead. |
📁 assets/build/js/main.min.js (5 warnings)
| 📍 Line | 🔖 Check | 💬 Message |
|---|---|---|
0 |
EnqueuedScriptsScope | This script is being loaded in all frontend contexts. |
0 |
NonBlockingScripts.NoStrategy | This script on http://localhost:8880 (with handle rtgodam-script) is loaded in the footer. Consider a defer or async script loading strategy instead. |
0 |
NonBlockingScripts.NoStrategy | This script on http://localhost:8880/2026/11/11/hello-world/ (with handle rtgodam-script) is loaded in the footer. Consider a defer or async script loading strategy instead. |
0 |
NonBlockingScripts.NoStrategy | This script on http://localhost:8880/sample-page/ (with handle rtgodam-script) is loaded in the footer. Consider a defer or async script loading strategy instead. |
0 |
NonBlockingScripts.NoStrategy | This script on http://localhost:8880/demo-attachment-post/ (with handle rtgodam-script) is loaded in the footer. Consider a defer or async script loading strategy instead. |
🤖 Generated by WordPress Plugin Check Action • Learn more about Plugin Check
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 <noreply@anthropic.com>
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.
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 <noreply@anthropic.com>
The sale window is now November 13 to December 3, so the notice keeps showing for three days after Cyber Monday (November 30).
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.
Code reviewVerdict: LGTM, no blocking issues. Moving to a What I ran
What I verified in the code
Before the 2.8.1 release (not code changes)
Nit (non-blocking)
Review drafted with Claude. |
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.
KMchaudhary
left a comment
There was a problem hiding this comment.
Reviewed the diff and the class at the head of this branch. The campaign logic, boundary seconds and separate dismiss options look right, and the tests cover them well. Seven comments inline. The time zone question and the @since n.e.x.t tag are worth settling before the November 12 release; the rest can wait for the next campaign.
| ), | ||
| 'bfcm-2026' => array( | ||
| 'start' => '2026-11-13 00:00:00', | ||
| 'end' => '2026-12-03 23:59:59', |
There was a problem hiding this comment.
Time zone of the campaign window. start and end are read in each site's own time zone, so BFCM2026 shows over a different absolute window on each site. A site set to Pacific/Pago_Pago (UTC-11) keeps showing the notice, and "Ends December 3 at 11:59 p.m.", until December 4 10:59 UTC. A UTC+14 site starts on November 12 at 10:00 UTC.
If the code on Central expires at one fixed moment, some admins will copy a code that no longer works. Could we confirm how Central expires BFCM2026, and if it is a fixed zone, pin start/end to that zone (for example a timezone key per campaign) instead of wp_timezone()?
There was a problem hiding this comment.
Central expiry needs a buffer.
| * @return void | ||
| */ | ||
| public static function dismiss() { | ||
| public static function dismiss( $now = null ) { |
There was a problem hiding this comment.
Dismiss uses the clock, not the notice shown. dismiss() picks the campaign from the server time when the click arrives. If an admin loads the Dashboard at December 3, 23:59:50 and clicks the close button at December 4, 00:00:05, the call returns success but writes no option. With back-to-back campaigns, a stale notice dismissed after the switch would hide the new campaign, which the admin never saw.
Rendering data-campaign="<key>" on the notice, sending it with the AJAX call and checking it against CAMPAIGNS would tie the dismissal to what the admin actually closed. Not urgent for 2026, since there is a gap between the two campaigns.
There was a problem hiding this comment.
Valid. A close click that lands after the end returns success and writes nothing, and with back-to-back campaigns a stale notice could hide the next one. Sending the campaign key with the AJAX call ties the dismissal to the notice shown. Black Friday is the only campaign and there is a gap before the next, so it is a follow-up for after 2.8.1; no code change in this PR.
|
|
||
| /** | ||
| * Offer code. | ||
| * @since n.e.x.t |
There was a problem hiding this comment.
@since n.e.x.t. This is the only n.e.x.t in the repo, and I couldn't find a release step that replaces it, so it would ship as-is. Since this is aimed at 2.8.1, could both tags (here and on get_campaign()) be @since 2.8.1?
There was a problem hiding this comment.
Fixed in de5d688. Both tags, on CAMPAIGNS and get_campaign(), are now @since 2.8.1.
| 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 ) ) { |
There was a problem hiding this comment.
Repeated work. get_campaign() builds two DateTime objects per campaign on every call. One Dashboard load runs it three times: free_plan_admin_notice() calls should_show(), then render() calls should_show() and get_campaign(). Each should_show() also reads rtgodam_get_user_data(). It is small now, but grows with each campaign. render() could call get_campaign() once and pass the result on, or the result could be cached in a static for the request. Optional.
There was a problem hiding this comment.
Valid, small. With one campaign, a Dashboard load builds two DateTime pairs three times. render() can call get_campaign() once and pass it on; follow-up with the next offer, no code change in this PR.
Addresses review: #2303 (comment)
Review packet
Base
developfor now, for 2.8.1. 2.8.0 is being released, and 2.8.1 is a patch after it. The campaign starts on November 13, so this must be in a release published by Thursday, November 12.In one line: Shows the Black Friday and Cyber Monday 2026 offer notice (50% off the first month or year with code BFCM2026) in WP admin to free and trial sites from November 13 to December 3 (three days past Cyber Monday, November 30; dates finalized). It replaces the ended Halloween offer: the Halloween campaign, copy, drawings and styles are removed, so the notice holds one campaign at a time and the next offer swaps in the same way. Spec: Copy kit K5 in Joel's BFCM 2026 campaign doc; request in the BFCM Campaign thread. Builds on #2263 (Halloween notice).
1. Criteria and proof
test_black_friday_shows_from_the_first_second_of_november_13_to_the_last_of_december_3test_the_ended_halloween_offer_never_shows_again,test_nothing_shows_before_black_friday_or_on_a_later_year,test_it_never_shows_on_a_later_yearrtgodam_offer_bfcm_2026_dismissed, so an old Halloween dismissal stored on a site does not hide ittest_an_old_halloween_dismissal_does_not_hide_black_friday_and_its_own_dismissal_does,test_dismissing_during_black_friday_saves_only_its_own_optiontest_black_friday_render_has_its_code_copy_and_pricing_link_and_no_halloween_content, the screenshot abovegodam.io/pricing/?utm_source=godam-plugin&utm_medium=admin-notice&utm_campaign=bfcm2026&utm_content=<placement>-<message>2. The notice
Current notice (commit cec79bc, 10 Nov): the WordPress Dashboard on godam-dev.local, rendered as a free site sees it on November 20. The footer in this shot still says November 30; since commit 7db8be5 it reads "Ends December 3 at 11:59 p.m."
3. Tests
tests/php/OfferNoticeTest.php):rtgodam_offer_bfcm_2026_dismissed.utm_campaign=bfcm2026and BFCM2026.class-offer-notice.phpput back tomain, 5 of the first 6 new tests fail (Call to undefined method Offer_Notice::get_campaign()and 4 failures). The paid-site test passes both ways, as a control.OfferNoticeTest: 23 tests, 86 assertions, all pass. The full suite has 30 errors that are the same on cleanmain(Media file paths, MAP tracker, Marketo client, Preflight and others), none in this file.4. Risk flags
1 spot in 1 file in this PR, raised by a script, not by judgement. Read these lines; the rest of the diff touched none of the watched areas.
Database, options and stored data (1)
inc/classes/class-offer-notice.php:337(removed)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 ); + }The dismiss write now goes to the running campaign's own option (
rtgodam_offer_bfcm_2026_dismissed), and writes nothing outside a campaign. Halloween dismissals already stored on sites (rtgodam_offer_halloween_2026_dismissed) are no longer read and do not hide Black Friday.5. Independent review
A fresh reviewer saw the spec and the diff only. No spec point missed; three low findings, all fixed in 3f13f16.
class-offer-notice.phprender()read the clock twice (should_show(), thenget_campaign()); a campaign ending between the two reads left no campaign, with PHP warnings and an empty coderender()reads the time once and passes it to bothdismiss('')(whatdo_action()passes)test_dismissing_between_campaigns_saves_nothing_and_the_ajax_call_without_a_time_still_worksThe reviewer also confirmed the Halloween render is identical to
mainapart from whitespace, and swept the boundary seconds in Pacific/Kiritimati and Pacific/Pago_Pago.6. Not verified
7. Scope
Offer_Noticenow holds a list of campaigns (CAMPAIGNS) withget_campaign()picking the running one, instead of one set of Halloween constants; today it holds onlybfcm-2026.DISMISS_OPTION,END_TIMEandCODEare gone; nothing outside the class and its test used them.dismiss()takes an optional time for tests; the AJAX hook still calls it with no time.🤖 Generated with Claude Code