Skip to content

feat: switch presence recording on and off from Settings and WP-CLI - #442

Merged
josephfusco merged 1 commit into
mainfrom
feat/441-recording-settings
Sep 1, 2026
Merged

josephfusco merged 1 commit into
mainfrom
feat/441-recording-settings

Conversation

@josephfusco

Copy link
Copy Markdown
Collaborator

The recording filters shipped in #429 with no way to reach them without writing PHP.

Fixes #441

Where Control
Settings > General Presence checkbox
Network Admin > Settings Presence checkbox, network-wide
WP-CLI wp presence recording get|set on|off [--network]

The stored options are passed as the two filters' defaults, so a filter still has the last word over whatever an administrator has chosen, and strictest-wins precedence between the site and network switches is unchanged.

wp_presence_network_aggregation_enabled stays code-only. It answers write concentration rather than policy, so it has no checkbox.

Notes:

  • Options store '1' or '0' rather than booleans. A boolean false is indistinguishable from an absent option, so update_option() discards it as unchanged and recording stays on.
  • Test cleanup moved above the TRUNCATE in the base test case. TRUNCATE commits and autocommit is off, so a statement after it lands in a fresh transaction and is rolled back.

Testing:

  • npm test — 426 tests, 713 assertions, 106 skipped
  • npm run test:multisite — 426 tests, 920 assertions, 3 expected skips
  • npm run test:scripts — 79 passed
  • composer validate --no-check-publish --no-interaction — passed
  • ./vendor/bin/phpcs --standard=phpcs.xml.dist --report=summary — passed
  • ./vendor/bin/phpstan analyse --configuration=phpstan.neon.dist --memory-limit=2G --no-progress — passed
Use of AI Tools

AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 5
Used for: Assisting with the implementation, tests, and documentation. The final change and results were reviewed by me before submission.

@github-actions

Copy link
Copy Markdown
Contributor

🛝 WordPress Playgrounds

Built from 2701390

5 users 40 users
Single site Launch single site, 5 users Launch single site, 40 users
Multisite Launch multisite, 5 users Launch multisite, 40 users

@josephfusco josephfusco changed the title Add Admin UI and WP-CLI surfaces for the presence recording switch feat: switch presence recording on and off from Settings and WP-CLI Aug 31, 2026
@codecov

codecov Bot commented Aug 31, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.45455% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 96.34%. Comparing base (909c9b5) to head (2701390).

Additional details and impacted files
@@             Coverage Diff              @@
##               main     #442      +/-   ##
============================================
- Coverage     96.36%   96.34%   -0.03%     
- Complexity      240      251      +11     
============================================
  Files            19       20       +1     
  Lines          2835     2899      +64     
============================================
+ Hits           2732     2793      +61     
- Misses          103      106       +3     
Flag Coverage Δ
multisite 96.34% <95.45%> (-0.03%) ⬇️
phpunit 71.47% <90.90%> (+0.46%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@josephfusco
josephfusco marked this pull request as ready for review September 1, 2026 06:01
@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Core Committers: Use this line as a base for the props when committing in SVN:

Props joefusco.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds administrator-accessible controls for presence recording while preserving filter overrides and multisite precedence.

Changes:

  • Adds site and network recording settings.
  • Adds WP-CLI recording get|set commands.
  • Updates cleanup, tests, and documentation.

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated no comments.

Show a summary per file
File Description
uninstall.php Removes recording options during uninstall.
includes/settings.php Implements site and network settings controls.
includes/functions.php Uses stored options as recording filter defaults.
includes/cli/class-wp-presence-cli-command.php Adds recording CLI operations.
presence-api.php Loads and registers settings functionality.
tests/test-settings.php Tests settings rendering and persistence.
tests/test-functions.php Tests option and filter precedence.
tests/test-cli-command.php Tests site-level CLI behavior.
tests/test-cli-network-command.php Tests network-level CLI behavior.
tests/class-wp-presence-unittestcase.php Cleans recording options between tests.
README.md Documents settings, filters, and CLI usage.
readme.txt Updates user-facing recording guidance.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@josephfusco
josephfusco merged commit 6d7f433 into main Sep 1, 2026
22 of 23 checks passed
@josephfusco
josephfusco deleted the feat/441-recording-settings branch September 1, 2026 12:39
@josephfusco josephfusco added the [Area] Admin UI Issues for the admin UI integrations label Sep 4, 2026
@josephfusco josephfusco added this to the 0.3.0 milestone Sep 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Area] Admin UI Issues for the admin UI integrations

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Presence recording can only be switched off in code

2 participants