Skip to content

Commit

Permalink
Wpcomsh: Remove actions and filters related to the Masterbar module (#…
Browse files Browse the repository at this point in the history
…39367)

* Wpcomsh: Remove actions and filters related to the Masterbar module
  • Loading branch information
fgiannar authored Sep 12, 2024
1 parent 30b9875 commit 5d37c1f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 47 deletions.
1 change: 0 additions & 1 deletion projects/plugins/wpcomsh/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,6 @@ The Coming Soon PCYsg-u4S-p2 mode is provided via the jetpack-mu-wpcom package P

Provides a series of customisations to enable the full Nav Unification experience on Atomic (see pbAPfg-Ou-p2). Includes:

- force enable Masterbar module.
- hide admin color scheme picker and add notice pointing to WordPress.com Account Settings.
- persist important WP.com user data to user_option via Jetpack connected user data.
- activate the Nav Unification feature shipped in Jetpack on Atomic.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: removed

Wpcomsh: Remove actions and filters related to the Masterbar module
46 changes: 0 additions & 46 deletions projects/plugins/wpcomsh/feature-plugins/masterbar.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,52 +8,6 @@

use Automattic\Jetpack\Connection\Manager as Connection_Manager;

/**
* Force-enable the Masterbar module
* If you use a version of Jetpack that supports it,
* and if it is not already enabled.
*/
function wpcomsh_activate_masterbar_module() {
if ( ! defined( 'JETPACK__VERSION' ) || get_option( 'wpcom_admin_interface' ) === 'wp-admin' ) {
return;
}

if ( ! Jetpack::is_module_active( 'masterbar' ) ) {
Jetpack::activate_module( 'masterbar', false, false );
}
}
add_action( 'init', 'wpcomsh_activate_masterbar_module', 0, 0 );

/**
* Disable the Masterbar for nav redesign.
*
* @param array $modules Array of Jetpack modules.
* @return array
*/
function atomic_masterbar_filter_jetpack_modules( $modules ) {
if ( isset( $modules['masterbar'] ) && get_option( 'wpcom_admin_interface' ) === 'wp-admin' ) {
unset( $modules['masterbar'] );
}

return $modules;
}
add_filter( 'jetpack_get_available_modules', 'atomic_masterbar_filter_jetpack_modules' );

/**
* Remove Masterbar from the old Module list.
* Available at wp-admin/admin.php?page=jetpack_modules
*
* @param array $items Array of Jetpack modules.
* @return array
*/
function wpcomsh_rm_masterbar_module_list( $items ) {
if ( isset( $items['masterbar'] ) ) {
unset( $items['masterbar'] );
}
return $items;
}
add_filter( 'jetpack_modules_list_table_items', 'wpcomsh_rm_masterbar_module_list' );

/**
* Check if the current request is an API request to the `wpcom/v2/admin-menu` endpoint.
*
Expand Down

0 comments on commit 5d37c1f

Please sign in to comment.