diff --git a/classes/class-PBS-LAAS-client.php b/classes/class-PBS-LAAS-client.php index 38feb6e..eb710ba 100644 --- a/classes/class-PBS-LAAS-client.php +++ b/classes/class-PBS-LAAS-client.php @@ -184,7 +184,7 @@ public function check_pbs_login() { } $updated_tokeninfo = $this->update_pbs_tokeninfo($current_tokeninfo); - $access_token = $updated_tokeninfo['access_token']; + $access_token = isset($updated_tokeninfo['access_token']) ? $updated_tokeninfo['access_token'] : false; if (! $access_token) { // they're not logged in @@ -378,6 +378,7 @@ private function decrypt($cyphertext=''){ private function retrieve_encrypted_tokeninfo() { + $tokeninfo = false; // check for encrypted tokeninfo in cookie if (isset($_COOKIE[$this->tokeninfo_cookiename])){ @@ -389,8 +390,9 @@ private function retrieve_encrypted_tokeninfo() { if ($decrypted) { $tokeninfo = $decrypted; } - - $tokeninfo = json_decode($tokeninfo, true); + if (!empty($tokeninfo)) { + $tokeninfo = json_decode($tokeninfo, true); + } return $tokeninfo; } diff --git a/classes/class-pbs-passport-authenticate.php b/classes/class-pbs-passport-authenticate.php index 896a8ef..1fafee8 100644 --- a/classes/class-pbs-passport-authenticate.php +++ b/classes/class-pbs-passport-authenticate.php @@ -23,7 +23,7 @@ public function __construct($file) { $this->assets_url = esc_url( trailingslashit( plugins_url( '/assets/', $file ) ) ); $this->token = 'pbs_passport_authenticate'; $this->defaults = get_option($this->token); - $this->version = '0.3.1.4'; + $this->version = '0.3.1.5'; // Load public-facing style sheet and JavaScript. add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) ); @@ -89,9 +89,10 @@ public function rewrite_templates($template) { // add pbsoauth to body classes. public function ppa_body_classes( $classes ) { if (!empty(get_query_var('pbsoauth'))) { - if (in_array(get_query_var('pbsoauth'), array('authenticate','callback','loginform','activate','userinfo','vppa','alreadymember'))) { - $classes[] = 'pbsoauth'; - if ($classes[0] == 'home') { unset($classes[0]); } + if (in_array(get_query_var('pbsoauth'), array('authenticate','callback','loginform','activate','userinfo','vppa' ))) { + $classes[] = 'pbsoauth'; + #jic the first element in $classes is 'home' remove it + if (reset($classes) == 'home') { array_shift($classes); } } } return $classes; diff --git a/pbs-passport-authenticate.php b/pbs-passport-authenticate.php index 2b5d7d9..6ad6bd5 100644 --- a/pbs-passport-authenticate.php +++ b/pbs-passport-authenticate.php @@ -1,7 +1,7 @@ activate($mvault_id, $pbs_uid); - $errors['activate'] = $mvaultinfo['errors']; + if (isset($mvaultinfo['errors'])) { + $errors['activate'] = $mvaultinfo['errors']; + } } if (! isset($mvaultinfo["membership_id"])) { // get the mvault record if available - $mvaultinfo = $mvault_client->get_membership_by_uid($pbs_uid); - $errors['byuid'] = $mvaultinfo['errors']; + $mvaultinfo = $mvault_client->get_membership_by_uid($pbs_uid); + if (isset($mvaultinfo['errors'])) { + $errors['byuid'] = $mvaultinfo['errors']; + } } // preset these for later cleanup $userinfo["membership_info"] = array("offer" => null, "status" => "Off"); @@ -83,7 +87,7 @@ $vppa_links = $passport->get_oauth_links(array('scope' => 'account vppa')); // We will now attempt to determine what the users current login_provider is // mvault is fallback - $login_provider = !empty($mvaultinfo["pbs_profile"]["login_provider"]) ? strtolower($mvaultinfo["profile"]["pbs_login_provider"]) : false; + $login_provider = !empty($mvaultinfo["pbs_profile"]["login_provider"]) ? strtolower($mvaultinfo["pbs_profile"]["login_provider"]) : false; if ( !in_array($login_provider, array("pbs", "google", "facebook", "apple") ) ) { $login_provider = "pbs"; }