Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if ($input = $this->input->post()) {
- $user = new User_Model(Session::get('user_id', FALSE));
- $profile = new Profile_Model(Session::get('user_id', FALSE));
- $input_user = $this->input->post();
- $input_profile = $this->input->post();
- if ( ! $user->validate($input_user)) {
- foreach ($input_user->errors('form_errors') as $error) {
- $errors[] = $error;
- }
- }
- if ( ! $profile->validate($input_profile)) {
- foreach ($input_profile->errors('form_errors') as $error) {
- $errors[] = $error;
- }
- }
- if (isset($errors)) {
- $json = array('success' => FALSE, 'errors' => $errors);
- $this->template->body = json_encode($json);
- } else {
- if ( ! empty($input['password']))
- $user->hashed_password = Auth::hash_password($input['password']);
- $user->save();
- $this->set_session_user();
- $profile->save();
- $this->set_session_profile();
- $json = array('success' => TRUE);
- $this->template->body = json_encode($json);
- }
- }
Add Comment
Please, Sign In to add comment