Showing error after validation fails
-
I’m trying to implement user validation for the registration process with google accounts.
I implemented a nsl_registration_user_data filter. If validation fails, I call $errors->add() according to the examples I saw in the docs.So it looks something like:
add_filter('nsl_registration_user_data', function($userData, $provider){ .... if ($userData['username'] == 'xxx') { $errors->add('invalid_username', '' . __('ERROR') . ':' . __('Registration failed: error description here.')); } return $userData; },10,2);
Once that’s implemented, it seems that once validation actually fails, the user sees a ‘page cannot be displayed’ page, which means that the server just returned a 500 error.
How can this be handled in a more UX friendly way? Is there a way to return to the previous page (my login page) and present an error? Is there a way to configure a redirect page and send the error as a parameter to that page?
Thank you for your support.
- The topic ‘Showing error after validation fails’ is closed to new replies.