From cf1261ebf098dc0e644544ca2e57ceadfe51c476 Mon Sep 17 00:00:00 2001 From: pgmatev Date: Mon, 13 Jul 2020 19:03:33 +0300 Subject: fixed saving after validation; changed file names to match proposed naming --- wp-content/plugins/dx-users/class.cm.php | 108 ------------------------------- 1 file changed, 108 deletions(-) delete mode 100644 wp-content/plugins/dx-users/class.cm.php (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 deleted file mode 100644 index beb0b1c..0000000 --- a/wp-content/plugins/dx-users/class.cm.php +++ /dev/null @@ -1,108 +0,0 @@ - 'phone-number', - // 'label' => 'Phone number', - // ), - // array( - // 'service' => 'address', - // 'label' => 'Address', - // ), - // ); - - // foreach ( $new_methods as $method ) { - // if( ! isset( $contact_methods[$method['service']] ) ) { - // $contact_methods[$method['service']] = $method['label']; - // } - // } - - // return $contact_methods; - // } - function render_profile_fields( $user ) { ?> - -

More Information

- - - - - - - - - - -
-
-
-
-
- - 10) { - $errors->add( 'phone', "ERROR: The maximum phone length is 10 characters." ); - $error_check = true; - } - - if ( preg_match( $phone_regex, $_POST['phone'] ) == 0 ) { - $errors->add( 'phone', "ERROR: Not a valid phone number." ); - $error_check = true; - } - - if( $error_check ) { - error_log("shareni bomboni"); - return $errors; - } - - 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 ) { - $error_check = false; - // validate input fields - 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 - $error_check = true; - } - - 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' ) ); - - } - - function save_profile_fields( $id ) { - // save input fields values - if ( !current_user_can( 'edit_user', $id ) ) - return false; - - if ( isset( $_POST['phone'] ) ) - update_user_meta( $id, 'phone', $_POST['phone'] ); - - if ( isset( $_POST['address'] ) ) - update_user_meta( $id, 'address', $_POST['address'] ); - } -} \ No newline at end of file -- cgit v1.3.1-26-gb76a