Hi @utkarshs
I’m not sure what you mean by testing against the Database. Are you trying to create your own validation before saving the input value to the db table?
Regards,
Yes, I want to save the input value if it’s present in database. Is it possible through ultimate member or if any other plugin you know about? FYI, I have built the registration and profile with ultimate member.
Hi @utkarshs
Unfortunately, this requires customization on your end.
Here’s a sample code that validate a specific field on form submission:
function um_custom_validate_english_name( $key, $array, $args ) {
if ( preg_match('/[^A-Za-z0-9]/', $args[$key] ) ) {
UM()->form()->add_error( $key, __( 'Please use only English letters.', 'ultimate-member' ) );
}
// add your custom validation
}
add_action( 'um_custom_field_validation_english_name', 'um_custom_validate_english_name', 30, 3 );
english_name
is the field key. You can change it with your field key. The following line will let you display an error when the field is invalid:
UM()->form()->add_error( $key, __( 'Please use only English letters.', 'ultimate-member' ) );
Regards,
Hi @utkarshs
..Please feel free to re-open this thread by changing the Topic Status to ‘Not Resolved’ if any other questions come up and we’d be happy to help. 🙂
Regards,