Hi @sircoca
Thanks for writing in,
As per the current version of the plugin, this feature is not available. However, we have added this to our request list and if feasible, we will work on this feature. Please let us know if you have any other questions.
Regards!
WPEverest Support
I found a way to do it with the function that I will leave below
add_action( 'user_registration_validate_text','ur_validate_text_field',10,4);
function ur_validate_text_field($single_form_field, $data, $filter_hook, $form_id) {
global $wpdb;
$field_label = isset( $data->label ) ? $data->label : '';
$value = isset( $data->value ) ? $data->value : '';
if( 'YOUR_FIELD_NAME' === $single_form_field->general_setting->field_name ) {
if(1 != empty($value)) {
$res = $wpdb->get_var("SELECT * from wp_users us join wp_usermeta um on um.user_id = us.ID
where um.meta_key = 'user_registration_YOUR_FIELD_NAME' and um.meta_value = $value");
if( count($res) > 0 ) {
add_filter( $filter_hook, function ( $msg ) use ( $field_label ) {
return __( $field_label . 'There is already a user with this number registered.', 'user-registration' );
});
}
}
}
if( 'YOUR_FIELD_NAME' === $single_form_field->general_setting->field_name ) {
if(1 != empty($value)) {
if( 1 != ctype_digit($value) ) {
add_filter( $filter_hook, function ( $msg ) use ( $field_label ) {
return __( $field_label . 'The number field can only contain numbers.', 'user-registration' );
});
}
}
}
}
Hi there,
Yes, this is the correct way to do it. Please let us know if you have any other questions.
Regards!