Skip to content
This repository has been archived by the owner on Dec 8, 2020. It is now read-only.

Allows users to save custom fields created in Azure to users in WP #20

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions b2c_authentication.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,9 @@ function b2c_verify_token() {
);

$userID = wp_insert_user( $our_userdata );

// Allows custom fields sent over the payload to be saved in Wordpress
do_action('b2c_new_userdata', $userID, $token_checker->get_payload());
} else if ($policy == B2C_Settings::$edit_profile_policy) { // Update the existing user w/ new attritubtes

$first_name = $token_checker->get_claim('given_name');
Expand All @@ -137,6 +140,9 @@ function b2c_verify_token() {
);

$userID = wp_update_user( $our_userdata );

// Allows custom fields sent over the payload to be updated in Wordpress
do_action('b2c_update_userdata', $userID, $token_checker->get_payload());
} else {
$userID = $user->ID;
}
Expand Down
2 changes: 1 addition & 1 deletion class-b2c-endpoint-handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public function get_authorization_endpoint() {
'&redirect_uri='.B2C_Settings::$redirect_uri.
'&response_mode='.B2C_Settings::$response_mode.
'&scope='.B2C_Settings::$scope;
return $authorization_endpoint;
return apply_filters('b2c_authorization_endpoint', $authorization_endpoint);
}

/**
Expand Down
7 changes: 7 additions & 0 deletions class-b2c-token-checker.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,13 @@ public function authenticate() {
public function get_claim($name) {
return $this->payload[$name];
}

/**
* Returns the payload.
*/
public function get_payload() {
return $this->payload;
}
}