Skip to content

My Jetpack: show the forced note on plugins a host enables or disables - #52584

Merged
kraftbj merged 2 commits into
add/my-jetpack-product-visibility-filter-JETPACK-2382from
add/my-jetpack-forced-plugin-note
Sep 23, 2026
Merged

kraftbj merged 2 commits into
add/my-jetpack-product-visibility-filter-JETPACK-2382from
add/my-jetpack-forced-plugin-note

Conversation

@kraftbj

@kraftbj kraftbj commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Stacked on PR 52505.

Proposed changes

PR 52505 swaps the switch for a note when a host forces a module on or off. Features switched by a standalone plugin (Akismet, Backup, Boost, CRM, Protect) had no equivalent, so a host pinning one of those still left the owner a switch that flips straight back. This does the same for plugins, on the Features tab.

  • Main_Features::get_plugin_override() reads a forced plugin the way Jetpack_Modules_Overrides reads a forced module: it runs option_active_plugins over an empty list (anything it adds is forced on) and over a list holding just this plugin (dropping it means forced off). A network-activated plugin also counts as forced on, since the site's own switch can't turn it off either.
  • The grid carries it as plugin_override on each feature, and a forced plugin gets the same treatment PR 52505 gives a forced module: the card and list row show only its status, with no switch and no bulk checkbox. The modal explains it: forced on shows "Enabled by your host or site administrator" beside Open, and forced off says "Disabled by…" under "How to get it" and drops "Available in". getForcedReason() now answers for both kinds, so every one of those spots follows from it.
  • Bulk switching skips forced plugins. isBulkSwitchable() only left out forced modules, so a forced plugin could be picked by select-all and flipped straight back.

Up for discussion:

  • pre_option_active_plugins isn't read. A host short-circuiting the whole list wouldn't be detected. Jetpack_Modules_Overrides has the same blind spot for modules, and the one use of that hook I found (jetpack-mu-wpcom's plugin conflict probe) is request-scoped, not a host pin.
  • Network activation is included as a judgment call. It's the most common real "forced plugin," but the note says "your host or site administrator," which reads fine for a network admin. Easy to drop if we'd rather keep this to filters.
  • A forced-off plugin that isn't installed still offers Install. The install would land and then not activate. Detecting that needs the plugin file, which doesn't exist yet.
  • Features tab only. The Products tab's cards for these products don't get the note; that tab is on its way out.

Related product discussion/links

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

No.

Testing instructions

Turn on the my-jetpack-features-tab flag, install Jetpack Boost, and add this as an mu-plugin:

<?php
add_filter( 'option_active_plugins', function ( $plugins ) {
	return array_values( array_diff( $plugins, array( 'jetpack-boost/jetpack-boost.php' ) ) );
} );
  • Go to Jetpack → My Jetpack → Features. Boost's card shows Inactive with no switch. In the list view, its row has no checkbox and select-all skips it. Open it: "How to get it" says "Disabled by your host or site administrator," with no Activate button and no "Available in."
  • Swap the filter to add Boost instead ($plugins[] = 'jetpack-boost/jetpack-boost.php';). The card shows Active with no switch, and the modal shows "Enabled by your host or site administrator" beside Open.
  • Remove the mu-plugin. Boost's switch is back, and works.
  • On a multisite, network-activate Boost and load My Jetpack on a subsite: it reads as forced on, with no switch.

Automated coverage: Main_Features_Plugin_Override_Test for the detection, plus the Features grid's Jest tests for the card, list, bulk switch and modal.

🤖 Generated with Claude Code

@kraftbj kraftbj added Enhancement Changes to an existing feature — removing, adding, or changing parts of it [Status] In Progress [Package] My Jetpack labels Sep 21, 2026
@kraftbj kraftbj self-assigned this Sep 21, 2026
@kraftbj
kraftbj added this pull request to stack #52585 September 21, 2026 21:53
@github-actions

Copy link
Copy Markdown
Contributor

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 commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

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 add/my-jetpack-forced-plugin-note branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack add/my-jetpack-forced-plugin-note

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

@jp-launch-control

jp-launch-control Bot commented Sep 21, 2026 •

Copy link
Copy Markdown

Code Coverage Summary

No summary data is available for parent commit e4151d7, so cannot calculate coverage changes. 😴

If that commit is a feature branch rather than a trunk commit, this is expected. Otherwise, this should be updated once coverage for e4151d7 is available.

Full summary · PHP report · JS report

@kraftbj
kraftbj marked this pull request as ready for review September 22, 2026 15:19
kraftbj and others added 2 commits September 22, 2026 12:42
Read a plugin forced through option_active_plugins, or network-activated,
the way Jetpack_Modules_Overrides reads modules, and give its Features grid
card and modal the same treatment as a forced module.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…utes

The list view's bulk checkbox, select-all and the bulk switch skipped only forced
modules, so a forced plugin could still be picked and flipped straight back. The
modal's "Available in" also kept showing for a plugin a host forced off.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@kraftbj
kraftbj force-pushed the add/my-jetpack-forced-plugin-note branch from 2af2e00 to e9c56f3 Compare September 22, 2026 17:44
@kraftbj
kraftbj merged commit ed847dd into trunk Sep 23, 2026
114 of 115 checks passed
@kraftbj
kraftbj deleted the add/my-jetpack-forced-plugin-note branch September 23, 2026 15:18
@github-actions github-actions Bot added [Status] UI Changes Add this to PRs that change the UI so documentation can be updated. and removed [Status] In Progress labels Sep 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Enhancement Changes to an existing feature — removing, adding, or changing parts of it [Package] My Jetpack [Status] UI Changes Add this to PRs that change the UI so documentation can be updated. [Tests] Includes Tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant