From 153b9b11ca0b33695b2e1dd7a48036120f57eb33 Mon Sep 17 00:00:00 2001 From: William Tam Date: Thu, 19 Sep 2024 10:38:14 -0400 Subject: [PATCH] only append membership_info to userinfo if exists --- classes/class-pbs-passport-authenticate.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/classes/class-pbs-passport-authenticate.php b/classes/class-pbs-passport-authenticate.php index c4b092f..9a2d759 100644 --- a/classes/class-pbs-passport-authenticate.php +++ b/classes/class-pbs-passport-authenticate.php @@ -326,14 +326,16 @@ public function get_membership_from_access_token($access_token = '', $client_arg // get the full membership info if available $mvault_client = $this->get_mvault_client(); $mvaultinfo = $mvault_client->get_membership_by_uid($pid); - $login_provider=''; - if (isset($userinfo["provider"])) { - $login_provider = $userinfo["provider"]; - } else if (isset ($mvaultinfo["pbs_profile"]["email"])) { - $login_provider = $mvaultinfo["pbs_profile"]["login_provider"]; + if (isset ($mvaultinfo["pbs_profile"]["email"])) { + $loginprovider = $mvaultinfo["pbs_profile"]["login_provider"]; + if (isset($client_args['use_pmsso']) && ($client_args['use_pmsso'] == true)) { + if (isset($userinfo["provider"])) { + $loginprovider = $userinfo["provider"]; + } + } + $mvaultinfo["pbs_profile"]["login_provider"] = $mvault_client->normalize_login_provider($loginprovider); + $userinfo["membership_info"] = $mvaultinfo; } - $mvaultinfo["pbs_profile"]["login_provider"] = $mvault_client->normalize_login_provider($login_provider); - $userinfo["membership_info"] = $mvaultinfo; return $userinfo; } }