Repository navigation
Add a status panel and a Send emails switch - #220
Merged
Merged
Conversation
#152 asked for a clear view of what Safety Net has on and off, and for a way to turn emails on while testing. - Tools > Safety Net starts with a Status table: environment, emails, email log, users and orders, scrubbed options, deactivated plugins (and any active again), payment gateways, renewal actions, webhooks active again, WooCommerce REST API keys and administrators' application passwords, search engines and transients. Each row has an icon with screen reader text, what it means and where to change it. - Email Log > Settings gets a Send emails switch, off by default, with a red warning and a confirmation when switching it on. While it is on, stop_emails() lets every email through (logged as "Let through: emails switched on" with its real result), core's password and email change notices are sent, and every wp-admin page shows a red notice with a link to the switch and the WP-CLI command to turn it off. - The switch is bound to the site's address (a hash of home and WP_HOME), so copies and pushed databases start with emails off. It is held off while SAFETY_NET_DELETE_DATA keeps customer data. - The REST status route reports emails_enabled. Refs #152. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
🔱 Poseidon started reviewing this PR — central run. |
There was a problem hiding this comment.
🔱 Poseidon Review
No issues found on this pass.
ℹ️ Review info
- Commit: 4d4f040
- Files reviewed: includes/status.php, includes/admin.php, includes/common.php, includes/email-log.php, includes/utilities.php, includes/rest-status.php, safety-net.php, assets/js/safety-net-admin.js
- Files skipped: AGENTS.md, README.md (docs); assets/css/admin.css (styling only); tests/smoke/fixtures/mu-plugins/00-sn-test-helper.php, tests/smoke/fixtures/php/helpers.php, tests/smoke/lib/status.mjs, tests/smoke/scenarios.mjs, tests/smoke/scenarios/email-log.test.mjs, tests/smoke/scenarios/multisite-network-woocommerce.test.mjs, tests/smoke/scenarios/production.test.mjs, tests/smoke/scenarios/staging-plugin.test.mjs, tests/smoke/scenarios/status-and-switch.test.mjs, tests/smoke/scenarios/woocommerce-hpos.test.mjs, tests/smoke/scenarios/woocommerce-keep-data.test.mjs, tests/smoke/scenarios/woocommerce-preprocessed.test.mjs (test-only, not shipped)
- Model: claude-opus-5-5
Resolves the overlap with #219: log_email() keeps both the secrets column and the allowed_switch status, the docs combine both changes, and ST6 expects the email log's table version 2. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
🔱 Poseidon Review
No issues found on this pass. The only change since the last review is the trunk merge (#219). It resolves the overlap correctly: log_email() treats allowed_switch like allowed (no dry run, row pushed for the real result) and still applies the secrets handling and the staff-recipient check to emails the switch lets through.
♻️ Previously flagged
No previously flagged items.
ℹ️ Review info
- Commit: 6a07ecd
- Files reviewed: includes/admin.php, includes/email-log.php, includes/status.php, includes/common.php, includes/utilities.php, includes/rest-status.php, safety-net.php, assets/js/safety-net-admin.js
- Files skipped: AGENTS.md, README.md (docs); assets/css/admin.css (styling only); tests/smoke/** (test-only, not shipped)
- Model: claude-opus-5-5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A partner asked in #152 for a clear view of what Safety Net has on and off, and for a way to turn emails on while testing. This adds both. The WooCommerce API switch for 3PLs is not part of this PR.
Status panel: a Status table at the top of Tools > Safety Net (
includes/status.php). It has one row per protection, each with an icon plus screen reader text, a one-line explanation and a link to where it changes:Queries are guarded, so the panel renders cleanly without WooCommerce or the email log table, on multisite subsites, and before the first run.
are_renewals_paused()is shared with the existing notice.Send emails switch: on Email Log > Settings, under its own "Sending emails" heading.
stop_emails()lets every email through, unless anotherpre_wp_mailfilter already decided. Those emails are logged as "Let through: emails switched on" with their real Sent/Failed result. Core's password-change and email-change notices are sent too.wp option update safety_net_send_emails_toggle off(with--urlon multisite).emails_enabled.Safe on copies: the switch is bound to the site's address, stored as a hash of the stored
homeandWP_HOME, so search-replace can't rewrite it. Copies and databases pushed to another address start with emails off, and the switch shows "Switched on for another address". It is also held off, disabled in the form, whileSAFETY_NET_DELETE_DATAkeeps customer data, like the renewal pause.Version 1.12.0, in its own commit.
Refs #152.
Notes
wp option update safety_net_send_emails_toggle onchanges nothing, because WP-CLI sees the stored value is already "on" and skips the save. Emails stay off. The README says to switch it on in Settings, or run… offfirst.Test plan
status-and-switchscenario (single-site), ST1–ST11 and SW1–SW11:emails_enabled;woocommerce-keep-dataKD23: with the switch stored on, emails stay under the keep rules; the field is disabled and saving keeps the stored value; no notice; the panel says it is held off.woocommerce-hposST12,multisite-network-woocommerceM15/M17 andproduction: the panel and the switch where WooCommerce runs and on multisite; production has neither.npm run test:archivepasses.