Repository navigation
Premium Analytics: gate the Subscribers section on the subscriptions module - #51242
Merged
Merged
Conversation
…module Replicates the Calypso Stats tab check for Jetpack sites: the section is registered as always, but only offered when the module is active.
Contributor
|
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
Contributor
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
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:
If you have questions about anything, reach out in #jetpack-developers for guidance! |
Code Coverage SummaryCoverage changed in 2 files.
|
… default-layout route
Modules::is_active() intersects `jetpack_active_modules` with the modules
available to the site, and without the Jetpack plugin that list is only what
standalone plugins register -- nothing registers `subscriptions`. The gate
could therefore never open on the standalone plugin, hiding a tab whose data
comes from the WPCOM proxy and works with the module off. Sites with no module
system to consult are now exempt rather than refused.
Also:
- Resolve availability through a filter, matching the sibling WooCommerce gate.
- Gate /dashboards/{name}/default-layout on a tab map rather than a hardcoded
Store check, so it stops serving a layout the sections route no longer lists.
- Record why the subscriber widget types are deliberately left registered.
chihsuan
marked this pull request as ready for review
August 13, 2026 09:02
layoutd
approved these changes
Aug 14, 2026
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.


Proposed changes
Related product discussion/links
Does this pull request change what data or activity we track or use?
No.
Testing instructions
Premium Analytics has to be switched on for the dashboard to exist:
wp option update jetpack_premium_analytics_enabled 1. Then, on a Jetpack-connected site running this branch:wp jetpack module deactivate subscriptions).GET /wp-json/wpcom/v2/dashboards/jetpack-premium-analytics_dashboard/sectionsno longer listssubscribers.GET /wp-json/wpcom/v2/dashboards/subscribers/default-layoutnow 404s. On trunk it still returns the full subscriber layout — that is the second gate in this PR.?section=subscribersdirectly rewrites the URL tosection=trafficand lands on Traffic rather than an empty tab.add_filter( 'jetpack_premium_analytics_subscribers_dashboard_section_available', '__return_false' )hides the tab with the module still on.Verified on a Jurassic Ninja site running this branch, toggling the module both ways.