Skip to content

Modules: auto activate offline-compatible modules even if not connect-ready#48554

Open
simison wants to merge 2 commits intotrunkfrom
update/modules-auto-activate-localhost
Open

Modules: auto activate offline-compatible modules even if not connect-ready#48554
simison wants to merge 2 commits intotrunkfrom
update/modules-auto-activate-localhost

Conversation

@simison
Copy link
Copy Markdown
Member

@simison simison commented May 6, 2026

Help developers working with localhost (i.e. Jetpack's "offline mode") to test Jetpack before they are even ready to connect.

Problem

  • Jetpack Forms is the contact-form module: projects/plugins/jetpack/modules/contact-form.php.
  • It is marked Auto Activate: Yes and Requires Connection: No, so it should be eligible for default activation even when a site never connects or is running at localhost for a developer.
  • Previously, default module activation only ran when Jetpack::is_connection_ready() was true, because Jetpack::plugin_initialize() gated handle_default_module_activation() behind that check.
  • Result: on sites that install Jetpack but remain unconnected, “default” modules (including Forms) were not activated, even if they don’t require a connection.

The fix

  • Run handle_default_module_activation() unconditionally from Jetpack::plugin_initialize().
  • When Jetpack is not connection-ready, restrict the activation pass to:
    • modules with Requires Connection: No, and
    • modules with Requires User Connection: No,
    • while still respecting Auto Activate: Yes via the existing default-module logic.

In code terms, the unconnected branch now calls:

  • activate_default_modules( ..., $requires_connection = false, $requires_user_connection = false )

So unconnected installs will auto-activate only “offline-safe” default modules, including contact-form (Forms).

Related product discussion/links

  • Ref p1778046076516749-slack-C052XEUUBL4

Does this pull request change what data or activity we track or use?

Testing instructions

@simison simison requested a review from a team May 6, 2026 07:07
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 6, 2026

Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.

  • To test on WoA, go to the Plugins menu on a WoA dev site. Click on the "Upload" button and follow the upgrade flow to be able to upload, install, and activate the Jetpack Beta plugin. Once the plugin is active, go to Jetpack > Jetpack Beta, select your plugin (Jetpack), and enable the update/modules-auto-activate-localhost branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack update/modules-auto-activate-localhost

Interested in more tips and information?

  • In your local development environment, use the jetpack rsync command to sync your changes to a WoA dev blog.
  • Read more about our development workflow here: PCYsg-eg0-p2
  • Figure out when your changes will be shipped to customers here: PCYsg-eg5-p2

@github-actions github-actions Bot added the [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ label May 6, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 6, 2026

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • 🔴 Add a "[Status]" label (In Progress, Needs Review, ...).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖


Follow this PR Review Process:

  1. Ensure all required checks appearing at the bottom of this PR are passing.
  2. Make sure to test your changes on all platforms that it applies to. You're responsible for the quality of the code you ship.
  3. You can use GitHub's Reviewers functionality to request a review.
  4. When it's reviewed and merged, you will be pinged in Slack to deploy the changes to WordPress.com simple once the build is done.

If you have questions about anything, reach out in #jetpack-developers for guidance!

@github-actions github-actions Bot added the [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. label May 6, 2026
@jp-launch-control
Copy link
Copy Markdown

Code Coverage Summary

Coverage changed in 1 file.

File Coverage Δ% Δ Uncovered
projects/plugins/jetpack/class.jetpack.php 749/2278 (32.88%) 0.02% 1 ❤️‍🩹

Full summary · PHP report · JS report

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant