From caf3ea72679792294c19816efc5483e5664ec981 Mon Sep 17 00:00:00 2001 From: gguseynov Date: Thu, 18 Jul 2019 16:04:41 +0200 Subject: [PATCH] 1. run 'openid-connect-generic-update-user-using-current-claim' action if existing user was updated 2. add_user_meta with single=true does not overwrite old value --- includes/openid-connect-generic-client-wrapper.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/includes/openid-connect-generic-client-wrapper.php b/includes/openid-connect-generic-client-wrapper.php index b463164..d475574 100644 --- a/includes/openid-connect-generic-client-wrapper.php +++ b/includes/openid-connect-generic-client-wrapper.php @@ -708,7 +708,9 @@ class OpenID_Connect_Generic_Client_Wrapper { $uid = email_exists( $email ); } if ( $uid ) { - return $this->update_existing_user( $uid, $subject_identity ); + $user = $this->update_existing_user( $uid, $subject_identity ); + do_action( 'openid-connect-generic-update-user-using-current-claim', $user, $user_claim ); + return $user; } } @@ -766,7 +768,7 @@ class OpenID_Connect_Generic_Client_Wrapper { */ function update_existing_user( $uid, $subject_identity ) { // add the OpenID Connect meta data - add_user_meta( $uid, 'openid-connect-generic-subject-identity', (string) $subject_identity, true ); + update_user_meta( $uid, 'openid-connect-generic-subject-identity', (string) $subject_identity ); // allow plugins / themes to take action on user update do_action( 'openid-connect-generic-user-update', $uid );