PluginProbe
User Profile Builder – Beautiful User Registration Forms, User Profiles & User Role Editor / 3.9.8
User Profile Builder – Beautiful User Registration Forms, User Profiles & User Role Editor v3.9.8
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 / forms / restricted-email-domains.php

restricted-email-domains.php in User Profile Builder – Beautiful User Registration Forms, User Profiles & User Role Editor 3.9.8, at admin/advanced-settings/includes/forms/restricted-email-domains.php

31 lines 957 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 function wppb_toolbox_check_email_domain( $message, $field, $request_data, $form_location ) {
4
5 $type = wppb_toolbox_get_settings( 'forms', 'restricted-email-domains-type' );
6
7 if ( $type == false ) return $message;
8
9 $restricted_domains = wppb_toolbox_get_settings( 'forms', 'restricted-email-domains-data' );
10
11 if ( $restricted_domains == false ) return $message;
12
13 $domain = strtolower( substr( strrchr( $request_data['email'], '@' ), 1 ) );
14 $validation_message = wppb_toolbox_get_settings( 'forms', 'restricted-email-domains-message' );
15
16 if ( $type == 'allow' ) {
17
18 if ( !in_array( $domain, $restricted_domains ) )
19 return $validation_message;
20
21 } else if ( $type == 'deny' ) {
22
23 if ( in_array( $domain, $restricted_domains ) )
24 return $validation_message;
25
26 }
27
28 return $message;
29 }
30 add_filter( 'wppb_check_form_field_default-e-mail', 'wppb_toolbox_check_email_domain', 20, 4 );
31