PluginProbe
UsersWP – Front-end login form, User Registration, User Profile & Members Directory plugin for WP / 1.2.32
UsersWP – Front-end login form, User Registration, User Profile & Members Directory plugin for WP v1.2.32
1.2.73 1.2.72 1.2.71 1.2.70 1.2.69 1.2.68 1.2.67 1.2.66 1.2.65 1.2.64 1.2.63 trunk 1.0.10 1.0.11 1.0.12 1.0.13 1.0.14 1.0.15 1.0.16 1.0.17 1.0.18 1.0.19 1.0.20 1.0.21 1.0.22 All 173 releases
← All changes | includes/class-validation.php +10 -22 1.2.671.2.32 View file →
@@ -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') {
@@ -243,13 +231,13 @@
243 231 if (username_exists($sanitized_value)) {
244 232 $errors->add('username_exists', __('<strong>Error</strong>: This username is already registered. Please choose another one.', 'userswp'));
245 233 return $errors;
246 234 }
247 - $username_length = uwp_get_option( 'register_username_length', 4);
248 - $username_length_max = uwp_get_option( 'register_username_length_max', 20);
235 + $username_length = uwp_get_option( 'register_username_length');
236 + $username_length = !empty($username_length) ? (int)$username_length : 4;
249 237
250 - if(!empty($sanitized_value) && (strlen($sanitized_value) < $username_length || strlen($sanitized_value) > $username_length_max)) {
251 - $errors->add('username_length', sprintf(__('<strong>Error</strong>: Username must be between %s and %s characters.', 'userswp'), $username_length, $username_length_max));
238 + if(!empty($sanitized_value) && strlen($sanitized_value) < $username_length) {
239 + $errors->add('username_length', sprintf(__('<strong>Error</strong>: Username must be %s characters or more.', 'userswp'), $username_length));
252 240 return $errors;
253 241 }
254 242 }
255 243