diff --git a/b2c_authentication.php b/b2c_authentication.php index 9055bd5..696524e 100644 --- a/b2c_authentication.php +++ b/b2c_authentication.php @@ -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'); @@ -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; } diff --git a/class-b2c-endpoint-handler.php b/class-b2c-endpoint-handler.php index 07f976a..99816f0 100644 --- a/class-b2c-endpoint-handler.php +++ b/class-b2c-endpoint-handler.php @@ -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); } /** diff --git a/class-b2c-token-checker.php b/class-b2c-token-checker.php index 7e35aa0..9e7acaf 100644 --- a/class-b2c-token-checker.php +++ b/class-b2c-token-checker.php @@ -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; + } }