Skip to content

Turn Cookie Notice tab into a FrontConsent promo panel - #314

Open
davidperezgar wants to merge 3 commits into
trunkfrom
feature/cookie-notice-frontconsent-promo
Open

davidperezgar wants to merge 3 commits into
trunkfrom
feature/cookie-notice-frontconsent-promo

Conversation

@davidperezgar

@davidperezgar davidperezgar commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Cookie consent configuration moved to the new standalone FrontConsent plugin. The Cookie Notice settings tab no longer renders any config fields — it explains the move and offers a one-click "Install FrontConsent" button, or "Manage in FrontConsent" once it's active.
  • Removed ~900 lines of now-dead settings UI/sanitization code for Cookie Notice from Settings.php (banner copy, layout, colors, GTM/GA4/tracking integrations, legacy migration) — that logic lives in FrontConsent's own settings page now.
  • CookieNotice::is_enabled() returns false once FrontConsent is active (FRCN_VERSION defined), so the two plugins never render a banner together even before FrontConsent's own migration flips the stored option.
  • Added CookieNoticeDeprecationNotice admin notice (separate from the tab) pointing existing users with Cookie Notice enabled toward installing FrontConsent.
  • Updated readme.txt (deprecation note + changelog entry) and AGENTS.md to point future cookie-consent work to FrontConsent's own repo.
  • Removed/replaced tests that exercised the deleted Settings methods (CookieNoticeIntegrationsTest, CookieNoticeSettingsSanitizationTest); preserved the still-relevant CookieNotice cache-invalidation coverage in a new CookieNoticeCacheInvalidationTest.

Test plan

  • php -l on all changed files
  • composer lint (phpcs) — clean
  • composer phpstan — clean
  • composer test — blocked in this environment (no local WordPress test install at the path tests/bootstrap.php expects); please run in CI
  • Manual check: Cookie Notice tab shows install CTA when FrontConsent is not installed, and "Manage in FrontConsent" once it is

🤖 Generated with Claude Code

Open WordPress Playground Preview

Cookie consent configuration moved to the new standalone FrontConsent
plugin. The Cookie Notice settings tab no longer renders any config
fields here; it explains the move and offers a one-click install of
FrontConsent (or a "Manage in FrontConsent" link once it's active).

The frontend banner keeps working during the transition and disables
itself automatically once FrontConsent is detected (FRCN_VERSION).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 26, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-26T11:58:51.496094Z b2a3888 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 20144f461b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +58 to +60
return function_exists( 'is_plugin_active' )
? is_plugin_active( 'frontconsent/frontconsent.php' )
: defined( 'FRCN_VERSION' );

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Recognize the WordPress.org FrontConsent installation path

When FrontConsent is installed through the new plugin=front-consent URL, WordPress installs it under the front-consent directory, but this check looks for frontconsent/frontconsent.php. Because is_plugin_active() is available when the admin notice renders, the ternary never falls back to FRCN_VERSION; consequently, the deprecation notice continues appearing on the Dashboard and Plugins screens after FrontConsent has been activated. Check the distributed plugin basename or treat the defined FRCN_VERSION constant as authoritative.

AGENTS.md reference: AGENTS.md:L9-L9

Useful? React with 👍 / 👎.

Comment on lines +1868 to +1873
* Cookie Notice configuration moved out of FrontBlocks entirely (see
* `includes/Frontend/CookieNotice.php` and
* `includes/Admin/CookieNoticeDeprecationNotice.php`) — this tab no
* longer renders any settings fields, only an explanation and an
* install/manage call to action, so site owners who click the tab
* looking for cookie settings find where they actually live now.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Update the linked documentation for the promo-only tab

This change removes every Cookie Notice configuration field, but readme.md still links users to docs/COOKIE-NOTICE.md, which instructs them to enable the module at Appearance → FrontBlocks → Cookie Notice, describes all of the removed fields, and says statistics remain visible there. During the transition, users of the still-running bundled module are therefore directed to controls that no longer exist; update the linked documentation and readme.md to explain that configuration has moved to FrontConsent.

AGENTS.md reference: AGENTS.md:L9-L9

Useful? React with 👍 / 👎.

@@ -370,7 +266,6 @@ public function __construct() {

add_action( 'admin_menu', array( $this, 'register_menu' ) );
add_action( 'admin_init', array( $this, 'register_settings' ) );

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Keep the legacy GTM and GA4 migration active

Removing the admin_init migration breaks sites that upgrade directly from a release with the dedicated cookie_notice_gtm_id/cookie_notice_ga4_id fields to the release containing this commit, without first running 1.5.4's admin code. The current CookieNotice::get_tracking_integrations() reads the generic list and the older type/id pair but not those two dedicated keys, so the bundled module—which is explicitly meant to keep working during the transition—silently stops loading the site's GTM and GA4 tags after consent. Retain the migration until all supported upgrade paths and the FrontConsent import handle these legacy keys.

AGENTS.md reference: AGENTS.md:L9-L9

Useful? React with 👍 / 👎.

<p><?php esc_html_e( 'Cookie consent now has its own dedicated plugin: FrontConsent.', 'frontblocks' ); ?></p>
</div>
</div>
<div class="tw:max-w-xl tw:p-6 tw:bg-blue-50 tw:border tw:border-blue-200 tw:rounded-lg">

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Rebuild the admin stylesheet for the promo utilities

The new panel uses Tailwind utilities that are absent from the shipped assets/admin/settings.css, including tw:max-w-xl, tw:border-blue-200, tw:text-blue-900, tw:text-blue-800, and tw:text-green-800; this commit contains no rebuilt CSS. As a result, the installed plugin ignores those width, border, and text-color declarations, so the promo does not render with the authored design. Run the admin CSS build and commit the regenerated stylesheet with these PHP source changes.

AGENTS.md reference: AGENTS.md:L62-L64

Useful? React with 👍 / 👎.

That feature moved with the rest of cookie consent — its readme
description now lives in FrontConsent's own readme.txt instead of
being duplicated here.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
The tests exercised FrontBlocks\Frontend\CookieNotice directly and had
no dependency on anything removed from Settings.php in the previous
commit — they now live in FrontConsent, ported to its own namespace,
option names and hook prefixes, since that's where ongoing development
of this code happens.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b2a38883a9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

}

$install_url = wp_nonce_url(
self_admin_url( 'update.php?action=install-plugin&plugin=front-consent' ),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Offer activation when FrontConsent is already installed

When FrontConsent is installed but inactive, this CTA still invokes install-plugin; WordPress cannot reinstall over the existing plugin directory, so the user reaches an installation error instead of activating FrontConsent, its migration never runs, and the legacy banner remains active. Detect the installed-but-inactive state and generate a nonce-protected activation URL instead; the settings-tab CTA at Settings.php:1901 needs the same handling.

AGENTS.md reference: AGENTS.md:L9-L9

Useful? React with 👍 / 👎.

Comment on lines +206 to +207
if ( defined( 'FRCN_VERSION' ) ) {
return false;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Add coverage for disabling the legacy module

This new FRCN_VERSION behavior has no programmatic coverage because the commit deletes every Cookie Notice PHPUnit/JavaScript test and removes its npm test command, even though the legacy module explicitly continues shipping during the transition. Add a focused test proving that a stored enabled setting is suppressed when FrontConsent is active, and retain coverage for the still-running module so this transition invariant cannot regress unnoticed.

AGENTS.md reference: AGENTS.md:L156-L159

Useful? React with 👍 / 👎.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant