Conversation
Signed-off-by: Dale Mugford <dmugford@paidmembershipspro.com>
For better clarity, use “pause engine” vs. pause mode. (PMPro_Pause_Engine(), etc.). Signed-off-by: Dale Mugford <dmugford@paidmembershipspro.com>
Signed-off-by: Dale Mugford <dmugford@paidmembershipspro.com>
There was a problem hiding this comment.
Pull request overview
Adds a new core “Pause Engine” to Paid Memberships Pro to progressively lock down parts of the site (mutations, gateways, mail, background schedules, frontend, sessions) during migrations/maintenance, plus admin UI feedback and a testing harness.
Changes:
- Introduces
PMPro_Pause_Enginesingleton orchestrator with toggleable pause modules and presets. - Loads the pause engine early on
plugins_loadedand adds an admin notice + “Resume All Services” action when active. - Adds a test harness script under
tests/for exercising engine behavior.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 8 comments.
| File | Description |
|---|---|
classes/class-pmpro-pause-engine.php |
New pause engine orchestrator + six built-in modules + convenience functions. |
includes/admin.php |
Adds admin notice and admin action handler to resume the pause engine. |
paid-memberships-pro.php |
Loads/initializes the pause engine during plugin bootstrap. |
tests/test-pause-engine.php |
Adds a pause-engine test script/harness. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // Get the module label from the registered modules. | ||
| $all_presets = PMPro_Pause_Engine::get_presets(); |
There was a problem hiding this comment.
In the module label list, the comment says it’s pulling labels from registered modules, but it only outputs the slug (esc_html( $slug )), and $all_presets = PMPro_Pause_Engine::get_presets(); is unused. Either fetch/display each module’s get_label() (requires an accessor on the engine) or remove the misleading comment and unused variable.
| // Get the module label from the registered modules. | |
| $all_presets = PMPro_Pause_Engine::get_presets(); |
Fixes for Copilot suggestions, tested. Signed-off-by: Dale Mugford <dmugford@paidmembershipspro.com>
This pull request was closed after we determined internally that pause functionality can be better served inside PMPro Hosting's MU plugin for migration purposes.
All Submissions:
Changes proposed in this Pull Request:
Adds a modular Pause Engine (
PMPro_Pause_Engine) for progressive site lockdown during site migrations, or maintenance. This replaces thePMPro_Migration_Site_Suspenderclass in the PMPro Hosting plugin with a reusable, composable system any tooling can leverage.The existing
pmpro_is_paused()remains untouched, and only detects URL mismatches and halts Action Scheduler. It doesn't freeze membership changes, block gateway calls, suppress emails, or lock down the frontend. The hosting plugin's suspender handles some of this but wasn't reusable and blocked email permanently with no queue mechanism.Architecture: A singleton orchestrator with 6 toggleable modules, activated in a defined order:
pmpro_mutationspmpro_gatewayspmpro_mailwp_mail(), queues to Action Scheduler for replay on resumebackground_schedulesfrontend_blocklogged_in_sessionsTwo built-in presets: Migration (all 6 modules) and Maintenance (mutations + mail + schedules). Modules can be enabled/disabled individually at runtime for progressive lockdown. Admin bypass via
pmpro_manage_pause_modecapability. Presets and modules are extensible via filters.Files added:
classes/class-pmpro-pause-engine.php— Interface, orchestrator, all 6 modules, convenience functionstests/test-pause-engine.php— Browser-based test harness (see testing instructions)Files modified:
paid-memberships-pro.php— Loads the pause engine onplugins_loadedpriority 5includes/admin.php— Admin notice when engine is active with module list and "Resume All Services" buttonPublic API:
How to test the changes in this Pull Request:
A browser-based test harness is included at
tests/test-pause-engine.php. To set it up:mu-pluginsdirectory:cp wp-content/plugins/paid-memberships-pro/tests/test-pause-engine.php wp-content/mu-plugins//wp-admin/?pmpro_pause=statusto open the test dashboard.Available URLs (append to
/wp-admin/):?pmpro_pause=status?pmpro_pause=migration?pmpro_pause=maintenance?pmpro_pause=custom&modules=pmpro_mutations,pmpro_gateways?pmpro_pause=resume?pmpro_pause=test_mailWhat to verify:
curl -vk -X POST "https://yoursite.local/wp-admin/admin-ajax.php?action=stripe_webhook"— should return 503.rm wp-content/mu-plugins/test-pause-engine.phpOther information:
Changelog entry