Add phone number field in backoffice profile #75

Merged
bilal.catic merged 5 commits from add-phone-number-field-in-backoffice-profile into development 2018-11-22 13:24:42 +01:00
2 changed files with 4 additions and 5 deletions
Showing only changes of commit 8d954469ee - Show all commits

View File

@@ -9,18 +9,17 @@ class Wiaas_Admin_Profile {
}
function crf_user_profile_update_errors( $errors, $update, $user ) {
public static function crf_user_profile_update_errors( $errors, $update, $user ) {
$phone = $_POST['phone'];
if (!preg_match('/^[\d +]*$/', $phone)){
if (!WC_Validation::is_phone($phone)){
$errors->add('phone_error', __( '<strong>ERROR</strong>: Enter valid phone number.', 'crf' ));
};
}
function modify_user_contact_methods($user_contact){
public static function modify_user_contact_methods($user_contact){
$user_contact['phone'] = __( 'Phone number' );
return $user_contact;

View File

@@ -148,7 +148,7 @@ class Wiaas_REST_Customer_API {
return wiaas_api_notice('ADD_PHONE_NUMBER', 'error', Wiaas_Customer::get_customer_info($customer_id));
}
if (!preg_match('/^[\d +]*$/', $phone)){
if (!WC_Validation::is_phone($phone)){
return wiaas_api_notice('INVALID_PHONE_NUMBER', 'error', Wiaas_Customer::get_customer_info($customer_id));
};