-
Notifications
You must be signed in to change notification settings - Fork 74
Auto-activate plugin on networks created via WP-CLI #234
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Co-authored-by: JJJ <[email protected]>
Co-authored-by: JJJ <[email protected]>
|
@copilot Same PHPUnit failure as in previous PRs: Make sure that the user exists and was granted super admin privileges. Thanks! |
Co-authored-by: JJJ <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR implements auto-activation of the WP Multi Network plugin when creating networks via WP-CLI, achieving feature parity with the UI behavior. The implementation moves the auto-activation logic from the UI handler into the core add_network() function, which is called by both the UI and WP-CLI.
Key Changes
- Auto-activation logic added to
add_network()function to ensure plugin activates on new networks regardless of creation method - Comprehensive test added to verify plugin auto-activates when networks are created programmatically
- Test properly handles user creation and super admin privileges required by network operations
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| wp-multi-network/includes/functions.php | Added auto-activation code that sets active_sitewide_plugins after network creation, ensuring plugin is active on newly created networks |
| tests/integration/tests/test-networkoperations.php | Added test that creates a network with proper user privileges and verifies the plugin is auto-activated in the network options |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <[email protected]>
Plan to auto-activate plugin on new networks via WP-CLI
add_network()function in functions.phpSummary
Successfully implemented auto-activation of the WP Multi Network plugin when creating networks via WP-CLI, achieving parity with the UI behavior.
Changes Made
Modified
add_network()function inwp-multi-network/includes/functions.php:Added comprehensive test in
tests/integration/tests/test-networkoperations.php:user_idandnetwork_admin_idtoadd_network()functionTest Fix
The test was failing because
add_network()requires a valid user with super admin privileges. The fix:grant_super_admin()user_idandnetwork_admin_idto theadd_network()callThis matches the pattern used in other tests like
test-rest-networks-controller.php.Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.