Skip to content

Black Friday 2026 sale notice on the settings page #22

Description

@katie-2-0

Problem

Links from the free plugins and the paid plugins' settings pages produced 11 purchases in the 2025 Black Friday sale, with no sale message at all. For Black Friday 2026 we want a dismissible sale notice on this plugin's own settings page, pointing users to Document Library Pro with the discount already applied.

What it does

  • Shows at the top of Documents → Settings only, to users with manage_options. No other admin screen.
  • Main sale: 20 Nov 2026 00:00 UTC to 1 Dec 2026 08:00 UTC, code BF2026, 30%.
  • Last chance: 1 Dec 2026 08:00 UTC to 5 Dec 2026 00:00 UTC, code EXTRADAYS, 25%. It switches when BF2026 expires, so it never shows an expired code.
  • Outside those windows nothing is output. The notice removes itself after the sale; no follow-up release is needed.
  • Dismissible per user and per phase (user meta barn2_sale_notice_dismissed_<phase>), shared by all Barn2 plugins.
  • The button links to https://barn2.com/wordpress-plugins/document-library-pro/?discount=CODE&utm_source=plugin&utm_medium=banner&utm_campaign=bf2026&utm_content=document-library-lite. barn2.com applies ?discount= to the cart.
  • Makes no remote requests. The dates, codes and wording ship in the plugin (WordPress.org guideline 7).
  • The design is a placeholder. Daniel's final design follows by Wed 7 Oct and will be added to the same PR.

The notice class is Barn2\Lib\Admin\Sale_Notice, added to barn2-lib in barn2plugins/barn2-lib#29, so the paid plugins can reuse it.

Changelog

No changelog line: this is a time-limited promotional notice, not a feature.

QA checklist

  • Go to Documents → Settings and add &barn2_sale_preview=bf2026 to the URL (/wp-admin/admin.php?page=document_library&barn2_sale_preview=bf2026). The main sale notice shows: "Upgrade to Document Library Pro for 30% off", ending "Offer ends December 1."
  • Replace the value with extradays. The last chance notice shows: "Missed Black Friday? Upgrade to Document Library Pro for 25% off", ending "Offer ends December 4."
  • The button opens https://barn2.com/wordpress-plugins/document-library-pro/ in a new tab with discount=BF2026 (or EXTRADAYS) and the utm tags. Add the plugin to the cart on barn2.com: the discount is applied.
  • Remove the preview parameter. Before 20 Nov 2026 nothing shows.
  • No notice on the Dashboard, the Plugins page or any other settings page, even with the preview parameter.
  • A user without manage_options never sees it.
  • Click the X. The notice closes and barn2_sale_notice_dismissed_<phase> is saved for that user. (Preview mode ignores the dismissal so it can be checked repeatedly.)
  • Optional date check: add add_filter( 'barn2_sale_notice_campaigns', fn( $c ) => array_map( fn( $x ) => array_merge( $x, [ 'start' => '2020-01-01 00:00:00' ] ), $c ) ); to a snippet. The main sale shows without the preview parameter, and a dismissed user no longer sees it.
  • Narrow screen: the notice stacks with no horizontal scroll.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions