Hello @dannys1899
You can add custom validation for your field if built in validation does not meet your requirement. Please check this documentation on how to add custom validation.
Hi, I’ve already tried it and it doesn’t work. I contacted the developer to see if he has a solution since he works with Ultimate member.
If you have any other plugins that I can try I would appreciate it.
@dannys1899
I’m using the “International Telephone Input With Flags And Dial Codes” on one of my sites. What’s your issue with the plugin?
You can look at this thread where there are CSS changes for the plugin you can use:
https://wordpress.org/support/topic/issue-when-using-mobile-field-as-username/
Hello, the problem is that it does not show the list with flags, I have already activated the plugins, I am using it for the form (Ultimate member).
Do you also use ultimate member? it will be that it is not compatible
My telephone field does not show the flags with the code.
https://mega.nz/file/IpkAmRDQ#tzJ7SxMKNnNJmeM0wud5YPgBLY7pn1hq2sAXtX1bodw
@dannys1899
You can try this code snippet which will make the mobile number field on your registration and profile page the HTML type=”tel” instead of type=”text”.
In addition you also get with this code snippet the mobile number keayboard instead of alfabetic on mobiles during registration and profile edit.
add_filter( "um_mobile_number_form_edit_field", "um_mobile_number_form_edit_field_tel", 10, 2 );
add_filter( "um_phone_number_form_edit_field", "um_mobile_number_form_edit_field_tel", 10, 2 );
function um_mobile_number_form_edit_field_tel( $output, $set_mode ) {
if( $set_mode == 'register' || $set_mode == 'profile' ) {
$output = str_replace( 'type="text"', 'type="tel"', $output );
}
return $output;
}
Update with “Profile page” in the code snippet.
Profile Page editing you must clear an old mobile number to get the country code displayed.
-
This reply was modified 3 years, 9 months ago by
missveronica.
-
This reply was modified 3 years, 9 months ago by
missveronica.
@dannys1899
You also need to make a CSS change.
Where you can change the padding of 40px for best result.
Add to WP Appearance -> Customize -> Additional CSS:
.um .um-form input[type=tel] {
padding: 0 40px !important;
width: 100%;
display: block !important;
-moz-border-radius: 2px;
-webkit-border-radius: 2px;
border-radius: 2px;
outline: none !important;
cursor: text !important;
font-size: 15px !important;
height: 40px !important;
box-sizing: border-box !important;
box-shadow: none !important;
margin: 0 !important;
position: static;
outline: none !important;
}
@dannys1899
This code snippet will make the Mobile/Phone numbers clickable on mobiles ie so you can direct call the user number.
add_filter( 'um_view_field_value_text', 'my_custom_view_field_value', 10, 2 );
function my_custom_view_field_value( $res, $data ) {
if( $data['metakey'] == 'phone_number' || $data['metakey'] == 'mobile_number' ) {
if( !empty( $res )) {
$res = '<a href="tel:' . str_replace( array( '(', ')', '.', '-', ' ' ), '', $res ) . '">' . $res . '</a>';
}
}
return $res;
}
@dannys1899
These PHP code snippets will probably be obsolete when next UM version is released:
https://github.com/ultimatemember/ultimatemember/issues/988
The CSS update will still be required and is the integration of the plugin with UM.
-
This reply was modified 3 years, 9 months ago by
missveronica.
Hey there!
This thread has been inactive for a while so we’re going to go ahead and mark it Resolved.
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,