Skip to content

Add allow_special mode to fully disable specialty keytags (#25)#29

Merged
pjaudiomv merged 1 commit into
mainfrom
feature/nacc-25-disable-specialty-keytags
Jul 17, 2026
Merged

Add allow_special mode to fully disable specialty keytags (#25)#29
pjaudiomv merged 1 commit into
mainfrom
feature/nacc-25-disable-specialty-keytags

Conversation

@dgershman

@dgershman dgershman commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Closes #25

What

Adds a mode where specialty/long-term keytags are fully disabled — the in-widget toggle checkbox/label are not rendered and the visitor's saved preference is ignored — rather than the admin setting only controlling the initial state.

Changes

JS (nacc2/src/nacc.js)

  • New 7th constructor param allowSpecialTags (default true, back-compat). When false:
    • showSpecialTags is forced off,
    • localStorage['nacc_keytag_special'] and the NACC-special-tags GET param are ignored (a prior visitor toggle or URL param can't re-enable),
    • specialTagsCheckbox / specialTagsLabel are not created (the layout toggle still renders).
  • Bundle nacc2/nacc.js rebuilt via vite.

PHP (nacc-wordpress-plugin.php)

  • New nacc_allow_special boolean setting (default true) + a "Allow Visitors To Toggle Specialty Keytags" checkbox on Settings → NACC.
  • New allow_special shortcode attribute (e.g. [nacc allow_special="0"]), wired through both the standard (trigger_after_shortcode_loaded) and legacy (nacc_content) paths and passed as the 7th JS constructor arg in render_keytags().
  • Defaults preserve today's behavior.

readme.txt — documented the allow_special attribute, added a 6.0.2 changelog entry, bumped Stable tag + plugin Version to 6.0.2.

Design / composition with siblings (#24, #26)

Chose the "second checkbox" / dedicated allowSpecialTags param approach (which the ticket lists as acceptable) rather than folding a 3-way select into nacc_special. This deliberately leaves nacc_special and its default-state handling untouched so it composes cleanly with #24 (the default-state fix) instead of reimplementing that logic — the new "allow" flag layers strictly on top.

Verification

  • npm run build (vite) — bundle regenerated; npm run format:check + npm run lint clean.
  • php -l clean; phpcs (.phpcs.xml) exit 0.
  • Confirmed in the built bundle: allowSpecialTags = c !== false, checkbox creation gated behind this.allowSpecialTags, and the false branch forces showSpecialTags off.

🤖 Generated with Claude Code

https://claude.ai/code/session_01KgsQa1xaRefJi29WCZzbQq

@dgershman
dgershman requested a review from pjaudiomv July 17, 2026 00:25
@dgershman
dgershman force-pushed the feature/nacc-25-disable-specialty-keytags branch from 012397e to a4f348d Compare July 17, 2026 00:50
Adds a way for admins to hide the in-widget specialty-keytags toggle
entirely, rather than only controlling its initial state.

JS (nacc2/src/nacc.js): new 7th constructor param `allowSpecialTags`
(default true for back-compat). When false, `showSpecialTags` is forced
off, `localStorage['nacc_keytag_special']` and the `NACC-special-tags`
GET param are ignored, and the specialTagsCheckbox/specialTagsLabel are
not created. Bundle rebuilt via vite.

PHP: new `nacc_allow_special` boolean setting (default true) with a
"Allow visitors to toggle specialty keytags" checkbox on Settings → NACC,
a matching `allow_special` shortcode attribute wired through both the
standard and legacy shortcode paths, and a 7th arg passed to the JS
constructor in render_keytags(). Defaults preserve today's behavior.

readme.txt: documented the `allow_special` attribute, added a 6.1.0
changelog entry, and bumped Stable tag / plugin Version to 6.1.0.

🐦‍⬛ Generated with Claude Code, orchestrated by Crow

Co-Authored-By: Claude <noreply@anthropic.com>
Crow-Session: 07A468E3-CCEB-4179-A9CC-9F057528235C
Claude-Session: https://claude.ai/code/session_01KgsQa1xaRefJi29WCZzbQq
@dgershman
dgershman force-pushed the feature/nacc-25-disable-specialty-keytags branch from a4f348d to 69c8ad9 Compare July 17, 2026 00:53
@pjaudiomv
pjaudiomv merged commit 0cc1eb2 into main Jul 17, 2026
1 check passed
@pjaudiomv
pjaudiomv deleted the feature/nacc-25-disable-specialty-keytags branch July 17, 2026 00:54
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.

Allow admins to disable specialty keytags entirely (hide the toggle)

2 participants