From 136c7d71ac4ec720a88fab8e8797fa0f2d70c3b7 Mon Sep 17 00:00:00 2001 From: Gabriel Demichelis Date: Mon, 29 Jan 2024 20:07:17 -0300 Subject: [PATCH] Update with suggested approach --- projects/plugins/jetpack/modules/masterbar.php | 4 +++- .../class-wpcom-user-profile-fields-revert.php | 9 +-------- .../modules/masterbar/profile-edit/profile-edit.php | 5 +---- 3 files changed, 5 insertions(+), 13 deletions(-) diff --git a/projects/plugins/jetpack/modules/masterbar.php b/projects/plugins/jetpack/modules/masterbar.php index aacde02a961fb..4734bbf439bb9 100644 --- a/projects/plugins/jetpack/modules/masterbar.php +++ b/projects/plugins/jetpack/modules/masterbar.php @@ -28,7 +28,9 @@ if ( ( new Host() )->is_woa_site() ) { new Inline_Help(); require_once __DIR__ . '/masterbar/wp-posts-list/bootstrap.php'; - require_once __DIR__ . '/masterbar/profile-edit/bootstrap.php'; + if ( get_option( 'wpcom_admin_interface' ) !== 'wp-admin' ) { + require_once __DIR__ . '/masterbar/profile-edit/bootstrap.php'; + } require_once __DIR__ . '/masterbar/nudges/bootstrap.php'; } diff --git a/projects/plugins/jetpack/modules/masterbar/profile-edit/class-wpcom-user-profile-fields-revert.php b/projects/plugins/jetpack/modules/masterbar/profile-edit/class-wpcom-user-profile-fields-revert.php index e36e781ce18e8..3beffd7bf97b0 100644 --- a/projects/plugins/jetpack/modules/masterbar/profile-edit/class-wpcom-user-profile-fields-revert.php +++ b/projects/plugins/jetpack/modules/masterbar/profile-edit/class-wpcom-user-profile-fields-revert.php @@ -30,9 +30,6 @@ class WPCOM_User_Profile_Fields_Revert { */ public function __construct( Connection_Manager $connection_manager ) { $this->connection_manager = $connection_manager; - if ( 'wp-admin' === get_option( 'wpcom_admin_interface' ) ) { - return; - } \add_filter( 'wp_pre_insert_user_data', array( $this, 'revert_user_data_on_wp_admin_profile_update' ), 10, 3 ); \add_filter( 'insert_user_meta', array( $this, 'revert_user_meta_on_wp_admin_profile_change' ), 10, 3 ); @@ -123,11 +120,7 @@ public function revert_user_data_on_wp_admin_profile_update( $data, $update, $id public function revert_user_meta_on_wp_admin_profile_change( $meta, $user, $update ) { // bail if not in update context. - if ( - ! $update || - ! $this->connection_manager->is_user_connected( $user->ID ) || - 'wp-admin' === get_option( 'wpcom_admin_interface' ) - ) { + if ( ! $update || ! $this->connection_manager->is_user_connected( $user->ID ) ) { return $meta; } diff --git a/projects/plugins/jetpack/modules/masterbar/profile-edit/profile-edit.php b/projects/plugins/jetpack/modules/masterbar/profile-edit/profile-edit.php index a43c741ff9963..0e9e8c0cb7192 100644 --- a/projects/plugins/jetpack/modules/masterbar/profile-edit/profile-edit.php +++ b/projects/plugins/jetpack/modules/masterbar/profile-edit/profile-edit.php @@ -14,10 +14,7 @@ */ function jetpack_masterbar_hide_profile_fields( $user ) { $connection_manager = new Connection_Manager( 'jetpack' ); - if ( - ! $connection_manager->is_user_connected( $user->ID ) || - 'wp-admin' === get_option( 'wpcom_admin_interface' ) - ) { + if ( ! $connection_manager->is_user_connected( $user->ID ) ) { // If this is a local user, show the default UX. return; }