/** * Called when to show the edit page for a user's profile. Works of the current * logged in user */ public function edit() { $this->load->model('contributor'); $this->load->helper('form'); $this->load->library('form_validation'); $contributor_id = UserHelper::getId(); $contributor = Contributor::findById($contributor_id); $submit = $this->input->post('submit'); if ($submit) { if ($this->form_validation->run('edit_profile')) { $update = elements(array('email', 'website', 'real_name', 'password'), $_POST); Contributor::update($contributor_id, $update); if ($update['password']) { UserHelper::setNotice("Nice, everything saved, including your new password"); } else { UserHelper::setNotice("Nice, everything saved"); } } else { UserHelper::setNotice("Hrm, there was a problem (see below)", FALSE); } } $data = array('contributor' => $contributor); $this->load->view('contributors/edit', $data); }