Skip to content

Commit

Permalink
Update with suggested approach
Browse files Browse the repository at this point in the history
  • Loading branch information
lupus2k committed Feb 1, 2024
1 parent 3c5f34e commit 136c7d7
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 13 deletions.
4 changes: 3 additions & 1 deletion projects/plugins/jetpack/modules/masterbar.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down Expand Up @@ -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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 136c7d7

Please sign in to comment.