Replies: 0
Hey,
so I’ve added a field called “machine_number” in the registration form & I’m validating the user input. Based on what number is provided, the user role changes.
Now I’m struggling with the approach to return a custom error in the registration form if no or an invalid number is entered and the form is sent.
I’ve found the hook “um_submit_form_error” for that but I’m not quite sure on how to use the function.
the function is as followed:
add_filter( 'um_submit_form_error', 'my_submit_form_error', 10, 2 );
function my_submit_form_error( $error, $key ) {
// 1. add a custom error string that says "Number xxx is not valid".
return $error;
}