$user = User::find_one_by_id($this->user_id); $this->template->set_global('user', $user, false); if (Input::method() == 'POST') { $val = Validation::forge('user'); $val->add_callable('customvalidation'); $val->set_message('required', ':label is required.'); $val->set_message('unique', ':label is already in use. Please enter a unique :label.'); $val->add_field('first_name', 'First Name', 'required|max_length[255]'); $val->add_field('last_name', 'Last Name', 'required|max_length[255]'); $val->add_field('password', 'Password', 'min_length[3]|max_length[30]'); $val->add_field('email', 'Email', 'required|valid_email'); $val->add_field('skype', 'Skype', 'max_length[255]'); if($val->run()) { $updated_user = Auth::instance()->update_user( array( 'first_name' => $val->validated('first_name'), 'last_name' => $val->validated('last_name'), 'password' => $val->validated('password'), 'email' => $val->validated('email'), 'skype' => $val->validated('skype') ), $user->username ); Session::set_flash('notice', 'Profile updated'); Response::redirect('today'); } else { Session::set_flash('error', 'Error: Could not update profile'); $data['val_error'] = $val->error(); }
$val->add_callable('customvalidation'); $val->add_callable('Customvalidation');
It looks like you're new here. If you want to get involved, click one of these buttons!