Skip to content

Commit

Permalink
fix: Stringified upmClassifCode when updating user
Browse files Browse the repository at this point in the history
  • Loading branch information
Pablofl01 committed Sep 3, 2024
1 parent 76a1426 commit 0e604f7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions OpenID.php
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ private function _user_from_claim(array $claim): WP_User
'user_email' => $claim[$this->user_mapping['user_email']] ?? $claim['email'],
'meta_input' => [
'openid_id' => $claim['sub'],
'upm_classif_codes' => $claim['upmClassifCode'] ?? '',
'upm_classif_codes' => implode(', ', $claim['upmClassifCode']) ?? '',
],
];

Expand Down Expand Up @@ -366,7 +366,7 @@ private function _user_from_claim(array $claim): WP_User
if ($user) {
// Update user meta
update_user_meta($user->ID, 'openid_id', $claim['sub']);
update_user_meta($user->ID, 'upm_classif_codes', $claim['upmClassifCode'] ?? '');
update_user_meta($user->ID, 'upm_classif_codes', implode(', ', $claim['upmClassifCode']) ?? '');

// Update additional fields if they exist in the claim
foreach ($this->user_mapping as $key => $value) {
Expand All @@ -391,7 +391,7 @@ private function _user_from_claim(array $claim): WP_User
if ($user) {
// Update user meta
update_user_meta($user->ID, 'openid_id', $claim['sub']);
update_user_meta($user->ID, 'upm_classif_codes', $claim['upmClassifCode'] ?? '');
update_user_meta($user->ID, 'upm_classif_codes', implode(', ', $claim['upmClassifCode']) ?? '');

// Update additional fields if they exist in the claim
foreach ($this->user_mapping as $key => $value) {
Expand Down

0 comments on commit 0e604f7

Please sign in to comment.