• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer
Jetpack a2z

Jetpack a2z

Jetpack a2z

  • Home
  • Plugins
  • Blocks
  • Shortcodes
  • APIs
  • Classes
  • Files
  • Hooks
  • Sitemap
  • Blog
Home / APIs / Jetpack_Admin_Page::check_plan_deactivate_modules() – Checks the site plan and deactivates modules that were active but are no longer included in the plan.

You appear to be a bot. Output may be restricted

Description

Checks the site plan and deactivates modules that were active but are no longer included in the plan.

Usage

$array = Jetpack_Admin_Page::check_plan_deactivate_modules( $page );

Parameters

$page
( mixed ) required –

Returns

array

Source

File name: jetpack/_inc/lib/admin-pages/class.jetpack-admin-page.php
Lines:

1 to 54 of 54
  function check_plan_deactivate_modules( $page ) {
    if (
      ( new Status() )->is_offline_mode()
      || ! in_array(
        $page->base,
        array(
          'toplevel_page_jetpack',
          'admin_page_jetpack_modules',
          'jetpack_page_vaultpress',
          'jetpack_page_stats',
          'jetpack_page_akismet-key-config',
        )
      )
    ) {
      return false;
    }

    $current = Jetpack_Plan::get();

    $to_deactivate = array();
    if ( isset( $current['product_slug'] ) ) {
      $active = Jetpack::get_active_modules();
      switch ( $current['product_slug'] ) {
        case 'jetpack_free':
          $to_deactivate = array( 'seo-tools', 'videopress', 'google-analytics', 'wordads', 'search' );
          break;
        case 'jetpack_personal':
        case 'jetpack_personal_monthly':
          $to_deactivate = array( 'seo-tools', 'videopress', 'google-analytics', 'wordads', 'search' );
          break;
        case 'jetpack_premium':
        case 'jetpack_premium_monthly':
          $to_deactivate = array( 'seo-tools', 'google-analytics', 'search' );
          break;
      }
      $to_deactivate = array_intersect( $active, $to_deactivate );

      $to_leave_enabled = array();
      foreach ( $to_deactivate as $feature ) {
        if ( Jetpack_Plan::supports( $feature ) ) {
          $to_leave_enabled [] = $feature;
        }
      }
      $to_deactivate = array_diff( $to_deactivate, $to_leave_enabled );

      if ( ! empty( $to_deactivate ) ) {
        Jetpack::update_active_modules( array_filter( array_diff( $active, $to_deactivate ) ) );
      }
    }
    return array(
      'current'    => $current,
      'deactivate' => $to_deactivate,
    );
  }
 

 View on GitHub View on Trac

Share this:

  • Click to share on Twitter (Opens in new window)
  • Click to share on Facebook (Opens in new window)
  • Click to share on LinkedIn (Opens in new window)
  • Click to share on Pinterest (Opens in new window)

Related

Published: 27 November 2019 | Last updated: 21 August 2020

Primary Sidebar

Information

Function name: Jetpack_Admin_Page::check_plan_deactivate_modules
Class ref: Jetpack_Admin_Page
Plugin ref: Jetpack
Version: 9.2
Sourcefile: _inc/lib/admin-pages/class.jetpack-admin-page.php
File ref: _inc/lib/admin-pages/class.jetpack-admin-page.php
Deprecated?: No
API Letters: A,C,J,P

Footer

Jetpack a2z
Jetpack a2z
Jetpack a2z
WordPress 5.6
WordPress a2z
WordPress core a2z
Genesis Theme Framework a2z
Jetpack a2z
WordPress develop tests
Easy Digital Downloads a2z
WooCommerce a2z
Yoast SEO a2z
WordPress Blocks

Site:  jetpack.wp-a2z.org
© Copyright Jetpack a2z 2014-2021. All rights reserved.


Website designed and developed by Herb Miller
Proudly powered by WordPress and oik plugins

  • Home
  • Blog
  • Sitemap
  • Sites