/** * Returns a model representing the token we want to get from * the OAuth plugin * * @param String $handle The handle of the token we want to find, usually this is just the * name of the provider itself. * * @return Mixed null|Placid_OAuthModel Either nothing or the model representation */ public function findByHandle($handle) { Craft::log(__METHOD__, LogLevel::Info, true); // Get the request record by its handle // --------------------------------------------- $record = Placid_OAuthRecord::model()->find('handle=:handle', array(':handle' => $handle)); if ($record) { return $this->model->populateModel($record); } return null; }
/** * Deletes a token from both Placid and the OAuth plugin * @param String $provider Name of the provider's token we want to delete * @return Bool true if delete was successful */ public function deleteToken($provider) { $tokenModel = $this->findByHandle($provider); $oauthTokenModel = craft()->oauth->getTokenById($tokenModel->id); craft()->oauth->deleteToken($oauthTokenModel); if ($tokenModel) { Placid_OAuthRecord::model()->deleteByPk($tokenModel->id); } return true; }