public function action_profile() { if (\Input::method() === 'POST') { // create instance of validation $val = \Validation::factory(); // add fields to validate $val->add_field('profile_fields.first_name', 'First Name', 'trim|required|min_length[2]|max_length[32]'); $val->add_field('profile_fields.last_name', 'Last Name', 'trim|required|min_length[2]|max_length[32]'); if ($val->run()) { $update = \Auth::instance()->update_user($_POST['profile_fields']); if ($update) { // send success notification to browser \Notify::add(\Lang::line('settings.profile_updated'), 'success'); // unset $_POST so we are using the freshest profile data $_POST = NULL; } else { \Notify::add(\Lang::line('settings.profile_error'), 'error', 8000); } } } // decide what to prefill form values if (empty($_POST)) { $this->template->set_global('profile_fields', \Auth::instance()->get_profile_fields(), false); } else { $this->template->set_global('profile_fields' , $_POST, false); } // set the default page title $this->template->set('page_title' , 'Dashboard :: Settings + Trucero'); // set the content view $this->template->set('content' , 'settings/user_settings'); }
$update = \Auth::instance()->update_user($_POST['profile_fields']);
$user_data['email'] = $val->validated('email'); $user_data['old_password'] = $val->validated('old_password'); $user_data['password'] = $val->validated('new_password'); if(Auth::instance()->update_user($user_data)) { // To something }
It looks like you're new here. If you want to get involved, click one of these buttons!