Hi @illuder,
To set username as a digit only, you will need to paste the following code in your active theme’s functions.php file.
Here is the code:
add_action( 'user_registration_validate_user_login','ur_validate_username_field',10,4);
function ur_validate_username_field($single_form_field, $data, $filter_hook, $form_id) {
$field_label = isset( $data->label ) ? $data->label : '';
$value = isset( $data->value ) ? $data->value : '';
if( 1 !== preg_match('~[0-9]~', $value ) ) {
add_filter( $filter_hook, function ( $msg ) use ( $field_label ) {
return __( $field_label . 'should contain a number.', 'user-registration' );
});
}
}
Do let me know whether it helps or not and I will get back to you.
Thanks and Regards!
apologies for the delayed response here. I only just noticed this reply.
I am still working on the project.
Whilst adding this mentioned code in my Kleo Theme for Buddypress function.php file, it gave me a serious error.
“There has been a critical error on your website.
Learn more about debugging in WordPress.”
http://my.lakewest.co.za/register