Hello,
I’m using Ultimate Member 2.5.3 and International Telephone Input With Flags And Dial Codes 1.0.1 for international phone codes.
When the users are editing their profiles the “International Telephone Input With Flags And Dial Codes” plugin, adds prefixes to the telephone(s) input(s) with some dial code. For example +1 or +44.
If the telephone fields are not required and user updates hers/his profile, they are saved with just the dial code.
If the telephone fileds have a min value, even if they are not required, they’ll get an error message that the value is shorter etc.
I’m looking for a way to process the value before it is saved.
I’ve tried use the “um_account_pre_updating_profile_array” and “um_account_pre_update_profile” hooks but there’s nothing I could do.
add_action( 'um_account_pre_updating_profile_array', 'my_account_pre_update_profile', 10, 1 );
function my_account_pre_update_profile( $array ) {
if ( isset( $array['mobile_number'] ) && strlen( $array['mobile_number'] ) < 9 ) {
$array['mobile_number'] = '';
}
return $array;
}
Something like this doesn’t work. Will update the value with just +44.
How can I alter the values before update?