Skip to content

Instantly share code, notes, and snippets.

@wp-user-manager
Last active April 12, 2021 17:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wp-user-manager/97b10e9a32ce7b4ca3d419ef8f14714c to your computer and use it in GitHub Desktop.
Save wp-user-manager/97b10e9a32ce7b4ca3d419ef8f14714c to your computer and use it in GitHub Desktop.
<?php
add_filter( 'submit_wpum_form_validate_fields', function ( $check, $fields, $values, $form_name ) {
foreach ( $fields as $group_key => $group_fields ) {
if ( ! isset( $values[ $group_key ]['user_email'] ) ) {
return $check;
}
if ( false !== strpos( $values[ $group_key ]['user_email'], 'mail.ru' ) ) {
return new WP_Error( 'validation-error', __( 'Email address domain not permitted', 'wp-user-manager' ) );
}
}
return $check;
}, 10, 4 );
@wp-user-manager
Copy link
Author

Save this file to your /wp-content/mu-plugins/ directory (you might need to create the mu-plugins directory).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment