Skip to content

Commit 78eb22c

Browse files
drobin03evansims
andauthored
Skip email sync when update is coming from Auth0 (#831)
Co-authored-by: Evan Sims <[email protected]>
1 parent c59f799 commit 78eb22c

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/WP_Auth0_LoginManager.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,13 +313,19 @@ public function login_user( $userinfo, $id_token = null, $access_token = null, $
313313
}
314314
}
315315

316+
// Temporarily disable the email sync, since the changes are coming from Auth0, no need to update them there.
317+
remove_action( 'profile_update', 'wp_auth0_profile_change_email', 100 );
318+
316319
wp_update_user(
317320
(object) [
318321
'ID' => $user->data->ID,
319322
'user_email' => $userinfo->email,
320323
'description' => $description,
321324
]
322325
);
326+
327+
// Turn the email sync back on
328+
add_action( 'profile_update', 'wp_auth0_profile_change_email', 100, 2 );
323329
}
324330

325331
$this->users_repo->update_auth0_object( $user->data->ID, $userinfo );

0 commit comments

Comments
 (0)