public function action_save() { if (count($_POST) > 0) { $errors = NULL; try { $user = Auth::instance()->get_user(); $user = $user->update_user($_POST, array('password', 'email')); $user->save(); EmailHelper::notify($user, $this->request->post('password')); $this->redirect_to_albums(); } catch (ORM_Validation_Exception $e) { // todo: specify a real messages file here... // external errors are still in a sub-array, so we have to flatten // also the message is wrong - bug #3896 $errors = Arr::flatten($e->errors('hack')); } $this->show_profile_form($user, $errors); } else { $this->redirect_to_albums(); } }
public function action_delete() { $id = $this->request->param('id'); $user = ORM::factory('user', $id); if (!$user->loaded()) { $this->redirect_to_list(); } EmailHelper::notify($user); $user->delete(); $this->redirect_to_list(); }