/** * @return string */ public function getId() { if ($this->profileId === 'me') { return $this->facebook->getUser(); } return $this->profileId; }
public function facebookRegistrationFormSucceeded($form, $values) { $fbUserId = $values->id; unset($values->id); try { if ($this->facebookUserModel->exists($fbUserId)) { $this->flashMessage("Uživatel s tímto FacebookID již je v systému zaregistrován.", "danger"); $this->redirect("in"); } else { $id = $this->model->insert($values); $this->model->update($id, array("enabled" => 1, "active" => 1)); $this->flashMessage("Uživatel byl úspěšně zaregistrován.", "success"); $this->facebookUserModel->add(array("user_id" => $id, "facebook_id" => $fbUserId, "username" => $values->firstname . " " . $values->lastname, "email" => $values->email)); $this->facebookUserModel->authenticate(array($this->facebook->getUser())); $this->facebookUserModel->updateToken($this->facebook->getUser(), $this->facebook->getAccessToken()); } } catch (Exception $e) { $this->flashMessage("Registrace uživatele se nepodařila.", "danger"); } $this->redirect(":Front:Homepage:default"); }
/** * Synchronize user state with facebook. */ public function syncFacebookSession() { if ($this->facebook->getUser() && $this->isUserChangeState()) { $this->facebook->destroySession(); } }