/** * @Acl allow :loggedIn */ public function update($firstName, $lastName, $birthDate, $gender, $intrests, $biography, $website, $from = null) { $profile = UserSession::get()->user()->profile; $profile->firstName = $firstName; $profile->lastName = $lastName; $profile->birthDate = $birthDate; $profile->gender = $gender; $profile->intrests = $intrests; $profile->biography = $biography; $profile->website = $website; $avatar = Session::getFileUpload('avatar'); $profile->avatar = $avatar; try { $avatar->setAutoStore($profile->username, $profile->avatar_extension); $profile->save(); $this->notice(t('Profile updated')); if ($from) { $this->redirect($from); } else { $this->redirect('user/profile/show', $profile->username); } } catch (ValidationException $e) { $avatar->persist(); $this->error(t('Profile not updated')); $this->from = $from; $this->profile = $profile; $this->render('profile/edit'); } }