Hello,
I am currently using Theme My Login to change the look of my profile page. I have added a field in which needs validation and i'm wonding how to accomplish this. In my profile page I wrote this plugin code to modify the contact infomation.
add_filter('user_contactmethods','ba_profile_hide_profile_fields',10,1);
function ba_profile_hide_profile_fields( $contactmethods ) {
//remove instant message
unset($contactmethods['aim']);
unset($contactmethods['jabber']);
unset($contactmethods['yim']);
//add phone number
$contactmethods['Phone']= 'Phone Number(required)';
return $contactmethods;
}
Which removes the unwanted fields and adds the Phone meta field. My question is how do I validate that phone is a 10 digit phone number before updating the profile. I already have a custom profile_update function that inserts the profile data into an external database. Do I want to hook into this? If so how?
Also what's the best way to send an error back to WordPress if I have validation errors with the external database. For example, two of the same e-mail addresses, phone number, etc.
Thanks,
Brooke