Automattic / jetpack

Security, performance, marketing, and design tools — Jetpack is made by WordPress experts to make WP sites safer and faster, and help you grow your traffic.
https://jetpack.com/
Other
1.58k stars 799 forks source link

Settings UI: no way to enable some modules that were previously disabled #6788

Closed enejb closed 6 years ago

enejb commented 7 years ago

Steps to reproduce the issue

I wasn't able to find the json api feature so that I could enable it. Searching for it didn't help.

What I expected

To be able to find the json api module so that I can enable it.

dereksmart commented 7 years ago

This was a design decision. You can only access it via CLI, Filter, or the fallback module page at /wp-admin/admin.php?page=jetpack_modules

cc @MichaelArestad maybe wants to explain the decision further

MichaelArestad commented 7 years ago

Okay. So we are removing the option to disable several modules that really aren't super necessary to turn off. This is an attempt to simplify the interface down into just the most useful essentials. In other words, it should just work without having to dig through a bunch of scary-sounding stuff.

This creates the problem you highlighted of turning them back on for previous users. As @dereksmart has pointed out in the past, just enabling them could be dangerous for certain users depending on them being off. So, we're left with a couple of options for things like this:

  1. We could show a notice/banner/whatever somewhere that allows activation (but not deactivation) of items like this. Basically, it would be something like "You have the JSON API off. In order to get _____, you'll need to activate it. Activate"
  2. We could point users looking for it to the old module manager.
  3. We could turn them all on and hold our breath for several months.
enejb commented 7 years ago

Maybe It would be great to provide an escape hatch to wp-admin/admin.php?page=jetpack_modules that is hidden somewhere just in case.

zinigor commented 7 years ago

@enejb yes, we had the same idea, thus it's already there in wp-admin/admin.php?page=jetpack-debugger

keoshi commented 7 years ago

We could solve that problem exactly with the search, showing those modules to the users only when they search for them. I imagine most users trust us with having a good secure and functional baseline, but for those looking for granular stuff we can display the why contextually.

Some of the features could simply say “this module is turned on by default”, while others could allow you to switch them on/off (don't know if we even want this, though). Adding some micro copy about how we turn on the base features by default might be useful as well, for when the user is looking for one specific feature. Just a tiny bit of context, but be transparent about it.

This could work for features that are somewhat technical or has a strong default, but it’s non-essential to the average user or regular working site.

MichaelArestad commented 7 years ago

We could solve that problem exactly with the search

@keoshi I think that might be too buried. For example, I have seen several people disable the JSON API without really knowing what it is. Would they even remember what to search for?

Some of the features could simply say “this module is turned on by default”,

But then we would need UI for those cards and could just add toggles which takes us back to square one in simplifying the UI.

enejb commented 7 years ago

We could solve that problem exactly with the search I tried doing exactly that but it didn't work.

Would they even remember what to search for? We could ask them in the documentation. To search for the module and activate it.

For some reason I am not able to visit the help tab when I have Hello Dolly enabled s screen shot 2017-03-28 at 09 42 03 ee

keoshi commented 7 years ago

I have seen several people disable the JSON API without really knowing what it is. Would they even remember what to search for?

From what I got we're i) turning on certain modules by default and ii) hiding those from the settings UI. Wouldn't this prevent people from disabling the JSON API module, for instance? And if the case is that someone does disable it, they have to specifically look for it, which means we can assume they have confidence in what they're doing and they know how to get there again to enable it back.

But then we would need UI for those cards and could just add toggles which takes us back to square one in simplifying the UI.

I meant that as a standard message for all enabled-by-default-and-locked modules, which wouldn't have a toggle at all.

MichaelArestad commented 7 years ago

Wouldn't this prevent people from disabling the JSON API module, for instance?

Yes. It's pretty (extremely) few and far that need to disable the ones on by default. They can do it with filters or with the old module manager (for now).

And if the case is that someone does disable it, they have to specifically look for it, which means we can assume they have confidence in what they're doing and they know how to get there again to enable it back.

I wish that was the case. Often people disable stuff thinking their site will get faster and JP has alot of stuff.

ashleighaxios commented 7 years ago

It seems like Michael's (1) is a solid option. To consider other options, it might be helpful to know where any of those proposals potentially fail to meet user needs.

The other option is added those items back in under a sort of "advanced" area that can be linked to directly in such cases. Being led a bit in this comment though by a @jeherve post last week. :)

MichaelArestad commented 7 years ago

I'd like us to take a stab at implementing One Way Activation™ for 4.9. This means we would allow those who previously disabled modules that no longer are disable-able or have UI to enable them, but not disable them.

I propose a Banner component with a Gridicon, no plan level, a single line of copy that explains a bit about the module, and an Enable button. Once clicked, it goes away. It will work fairly well in places like the XML sitemaps.

sitemaps

For those modules that have no UI at all now, I think we should show the banners in a Search, but nowhere else. For example, if someone searched for the JSON API and it was disabled, we could show a One Way Activation™ Banner right at the top of the search results.

search-result

jeherve commented 7 years ago

More feedback from users in the following issues and threads:

zoonini commented 7 years ago

Moving this here as it's relevant:


A user in my local WordPress meetup group was looking for a recipe plugin, so I suggested she try Jetpack's recipe shortcode, since it's built right in and very handy and easy to use.

The user came back to say that she couldn't figure out how to activate the shortcodes module within Jetpack, as it wasn't listed anywhere in the settings. I took a look myself, and after about 10 minutes of searching around the new settings interface, I absolutely could not find it, either. I also then noticed that many other popular modules are also missing, like the contact form. I searched the Jetpack documentation in vain as well - the Shortcodes Embed page makes no special mention of any special steps to activate it.

I then headed to the Jetpack page at WordPress.org, planning to search the forums and see if I could figure out where the heck all those modules had gone. Lo and behold, a 2-star review right on the first Jetpack page on wp.org gave me the answer:

jetpack by wordpress com wordpress plugins-1

This is how I discovered that many modules are now accessible only by clicking a tiny "Debug" link all the way at the very bottom of the settings page:

jetpack wp engine test site wordpress-1

...and then buried within the next page full of text, in very small writing that says "Access the full list of Jetpack modules available on your site."

wp engine test site wordpress

There is almost no chance a regular user would find these missing modules on their own. Heck, three developers and tech-support staff very familiar with Jetpack were unable to find it on their own.

I do understand wanting to simplify the options within Jetpack, but the current iteration makes it impossible for users to find hidden features they may be looking for. (To say nothing of making it difficult for users to "discover" features they may find useful but didn't know Jetpack offered. I can see many users installing a separate contact-form plugin now, not realizing that Jetpack comes with one built in.)

As a temporary workaround for now, could we please consider adding something like this to each settings screen, maybe just above the "We're here to help" section:

Looking for more features? See all modules

...with a link to all the modules?

This will prevent a lot of frustration.

aheckler commented 7 years ago

From 3168642-t:

I think long-time users like me are a bit confused by the UI changes when they obscure access to certain settings.

MichaelArestad commented 7 years ago

@zoonini These are only issues that arise for users that have previously disabled those modules. New users won't run into this since they'll be enabled by default. That said, we're working on making it much easier for those users to re-enable the modules.

kathrynwp commented 7 years ago

Thanks @MichaelArestad - thanks for clarifying, and I do understand that. However, with millions of Jetpack users, that base is pretty significant and I hope we can do something to reduce confusion, such as add a simple link as I suggested above, and/or make the modules searchable as was suggested elsewhere. Those suggestions would not overly complicate the current UI but prevent a lot of hair-pulling and frustration.

(p.s. sorry, I was logged in from a different account earlier by accident, I'm zoonini)

csonnek commented 7 years ago

I'll echo Kathryn's statement: just because they're "new users" doesn't mean they're new to Jetpack. If they're trying to find the setting to turn something off, that's well within their right to do so regardless of how we've set up the current UX - a search should pull up a result and corresponding "on/off" switch.

antermoia commented 7 years ago

My situation was that I wanted to "re-disable" :-P Photon while keeping Tiled Galleries active. I knew that the two can be separated, and thought I was going crazy until I contacted support and Adam gave me the direct link for the individual modules.

So in a nutshell, I'd like to add my vote that there should be an easier way to access "Advanced" settings or whatever you want to call it.

And forcing users into features with a "One way activation" for the sake of UI simplification is not a solution. Add a warning: "Attention: xyz relies on JSON API (or whatever) and disabling it will also disable xyz - are you sure you want to proceed?" - educate users, don't treat them like dummies.

MichaelArestad commented 7 years ago

@antermoia The problem in your situation is that Tiled Galleries automatically uses Photon even when Photon is "off." I believe there's an issue to separate them so that it doesn't require photon. In that case, we'll unpair them in the UI.

EDIT: To elaborate, I ran into an issue with one of my hosts where photon breaks the site because the host is slower. I disabled it, but kept trying to use tiled galleries. Unfortunately, they were still busted because of Photon.

MichaelArestad commented 7 years ago

@csonnek We're trying to reduce the number of on/off switches to help future-proof our plugin a bit more against situations like these. At least that's one of the goals. The transition could have been better and there is a solution worked up for re-enabling these. I don't think we should make it convenient to disable certain modules as we have done in the past.

If they're trying to find the setting to turn something off, that's well within their right to do so regardless of how we've set up the current UX

I would also challenge this assumption. While it is within their right to figure out how to disable something one way or another, we don't have to provide a setting for that and in some cases, it's probably not a good idea to.

antermoia commented 7 years ago

@MichaelArestad I know that Tiled Galleries always uses Photon - but only to render the gallery grid, not for the full size images. So that's fine with me.

(background: as a photographer, I try to stay in control of my images as much as I can - Photon would take away the ability to at least block the most offensive hotlinkers who steal my photos and embed them on their "get free wallpapers here!" sites that are laced with questionable ads.)

kathrynwp commented 7 years ago

I don't think we should make it convenient to disable modules as we have done in the past.

Just wanted to point out that in my real-world example from this weekend, the current UI actually made it impossible for a user to enable a module. (Shortcode Embeds.) A user may have disabled something a long time ago that they decided they didn't need. Making it extremely hard for them to turn it back on (because it's impossible to find) is super frustrating for them -- and means one less person using that JP module.

MichaelArestad commented 7 years ago

@kathrynwp I am aware. I'm as concerned as you are. This has been something we've been struggling to find a good option for because we definitely don't want to frustrate any of our users. We also didn't quite get a proposal in for the release. We now have a design that solves this in a one way fashion (can enable, but not disable) and it's up to our devs to implement it.

tmmbecker commented 7 years ago

3178737-t

I am unable to find a settings page option to disable the Contact Form module.

jeherve commented 7 years ago

Also in https://wordpress.org/support/topic/stop-hiding-the-deactivation-options/

I understand that automattic wants people to use the stats module, but the deactivation option shouldn’t be hidden in the debug link.

richardmtl commented 7 years ago

3181752-t

Is it possible to disable the contact form module? Neither the Jetpack settings page nor removing it in the 'jetpack_get_available_modules' filter seem to work

jeherve commented 7 years ago

https://wordpress.org/support/topic/googleapps-shortcode/

where we can find documentation on it and the other shortcodes the current version of Jetpack (4.8.2) supports, and whether they are enabled by activating a Jetpack module.

tmmbecker commented 7 years ago

182685-h

couldn't find where to deactivate JSON

jeherve commented 7 years ago

https://wordpress.org/support/topic/are-shortlinks-gone/

I used to use the shortlinks a long time ago. Today when I tried to turn them back on I was unable to find where to turn them on. Is this something that has been removed or am I just not seeing it?

wpchannel commented 7 years ago

Hi everyone,

I've been using Jetpack for a long time now (since the first version maybe) and I can confirm that this is very frustrating and confusing to not have a list of modules. Quick example: one of my friend last day asked me how to to disable JP Stats because she prefers to use GA. After looking everywhere and firstly in the official documentation, I had to ask @jeherve on Slack to get a solution.

Something has to be done. I'm using WordPress since 2007 as a professional and I was not able to find the solution... so believe me: non tech user won't too...

Thanks for your attention and let me know if I can help. ;)

jeherve commented 7 years ago

Also in https://wordpress.org/support/topic/widgets-not-displaying-multisite-primary-site/

this one has me stumped

WP multisite – the primary site is not displaying widgets while subsites are.

I went through debugging, cache, disabled plugins… complete mystery.

davidakennedy commented 7 years ago

Hi there!

I wanted to point out another real world example I experienced with this. My wife (also a front end developer and Jetpack user) needed to debug something. She needed to turn off the contact form module to help dig deeper into the problem. We both couldn't figure out how to do it.

I understand moving items and redesigning to make the interface better and simpler. But maybe there's a way to let longtime users know where functionality has moved, especially since it was a huge part of the interface for so long.

jeherve commented 7 years ago

Some more feedback.

shouldn’t it be possible to enable/disable a feature without entering in a URL manually? This seems like something that should be part of the settings page.

How can we find this menu without knowing the “admin.php?page=jetpack_modules” URL?

why is this page hidden to us? I missed it since few updates?

-- https://jetpack.com/2017/05/02/jetpack-4-9-widgets-and-improvements/#comment-21345

jeherve commented 7 years ago

Followed your suggestion and yes, now I am able to add the widgets. I’ve said it before and I’ll say it again: please don’t go all Microsoft on your users by oversimplifying the user interface. A large part of your userbase pretty much knows what they are doing.

-- https://jetpack.com/2017/05/02/jetpack-4-9-widgets-and-improvements/#comment-21361

jeherve commented 7 years ago

Updated three sites to the latest version, however the new EU Cookie Law Banner, Flickr and IDL widgets are nowhere to be found.

-- https://wordpress.org/support/topic/new-widgets-not-available/

macmanx2 commented 7 years ago

Contact Form module:

I'm feeling like an idiot... I need some help. I have two Wordpress sites, one with the following button and one site that is missing the button.

-- 3178175-t

I have no Add Contact Form button when editing a page to add a form. Any hints on what to check first?

-- 3189456-t

I followed the same steps for my other websites and the 'Contact Form' button (usually visible above the body of each page) is not visible.

-- 3188925-t

I'm not able to see any way about how to set and activate Jetpack contact form in my site.

-- 3180313-t

The 'Add Contact Form' button option is not displaying within the text editor.

-- 3179730-t

Earlier I could activate the module for the contact form, but in the new version, I don't see that option anymore.

-- 3178270-t

I would like to use the Jackpack Contact form - but I don't have a button to insert it into my page.

-- 3171487-t

Has the Contact Form feature of JetPack now been discontinued? I can't seem to find/activate it in my plugin settings.

-- 3194889-t

I want to turn on Contact form module. I am not getting option in Text editor to add contact form.

-- 3194827-t

Widget Visibility module:

Has the widget visibility been removed from jetpack? If not, where is it?

-- 3177223-t

When updating to the newest version of Jetpack we have noticed that the widget visibility module is gone.

-- 3173088-t

I tried looking for the visibility option, but it's not there anymore, what happened?

-- 3194313-t

I can not find the place to activate the widget visibility function.

-- 3191081-t

Extra Sidebar Widgets module:

I don't see any of the extra sidebar widgets and I don't see any option in jetpack settings to enable it.

-- 3190326-t

I installed and activated Jetpack but all of the standard extra sidebar widgets are missing?

-- 3177489-t

With Jetpack 4.8 the Jetpack's widgets are disappeared. I tried to reinstall jetpack with zero results.

-- 3191174-t

macmanx2 commented 7 years ago

I'm trying to add a contact form to my contact page, but the button to add one isn't there. I didn't find any setting to turn the form on or off either. Do I need to install the form functionality separately?

-- 3195948-t

jeherve commented 7 years ago

I just installed JetPack. I cannot find the contact form module. Where is it? I found lots of online tutorials for older versions of JetPack that are useless now because JetPack is different

This was very non-intuitive but I found it by enabling “Debugging” at the bottom of the jetpack page.

-- https://wordpress.org/support/topic/cannot-find-contact-form-module/

macmanx2 commented 7 years ago

Tiled Galleries:

The mosaic galleries module was removed, looked everywhere to turn it on, jetpack 4.8.2.

-- 3172780-t

Before my last update I regularly made galleries using Jetpack. It was in my posts toolbar. Now it is gone and I can't figure out where it is.

-- 3197022-t

It has been over 24 hours and those options have not appeared. How do I get the other gallery types to appear like square tiles, circles, etc?

-- 3181265-t

How do I navigate to the place in Jetpack where I can activate Tiled Gallery? It is nowhere to be found.

-- 3171390-t

tmmbecker commented 7 years ago

3201950-t

Can you please add a function to entirely disable stats?

dromero20 commented 7 years ago

3201512-t

where do I go to enable or disable Jetpack contact form. I just loaded Jetpack on a new site and on my other sites this is easy to find. No clue where to look.

3201512-t

I've been through the settings and your documentation, but I don't see how to do this. Can you advise?

jeherve commented 7 years ago

If I search for “Omnisearch” or “Search” nothing comes up. I look at every single tab, nothing there. So where the heck is the setting?

The removal of the old Modules page–with everything in one place–was a terrible decision, IMHO. It’s extremely difficult to find anything. Waaay too much upselling noise! Ugh.

-- https://wordpress.org/support/topic/why-was-omnisearch-removed/

ghost commented 7 years ago

Poor decision-making on this new UI. It is a hostile move towards longtime Jetpack users: "we're going to hide the familiar module management system that we've used for years, and instead serve up a confusing mishmash of screens bloated with upsells and adverts for our apps. And oh yeah, even if you know that a module exists, we won't let you find it by searching for it. HA HA!"

Jetpack is bringing the WP.com design attitude to self-hosted, and I'm not at all happy about it. Over at dotcom, users have to put up with the daily anxiety of "what did they change today?" Unannounced major UI changes, endless "iterations," and a generally arrogant attitude towards the users... That's why I no longer recommend WP.com to my clients: it's an unstable and unpredictable environment. Self-hosted WP is [should be] a different animal: here, the user is in charge. We get to set things up the way we like, have full control, and are generally assumed to be reasonably competent. UI changes are gradual and unobtrusive, and once something changes it isn't endlessly tweaked and mucked about with annoying and confusing "iterations."

But alas, Jetpack is firmly of the WP.com world, pushing out a heavy-handed UI change that is fundamentally broken for longtime users. If Jetpack does not consider returning to a more respectful approach to its customers, I'm afraid I'll have to bail and go back to finding individual plugins.

wpchannel commented 7 years ago

Same feeling...

ghost commented 7 years ago

@jeherve you asked me to make a comment about specific changes. I don't have the time or energy to dig into specific UI mods, but here are a few principles that I would like to see applied:

Thanks.

antermoia commented 7 years ago

I have no problem with a simplified UI but I share @AdrienneAdams concerns. Hiding controls altogether is a terrible idea. Dumbing down the UI of a plugin to a product (self-hosted WordPress) that appeals to more tech-savvy users in general seems like running a fool's errand.

If for the sake of simplicity it is deemed necessary to de-clutter the interface, then create setting groups (in the fashion of Windows' grouping of the Control Panel; previous versions of Jetpack already had that), but always let users switch back to the full list - with a clearly visible "Advanced" or whatever, to show all modules.

Thanks.

jeherve commented 7 years ago

@AdrienneAdams Thanks! This is all good feedback.

While I don't have answers to the main problem mentioned in this issue (some modules can't be accessed from the new Settings UI), I believe I may be able to shed some light on one of your remarks:

Test. Please don't fall into the WP.com mode of treating all your customers as beta testers. We have work to do, we don't need to waste time trying to find stuff that was there yesterday.

You'll be happy to hear that we thoroughly test all changes internally before each release. We also have a public Beta testing group. Anyone can sign up here: https://jetpack.com/beta/

Once you sign up, you will then receive emails when a new Beta is available and when we need your help with testing. You'll also be able to install the Beta plugin on one of your test sites, and the plugin gives you access to the Bleeding Edge version of the plugin as well as the Beta releases, along with testing instructions for each one of the new features available in the Beta.

If you work with Jetpack to build client sites, I would recommend that you join the Beta group and use the Beta plugin on your test sites to follow the development of Jetpack, and give your feedback on those new features!

jeherve commented 7 years ago

There used to be a concise list of features that could be easily activated, deactivated singularly or in bulk. [...] Now you have to sift through tabs to hunt down settings. -- https://twitter.com/mikemcalister/status/862373164487245829 -- https://twitter.com/mikemcalister/status/862373946271952896

rclations commented 7 years ago

adding my 2 cents to this tidal wave:

We run a bunch of news sites - none of them use Jetpack. After the announcement for the google docs integration, there's been a lot of interest in the plugin. Yay!

Problem is, every site we install it on, it breaks something. Photon strips out an image width declaration and the publisher wonders why their images are suddenly blown out. The mobile enhancements totally break site styles, and people wonder why there are suddenly an extra row of related posts showing up on their articles. All they want is to use the Google Docs integration they tell us.

Okay, so certain parts of Jetpack have mixed results. And other parts might be duplicating functionality you've already built into your site using other tools. I think to myself - why not just make a curated list for clients of recommended features, and let people select what they need?

But that's not possible anymore - at least not to the extent it needs to be. The design decision you're making is narrowing the user experience to a specific set of parameters that you're hoping will maximize user success and adoption of the plugin. The problem is, those parameters have to be perfect for that to work - and they're not.

When jetpack had a module selector, I had the option to choose my own adventure. That could be a good or a bad adventure - but that was up to me. Now you've decided what type of adventure Jetpack will be when I install it - and at least in my experience, that adventure involves messing up my sites. That leaves me out of options besides telling people to avoid Jetpack.

It's a shame because you have a lot of awesome tools and features here. It's a shame because there's a lot of great people working on the product. It's a shame because you release something like the gdocs integration that could fuel a ton of new signups for you, and then you lose that momentum by breaking things the second someone tries to turn on your product.

jeherve commented 7 years ago

@rclations Thanks for the feedback!

If I may, I'd like to try to address some of your questions and concerns that are not directly related to this issue.

Photon strips out an image width declaration and the publisher wonders why their images are suddenly blown out.

Don't hesitate to reach out to us with some examples via this contact form; we should be able to help you get this fixed!

The mobile enhancements totally break site styles

It does indeed introduce a brand new theme for mobile readers, completely replacing the desktop theme. If your desktop theme is already responsive, you probably don't need Jetpack's Mobile Theme at all.

As more themes out there are responsive, Jetpack's Mobile Theme becomes less and less useful. It's consequently not one of our recommended features and won't get activated if you click on this button when first setting up Jetpack:

screen shot 2017-05-12 at 13 58 38

Photon and Related Posts, on the other hand, are. If you skip this step, none of the features will be activated.

When jetpack had a module selector, I had the option to choose my own adventure. That could be a good or a bad adventure - but that was up to me. Now you've decided what type of adventure Jetpack will be when I install it

To clarify, we haven't made any changes to the list of features that are activated on your site when you install Jetpack. It is, however, more difficult to then go back and quickly activate or deactivate specific features. That's what this issue aims to fix.

If you have other ideas, don't hesitate to let us know!

In the meantime, as a site developer, you also have other ways to stay in total control of the Jetpack features available and enabled on the sites you develop. If you already use other plugins to achieve some of Jetpack's features, or if you know your users won't need a specific feature and will in fact be more confused if they enable it (like with the Mobile Theme option), I don't think you should allow your users to even see that option in the first place. They should not see or be able to activate that feature. Jetpack offers you multiple hooks allowing you to customize the Jetpack experience you offer to your clients. They're all listed here. You can also find tutorials helping you get more familiar with the filters you can use to customize the list of features available on each site you develop. Here is one. The advantage of those filters is that they allow you to save some time (you won't have to configure Jetpack manually for every new site you create), and control the interface itself. In your example, you could for example make it so only the JSON API is available to your users, and activated by default when they connect Jetpack to WordPress.com. Every other option would be gone from the options available to them when they install Jetpack, they wouldn't be able to use those other features you don't want them to use. Here is a quick example of how you could go about doing that:

/**
 * Build a whitelist of Jetpack modules to be available on a site.
 *
 * @see https://github.com/Automattic/jetpack/issues/6788#issuecomment-300936722
 * @see https://jeremy.hu/customize-the-list-of-modules-available-in-jetpack/
 * @see https://developer.jetpack.com/hooks/jetpack_get_available_modules/
 *
 * @param array  $modules     Array of available modules.
 * @param string $min_version Minimum version number required to use modules.
 * @param string $max_version Maximum version number required to use modules.
 */
function jeherve_whitelist_jetpack_modules( $modules, $min_version, $max_version ) {

    /**
     * Array of the only modules we want to keep.
     * Since you install Jetpack for folks to use Google Docs' add-on,
     * you need the JSON API module.
     *
     * You can find a full module list by running something like `Jetpack::get_available_modules();`
     * Here is the full module list as of today:
     * https://gist.github.com/jeherve/993738868b0fe941b32d4f65654cb6b9
     */
    $my_modules = array(
        'json-api',
    );

    // Let's loop through the available and remove everything that doesn't belong in our array.
    foreach ( $modules as $name => $intro_version ) {
        if ( ! in_array( $name, $my_modules ) ) {
            // If the module is not in our list, let's remove it.
            unset( $modules[ $name ] );
        }
    }

    // Let's return our list of available modules.
    return $modules;
}
add_filter( 'jetpack_get_available_modules', 'jeherve_whitelist_jetpack_modules', 20, 3 );

/**
 * Automatically activate the JSON API module when Jetpack is connected to WordPress.com.
 *
 * @see https://github.com/Automattic/jetpack/issues/6788#issuecomment-300936722
 * @see https://developer.jetpack.com/hooks/jetpack_get_default_modules/
 */
function jeherve_auto_activate_jsonapi() {
    return array( 'json-api' );
}
add_filter( 'jetpack_get_default_modules', 'jeherve_auto_activate_jsonapi' );

I hope this helps!