| @@ -17,13 +17,13 @@ | ||
| 17 | 17 | * |
| 18 | 18 | * @param array $data Submitted form data |
| 19 | 19 | * @param string $type Form type. |
| 20 | 20 | * @param array|bool $fields Fields applicable for validation. |
| 21 | - * @param string $extra_where Extra where query. | |
| 22 | 21 | * |
| 23 | 22 | * @return array|mixed|WP_Error Validated form data. |
| 24 | 23 | */ |
| 25 | - public function validate_fields( $data, $type, $fields = false, $extra_where = '' ) { | |
| 24 | + public function validate_fields($data, $type, $fields = false) { | |
| 25 | + | |
| 26 | 26 | $errors = new WP_Error(); |
| 27 | 27 | |
| 28 | 28 | $errors = apply_filters('uwp_validate_fields_before', $errors, $data, $type); |
| 29 | 29 | |
| @@ -44,9 +44,9 @@ | ||
| 44 | 44 | $fields = get_register_validate_form_fields($form_id); |
| 45 | 45 | } elseif ($type == 'change') { |
| 46 | 46 | $fields = get_change_validate_form_fields(); |
| 47 | 47 | } elseif ($type == 'account') { |
| 48 | - $fields = get_account_form_fields( $extra_where ); | |
| 48 | + $fields = get_account_form_fields(); | |
| 49 | 49 | } else { |
| 50 | 50 | $fields = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $table_name . " WHERE form_type = %s AND field_type != 'fieldset' AND field_type != 'file' AND is_active = '1' ORDER BY sort_order ASC", array($type))); |
| 51 | 51 | } |
| 52 | 52 | } |
| @@ -61,11 +61,11 @@ | ||
| 61 | 61 | |
| 62 | 62 | $enable_confirm_email_field = isset($email_extra['confirm_email']) ? $email_extra['confirm_email'] : '0'; |
| 63 | 63 | |
| 64 | 64 | $password_field = uwp_get_custom_field_info('password','account'); |
| 65 | - $enable_password = isset($data['password']) && !empty($password_field) && $password_field->is_active ? 1 : 0; | |
| 65 | + $enable_password = isset($data['password']) && $password_field->is_active ? 1 : 0; | |
| 66 | 66 | $password_extra = array(); |
| 67 | - if (!empty($password_field) && isset($password_field->extra_fields) && $password_field->extra_fields != '') { | |
| 67 | + if (isset($password_field->extra_fields) && $password_field->extra_fields != '') { | |
| 68 | 68 | $password_extra = unserialize($password_field->extra_fields); |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | $enable_confirm_password_field = isset($password_extra['confirm_password']) ? $password_extra['confirm_password'] : '0'; |
| @@ -181,23 +181,11 @@ | ||
| 181 | 181 | case 'editor': |
| 182 | 182 | $sanitized_value = wp_kses_post( strip_shortcodes( $value ) ); |
| 183 | 183 | break; |
| 184 | 184 | |
| 185 | - case 'url': | |
| 186 | - $sanitized_value = sanitize_url( wp_unslash( $value ) ); | |
| 187 | - break; | |
| 188 | - | |
| 189 | - case 'file': | |
| 190 | - $sanitized_value = sanitize_text_field( $value ); | |
| 191 | - | |
| 192 | - // Validate the file path. | |
| 193 | - if ( $sanitized_value && validate_file( $sanitized_value ) !== 0 ) { | |
| 194 | - $sanitized_value = ''; | |
| 195 | - } | |
| 196 | - break; | |
| 197 | - | |
| 198 | 185 | default: |
| 199 | 186 | $sanitized_value = sanitize_text_field($value); |
| 187 | + | |
| 200 | 188 | } |
| 201 | 189 | } |
| 202 | 190 | |
| 203 | 191 | if ($field->is_required == 1 && $sanitized_value == '' && $field->field_type != 'file') { |