} } if ($create_account) { $reg = new CODOF\User\Register($db); $reg->mail = $mail; $reg->name = $user_profile->firstName . ' ' . $user_profile->lastName; $reg->oauth_id = $oauth_id; $reg->username = $username; $reg->avatar = $user_profile->photoURL; $reg->user_status = 1; //approved user $reg->register_user(); $reg->login(); } } header('Location: ' . CODOF\User\User::getProfileUrl()); //$adapter->logout(); } catch (Exception $e) { // In case we have errors 6 or 7, then we have to use Hybrid_Provider_Adapter::logout() to // let hybridauth forget all about the user so we can try to authenticate again. // Display the recived error, // to know more please refer to Exceptions handling section on the userguide switch ($e->getCode()) { case 0: echo "Unspecified error."; break; case 1: echo "Hybridauth configuration error."; break; case 2: echo "Provider not properly configured.";