PluginProbe
User Profile Builder – Beautiful User Registration Forms, User Profiles & User Role Editor / 3.9.6
User Profile Builder – Beautiful User Registration Forms, User Profiles & User Role Editor v3.9.6
4.0.3 4.0.2 4.0.1 4.0.0 3.16.6 3.16.5 3.16.4 3.16.3 3.16.2 3.16.1 3.16.0 3.15.9 3.9.9 3.9.5 3.9.6 3.9.7 3.9.8 1.1.7 1.1.8 1.1.9 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 All 341 releases
profile-builder / admin / advanced-settings / includes / fields / restricted-words.php

restricted-words.php in User Profile Builder – Beautiful User Registration Forms, User Profiles & User Role Editor 3.9.6, at admin/advanced-settings/includes/fields/restricted-words.php

30 lines 976 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 $affected_fields = wppb_toolbox_get_settings( 'fields', 'restricted-words-fields' );
4
5 if ( $affected_fields != false ) {
6 foreach ( $affected_fields as $field )
7 add_filter( 'wppb_check_form_field_default-' . $field, 'wppb_toolbox_check_banned_words', 20, 4 );
8 }
9
10 function wppb_toolbox_check_banned_words( $message, $field, $request_data, $form_location ){
11 $meta_name = str_replace( 'wppb_check_form_field_default-', '', current_filter() );
12 $meta_name = str_replace( '-', '_', $meta_name );
13
14 if( empty( $request_data[ $meta_name ] ) ) return $message;
15
16 $banned_words = wppb_toolbox_get_settings( 'fields', 'restricted-words-data' );
17
18 if ( $banned_words == false ) return $message;
19
20 $validation_message = wppb_toolbox_get_settings( 'fields', 'restricted-words-message' );
21
22 foreach ( $banned_words as $banned ) {
23 if ( strpos( $request_data[ $meta_name ], $banned ) !== false) {
24 return $validation_message;
25 }
26 }
27
28 return $message;
29 }
30