I was looking at the public phone validation for registering and such. This is in the Admin area making events, correct?
I just realized that the Admin event checking does NOT use the regex at all, as you said.
It may take me a bit of time to put out a version for that, but I can let you know what to comment out if you want so that it works for now!
In the file bookaroom-events.php, lines 1472 and 1481 are the phone validation.
if( !empty( $externals['publicPhone'] ) ) {
$cleanPhone = preg_replace( "/[^0-9]/", '', $externals['publicPhone'] );
if ( strlen( $cleanPhone ) == 11 ) {
$cleanPhone = preg_replace( "/^1/", '', $cleanPhone );
}
if( !is_numeric( $cleanPhone ) || strlen( $cleanPhone ) !== 10 ) {
$final[] = __( 'You must enter a valid contact phone number.', 'book-a-room' );
$errorBG['publicPhone'] = true;
}
}
If you add a # to the beginnings of lines 1478 and 1479, it shouldn’t throw an error. Your final should be:
if( !empty( $externals['publicPhone'] ) ) {
$cleanPhone = preg_replace( "/[^0-9]/", '', $externals['publicPhone'] );
if ( strlen( $cleanPhone ) == 11 ) {
$cleanPhone = preg_replace( "/^1/", '', $cleanPhone );
}
if( !is_numeric( $cleanPhone ) || strlen( $cleanPhone ) !== 10 ) {
#$final[] = __( 'You must enter a valid contact phone number.', 'book-a-room' );
#$errorBG['publicPhone'] = true;
}
}
Once I’ve redone the templates and converted everything over for translation (getting close), I’ll correct this validation to use the regex.