Website Summary Files Commits Branches @commit @diff @stats
path: root / wp-content / plugins / dx-users / class.cm.php
diff options
context:
space:
mode:
Commit1f051aeb86fcf1134b3cbc658db41a835aeb1d52 (patch)
Author
 pgmatev <petargabriel.matev@gmail.com>
2020-07-10 16:36:47 +0300
Committer
 pgmatev <petargabriel.matev@gmail.com>
2020-07-10 16:36:47 +0300
Files739952bba2a4e0a0674c7d4a4822338c4531a2c2 /wp-content/plugins/dx-users/class.cm.php
tues-interns-2020-1f051aeb86fcf1134b3cbc658db41a835aeb1d52.tar
tues-interns-2020-1f051aeb86fcf1134b3cbc658db41a835aeb1d52.tar.gz
tues-interns-2020-1f051aeb86fcf1134b3cbc658db41a835aeb1d52.zip
Parent8fae47ee9fedc452113a1a270ad2746191504654 (diff)
fixed if error; STILL. NOT. UPDATING.
1 files changed, 24 insertions, 16 deletions
-rw-r--r--wp-content/plugins/dx-users/class.cm.php40
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 {
<?php }
- function validate_profile_phone( &$errors, $update, &$user ) {
+ function validate_profile_phone( $errors, $update, $user ) {
+ $error_check = false;
$phone_regex = "/08[789]\d{7}/u";
// validate input fields
- if ( !empty( $_POST['phone'] ) && strlen( $_POST['phone'] ) > 10)
+ if ( !empty( $_POST['phone'] ) && strlen( $_POST['phone'] ) > 10) {
$errors->add( 'phone', "<strong>ERROR</strong>: 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', "<strong>ERROR</strong>: 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', "<strong>ERROR</strong>: 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' ) );
}