Q: is registration_errors not triggered ?
-
Hi !
I’m trying to filter email address at register (with the register shortcode) if it doesn’t match certain domain names extensions.
This seems to work fine on native register form,
// Block certain email user registration domain extension add_filter( 'registration_errors', 'myplugin_check_fields', 10, 3 ); function myplugin_check_fields( $errors, $sanitized_user_login, $user_email ) { $retval = preg_match( '/(.+)@(\S+)\.(\w+)/', $user_email, $matches ); $allowed = ["fr", "com", "net"]; if( $retval !== 1 || !isset($matches[3]) || !in_array($matches[3], $allowed ) ) { $errors->add( 'demo_error', __( '<strong>ERROR</strong>: User email domain extension not allowed.', 'my_textdomain' ) ); $errors->add_data( 'demo_error', __( '<strong>ERROR</strong>: User email domain extension not allowed.', 'my_textdomain' ) ); } return $errors; }(elaborated from https://codex.ww.wp.xz.cn/Plugin_API/Filter_Reference/registration_errors )
But not on the one generated by this plugin. It is as if the filter wasn’t triggered.
Is
registration_errors hooktriggered bu this plugin ?Thx for your support !
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
The topic ‘Q: is registration_errors not triggered ?’ is closed to new replies.