From 1f051aeb86fcf1134b3cbc658db41a835aeb1d52 Mon Sep 17 00:00:00 2001 From: pgmatev Date: Fri, 10 Jul 2020 16:36:47 +0300 Subject: fixed if error; STILL. NOT. UPDATING. --- wp-content/plugins/dx-users/class.cm.php | 40 +++++++++++++++++++------------- 1 file changed, 24 insertions(+), 16 deletions(-) (limited to 'wp-content/plugins/dx-users/class.cm.php') diff --git a/wp-content/plugins/dx-users/class.cm.php b/wp-content/plugins/dx-users/class.cm.php index d0bd035..beb0b1c 100644 --- a/wp-content/plugins/dx-users/class.cm.php +++ b/wp-content/plugins/dx-users/class.cm.php @@ -52,37 +52,45 @@ class Users { 10) + if ( !empty( $_POST['phone'] ) && strlen( $_POST['phone'] ) > 10) { $errors->add( 'phone', "ERROR: The maximum phone length is 10 characters." ); + $error_check = true; + } - if ( preg_match( $phone_regex, $_POST['phone'] ) == 0 ) + if ( preg_match( $phone_regex, $_POST['phone'] ) == 0 ) { $errors->add( 'phone', "ERROR: Not a valid phone number." ); + $error_check = true; + } - if( !empty( $errors ) ) + if( $error_check ) { + error_log("shareni bomboni"); return $errors; - - if ( empty ( $errors ) ) { - add_action( 'edit_user_profile_update', array( $this, 'save_profile_fields' ) ); - add_action( 'personal_options_update', array( $this, 'save_profile_fields' ) ); } + error_log("shareni bomboni sled if"); + add_action( 'edit_user_profile_update', array( $this, 'save_profile_fields' ) ); + add_action( 'personal_options_update', array( $this, 'save_profile_fields' ) ); + } - function validate_profile_address( &$errors, $update, &$user ) { + function validate_profile_address( $errors, $update, $user ) { + $error_check = false; // validate input fields - if ( !empty( $_POST['address'] ) && strlen( $_POST['address'] ) > 255 && !empty( $_POST['address'] ) ) + if ( !empty( $_POST['address'] ) && strlen( $_POST['address'] ) > 255 ) { $errors->add( 'address', "ERROR: The maximum address length is 255 characters." ); //test validation; TO DO define proper validation - - if( !empty( $errors ) ) - return $errors; + $error_check = true; + } - if( empty( $errors ) ) { - add_action( 'edit_user_profile_update', array( $this, 'save_profile_fields' ) ); - add_action( 'personal_options_update', array( $this, 'save_profile_fields' ) ); + if( $error_check ){ + return $errors; } + + add_action( 'edit_user_profile_update', array( $this, 'save_profile_fields' ) ); + add_action( 'personal_options_update', array( $this, 'save_profile_fields' ) ); } -- cgit v1.3.1-26-gb76a