Skip to content

Commit

Permalink
feat: Added given_name and family_name user meta
Browse files Browse the repository at this point in the history
  • Loading branch information
Pablofl01 committed Sep 14, 2024
1 parent d98897e commit 70fdce4
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions OpenID.php
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,8 @@ private function _user_from_claim(array $claim): WP_User
'meta_input' => [
'openid_id' => $claim['sub'],
'upm_classif_codes' => implode(', ', $claim['upmClassifCode']) ?? '',
'given_name' => $claim['given_name'],
'family_name' => $claim['family_name'],
],
];

Expand Down Expand Up @@ -367,6 +369,8 @@ private function _user_from_claim(array $claim): WP_User
// Update user meta
update_user_meta($user->ID, 'openid_id', $claim['sub']);
update_user_meta($user->ID, 'upm_classif_codes', implode(', ', $claim['upmClassifCode']) ?? '');
update_user_meta($user->ID, 'given_name', $claim['given_name']);
update_user_meta($user->ID, 'family_name', $claim['family_name']);

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

// Update additional fields if they exist in the claim
foreach ($this->user_mapping as $key => $value) {
Expand All @@ -418,6 +424,8 @@ private function _user_from_claim(array $claim): WP_User
'meta_input' => [
'openid_id' => $claim['sub'],
'upm_classif_codes' => implode(', ', $claim['upmClassifCode']) ?? '',
'given_name' => $claim['given_name'],
'family_name' => $claim['family_name'],
],
];

Expand Down

0 comments on commit 70fdce4

Please sign in to comment.