/** * validate_forms method, validates the input from the checkout page * @access public */ function validate_forms() { global $wpsc_cart, $wpdb, $current_user, $user_ID, $wpsc_gateway_error_messages, $wpsc_checkout_error_messages, $wpsc_customer_checkout_details, $wpsc_registration_error_messages; $any_bad_inputs = false; $bad_input_message = ''; $wpsc_gateway_error_messages = array(); $wpsc_checkout_error_messages = array(); $wpsc_registration_error_messages = array(); // Credit Card Number Validation for PayPal Pro and maybe others soon if (isset($_POST['card_number'])) { //should do some php CC validation here~ } else { $wpsc_gateway_error_messages['card_number'] = ''; } if (isset($_POST['card_number1']) && isset($_POST['card_number2']) && isset($_POST['card_number3']) && isset($_POST['card_number4'])) { if ($_POST['card_number1'] != '' && $_POST['card_number2'] != '' && $_POST['card_number3'] != '' && $_POST['card_number4'] != '' && is_numeric($_POST['card_number1']) && is_numeric($_POST['card_number2']) && is_numeric($_POST['card_number3']) && is_numeric($_POST['card_number4'])) { $wpsc_gateway_error_messages['card_number'] = ''; } else { $any_bad_inputs = true; $bad_input = true; $wpsc_gateway_error_messages['card_number'] = __('Please enter a valid credit card number.', 'wp-e-commerce'); $wpsc_customer_checkout_details['card_number'] = ''; } } if (isset($_POST['expiry'])) { if (!empty($_POST['expiry']['month']) && !empty($_POST['expiry']['month']) && is_numeric($_POST['expiry']['month']) && is_numeric($_POST['expiry']['year'])) { $wpsc_gateway_error_messages['expdate'] = ''; } else { $any_bad_inputs = true; $bad_input = true; $wpsc_gateway_error_messages['expdate'] = __('Please enter a valid expiry date.', 'wp-e-commerce'); $wpsc_customer_checkout_details['expdate'] = ''; } } if (isset($_POST['card_code'])) { if (empty($_POST['card_code']) || !is_numeric($_POST['card_code'])) { $any_bad_inputs = true; $bad_input = true; $wpsc_gateway_error_messages['card_code'] = __('Please enter a valid CVV.', 'wp-e-commerce'); $wpsc_customer_checkout_details['card_code'] = ''; } else { $wpsc_gateway_error_messages['card_code'] = ''; } } if (isset($_POST['cctype'])) { if ($_POST['cctype'] == '') { $any_bad_inputs = true; $bad_input = true; $wpsc_gateway_error_messages['cctype'] = __('Please enter a valid CVV.', 'wp-e-commerce'); $wpsc_customer_checkout_details['cctype'] = ''; } else { $wpsc_gateway_error_messages['cctype'] = ''; } } if (isset($_POST['log']) || isset($_POST['pwd']) || isset($_POST['user_email'])) { $results = wpsc_add_new_user($_POST['log'], $_POST['pwd'], $_POST['user_email']); if (is_callable(array($results, 'get_error_code')) && $results->get_error_code()) { foreach ($results->get_error_codes() as $code) { foreach ($results->get_error_messages($code) as $error) { $wpsc_registration_error_messages[] = $error; } $any_bad_inputs = true; } } if (property_exists($results, 'ID') && $results->ID > 0) { $our_user_id = $results->ID; } else { $any_bad_inputs = true; $our_user_id = ''; } } if (isset($our_user_id) && $our_user_id < 1) { $our_user_id = $user_ID; } // check we have a user id if (isset($our_user_id) && $our_user_id > 0) { $user_ID = $our_user_id; } //Basic Form field validation for billing and shipping details foreach ($this->checkout_items as $form_data) { $value = wpsc_get_customer_meta($form_data->unique_name); $wpsc_customer_checkout_details[$form_data->id] = $value; $bad_input = false; if ($form_data->mandatory == 1 || $form_data->type == 'coupon') { if ($form_data->unique_name == 'billingstate' && empty($value)) { $value = wpsc_get_customer_meta('billingregion'); if (empty($value)) { $any_bad_inputs = true; $bad_input = true; $country = new WPSC_Country(wpsc_get_customer_meta('billingcountry')); $name = $country->get('region_label'); } } else { if ($form_data->unique_name == 'shippingstate' && empty($value)) { $value = wpsc_get_customer_meta('shippingregion'); if (empty($value)) { $any_bad_inputs = true; $bad_input = true; $country = new WPSC_Country(wpsc_get_customer_meta('shippingcountry')); $name = $country->get('region_label'); } } else { $name = $form_data->name; switch ($form_data->type) { case 'email': if (!is_email($value)) { $any_bad_inputs = true; $bad_input = true; } break; case 'delivery_country': case 'country': if (empty($value)) { $any_bad_inputs = true; $bad_input = true; } break; case 'heading': break; case 'select': if ($value == '-1') { $any_bad_inputs = true; $bad_input = true; } break; default: if (empty($value)) { $any_bad_inputs = true; $bad_input = true; } break; } } } if ($bad_input === true) { $wpsc_checkout_error_messages[$form_data->id] = sprintf(__('Please enter a valid <span class="wpsc_error_msg_field_name">%s</span>.', 'wp-e-commerce'), strtolower(esc_attr($name))); $wpsc_customer_checkout_details[$form_data->id] = ''; } } } wpsc_update_customer_meta('checkout_error_messages', $wpsc_checkout_error_messages); wpsc_update_customer_meta('gateway_error_messages', $wpsc_gateway_error_messages); wpsc_update_customer_meta('registration_error_messages', $wpsc_registration_error_messages); $filtered_checkout_details = apply_filters('wpsc_update_customer_checkout_details', $wpsc_customer_checkout_details); // legacy filter if (is_user_logged_in()) { $filtered_checkout_details = apply_filters('wpsc_checkout_user_profile_update', $wpsc_customer_checkout_details, get_current_user_id()); } // Check if the shoppers location has changed _wpsc_has_visitor_location_changed(); $states = array('is_valid' => !$any_bad_inputs, 'error_messages' => $bad_input_message); $states = apply_filters('wpsc_checkout_form_validation', $states); return $states; }
/** * validate_forms method, validates the input from the checkout page * @access public */ function validate_forms() { global $wpsc_cart, $wpdb, $current_user, $user_ID, $wpsc_gateway_error_messages, $wpsc_checkout_error_messages, $wpsc_customer_checkout_details, $wpsc_registration_error_messages; $any_bad_inputs = false; $bad_input_message = ''; $wpsc_gateway_error_messages = array(); $wpsc_checkout_error_messages = array(); $wpsc_registration_error_messages = array(); // Credit Card Number Validation for PayPal Pro and maybe others soon if (isset($_POST['card_number'])) { //should do some php CC validation here~ } else { $wpsc_gateway_error_messages['card_number'] = ''; } if (isset($_POST['card_number1']) && isset($_POST['card_number2']) && isset($_POST['card_number3']) && isset($_POST['card_number4'])) { if ($_POST['card_number1'] != '' && $_POST['card_number2'] != '' && $_POST['card_number3'] != '' && $_POST['card_number4'] != '' && is_numeric($_POST['card_number1']) && is_numeric($_POST['card_number2']) && is_numeric($_POST['card_number3']) && is_numeric($_POST['card_number4'])) { $wpsc_gateway_error_messages['card_number'] = ''; } else { $any_bad_inputs = true; $bad_input = true; $wpsc_gateway_error_messages['card_number'] = __('Please enter a valid card number.', 'wpsc'); $wpsc_customer_checkout_details['card_number'] = ''; } } if (isset($_POST['expiry'])) { if (!empty($_POST['expiry']['month']) && !empty($_POST['expiry']['month']) && is_numeric($_POST['expiry']['month']) && is_numeric($_POST['expiry']['year'])) { $wpsc_gateway_error_messages['expdate'] = ''; } else { $any_bad_inputs = true; $bad_input = true; $wpsc_gateway_error_messages['expdate'] = __('Please enter a valid expiry date.', 'wpsc'); $wpsc_customer_checkout_details['expdate'] = ''; } } if (isset($_POST['card_code'])) { if (empty($_POST['card_code']) || !is_numeric($_POST['card_code'])) { $any_bad_inputs = true; $bad_input = true; $wpsc_gateway_error_messages['card_code'] = __('Please enter a valid CVV.', 'wpsc'); $wpsc_customer_checkout_details['card_code'] = ''; } else { $wpsc_gateway_error_messages['card_code'] = ''; } } if (isset($_POST['cctype'])) { if ($_POST['cctype'] == '') { $any_bad_inputs = true; $bad_input = true; $wpsc_gateway_error_messages['cctype'] = __('Please enter a valid CVV.', 'wpsc'); $wpsc_customer_checkout_details['cctype'] = ''; } else { $wpsc_gateway_error_messages['cctype'] = ''; } } if (isset($_POST['log']) || isset($_POST['pwd']) || isset($_POST['user_email'])) { $results = wpsc_add_new_user($_POST['log'], $_POST['pwd'], $_POST['user_email']); if (is_callable(array($results, "get_error_code")) && $results->get_error_code()) { foreach ($results->get_error_codes() as $code) { foreach ($results->get_error_messages($code) as $error) { $wpsc_registration_error_messages[] = $error; } $any_bad_inputs = true; } } if ($results->ID > 0) { $our_user_id = $results->ID; } else { $any_bad_inputs = true; $our_user_id = ''; } } if (isset($our_user_id) && $our_user_id < 1) { $our_user_id = $user_ID; } // check we have a user id if (isset($our_user_id) && $our_user_id > 0) { $user_ID = $our_user_id; } $location_changed = false; //Basic Form field validation for billing and shipping details foreach ($this->checkout_items as $form_data) { $value = ''; if (isset($_POST['collected_data'][$form_data->id])) { $value = stripslashes_deep($_POST['collected_data'][$form_data->id]); } $wpsc_customer_checkout_details[$form_data->id] = $value; $bad_input = false; if ($form_data->mandatory == 1 || $form_data->type == "coupon") { // dirty hack if ($form_data->unique_name == 'billingstate' && empty($value)) { $billing_country_id = $wpdb->get_var("SELECT `" . WPSC_TABLE_CHECKOUT_FORMS . "`.`id` FROM `" . WPSC_TABLE_CHECKOUT_FORMS . "` WHERE `unique_name` = 'billingcountry' AND active = '1' "); $value = $_POST['collected_data'][$billing_country_id][1]; } switch ($form_data->type) { case "email": if (!preg_match("/^[a-zA-Z0-9._-]+@[a-zA-Z0-9-.]+\\.[a-zA-Z]{2,5}\$/", $value)) { $any_bad_inputs = true; $bad_input = true; } break; case "delivery_country": case "country": case "heading": break; case "select": if ($value == '-1') { $any_bad_inputs = true; $bad_input = true; } break; default: if ($value == null) { $any_bad_inputs = true; $bad_input = true; } break; } if ($bad_input === true) { $wpsc_checkout_error_messages[$form_data->id] = sprintf(__('Please enter a valid <span class="wpsc_error_msg_field_name">%s</span>.', 'wpsc'), esc_attr($form_data->name)); $wpsc_customer_checkout_details[$form_data->id] = ''; } } if (!$bad_input) { if ($form_data->unique_name == 'shippingstate') { $shipping_country_field_id = wpsc_get_country_form_id_by_type('delivery_country'); $shipping_country = $_POST['collected_data'][$shipping_country_field_id]; if (!is_array($shipping_country) || !isset($shipping_country[1])) { wpsc_update_customer_meta('billing_region', $value); $location_changed = true; } } elseif ($form_data->unique_name == 'billingstate') { $billing_country_field_id = wpsc_get_country_form_id_by_type('country'); $billing_country = $_POST['collected_data'][$billing_country_field_id]; if (!is_array($billing_country) || !isset($billing_country[1])) { wpsc_update_customer_meta('billing_region', $value); $location_changed = true; } } } } wpsc_update_customer_meta('checkout_error_messages', $wpsc_checkout_error_messages); wpsc_update_customer_meta('gateway_error_messages', $wpsc_gateway_error_messages); wpsc_update_customer_meta('registration_error_messages', $wpsc_registration_error_messages); $filtered_checkout_details = apply_filters('wpsc_update_customer_checkout_details', $wpsc_customer_checkout_details); // legacy filter if (is_user_logged_in()) { $filtered_checkout_details = apply_filters('wpsc_checkout_user_profile_update', $wpsc_customer_checkout_details, get_current_user_id()); } wpsc_update_customer_meta('checkout_details', $filtered_checkout_details); if ($location_changed) { $wpsc_cart->update_location(); } $states = array('is_valid' => !$any_bad_inputs, 'error_messages' => $bad_input_message); $states = apply_filters('wpsc_checkout_form_validation', $states); return $states; }
/** * validate_forms method, validates the input from the checkout page * @access public */ function validate_forms() { global $wpdb, $current_user, $user_ID; $any_bad_inputs = false; $bad_input_message = ''; // Credit Card Number Validation for PayPal Pro and maybe others soon if (isset($_POST['card_number'])) { //should do some php CC validation here~ } else { $_SESSION['wpsc_gateway_error_messages']['card_number'] = ''; } if (isset($_POST['card_number1']) && isset($_POST['card_number2']) && isset($_POST['card_number3']) && isset($_POST['card_number4'])) { if ($_POST['card_number1'] != '' && $_POST['card_number2'] != '' && $_POST['card_number3'] != '' && $_POST['card_number4'] != '' && is_numeric($_POST['card_number1']) && is_numeric($_POST['card_number2']) && is_numeric($_POST['card_number3']) && is_numeric($_POST['card_number4'])) { $_SESSION['wpsc_gateway_error_messages']['card_number'] = ''; } else { $any_bad_inputs = true; $bad_input = true; $_SESSION['wpsc_gateway_error_messages']['card_number'] = __('Please enter a valid card number.', 'wpsc'); $_SESSION['wpsc_checkout_saved_values']['card_number'] = ''; } } if (isset($_POST['expiry'])) { if (!empty($_POST['expiry']['month']) && !empty($_POST['expiry']['month']) && is_numeric($_POST['expiry']['month']) && is_numeric($_POST['expiry']['year'])) { $_SESSION['wpsc_gateway_error_messages']['expdate'] = ''; } else { $any_bad_inputs = true; $bad_input = true; $_SESSION['wpsc_gateway_error_messages']['expdate'] = __('Please enter a valid expiry date.', 'wpsc'); $_SESSION['wpsc_checkout_saved_values']['expdate'] = ''; } } if (isset($_POST['card_code'])) { if (empty($_POST['card_code']) || !is_numeric($_POST['card_code'])) { $any_bad_inputs = true; $bad_input = true; $_SESSION['wpsc_gateway_error_messages']['card_code'] = __('Please enter a valid CVV.', 'wpsc'); $_SESSION['wpsc_checkout_saved_values']['card_code'] = ''; } else { $_SESSION['wpsc_gateway_error_messages']['card_code'] = ''; } } if (isset($_POST['cctype'])) { if ($_POST['cctype'] == '') { $any_bad_inputs = true; $bad_input = true; $_SESSION['wpsc_gateway_error_messages']['cctype'] = __('Please enter a valid CVV.', 'wpsc'); $_SESSION['wpsc_checkout_saved_values']['cctype'] = ''; } else { $_SESSION['wpsc_gateway_error_messages']['cctype'] = ''; } } if (isset($_POST['log']) || isset($_POST['pwd']) || isset($_POST['user_email'])) { $results = wpsc_add_new_user($_POST['log'], $_POST['pwd'], $_POST['user_email']); $_SESSION['wpsc_checkout_user_error_messages'] = array(); if (is_callable(array($results, "get_error_code")) && $results->get_error_code()) { foreach ($results->get_error_codes() as $code) { foreach ($results->get_error_messages($code) as $error) { $_SESSION['wpsc_checkout_user_error_messages'][] = $error; } $any_bad_inputs = true; } } if ($results->ID > 0) { $our_user_id = $results->ID; } else { $any_bad_inputs = true; $our_user_id = ''; } } if (isset($our_user_id) && $our_user_id < 1) { $our_user_id = $user_ID; } // check we have a user id if (isset($our_user_id) && $our_user_id > 0) { $user_ID = $our_user_id; } //Basic Form field validation for billing and shipping details foreach ($this->checkout_items as $form_data) { $value = ''; if (isset($_POST['collected_data'][$form_data->id])) { $value = $_POST['collected_data'][$form_data->id]; } $_SESSION['wpsc_checkout_saved_values'][$form_data->id] = $value; $bad_input = false; if ($form_data->mandatory == 1 || $form_data->type == "coupon") { switch ($form_data->type) { case "email": if (!preg_match("/^[a-zA-Z0-9._-]+@[a-zA-Z0-9-.]+\\.[a-zA-Z]{2,5}\$/", $value)) { $any_bad_inputs = true; $bad_input = true; } break; case "delivery_country": case "country": case "heading": break; case "select": if ($value == '-1') { $any_bad_inputs = true; $bad_input = true; } break; default: if ($value == null) { $any_bad_inputs = true; $bad_input = true; } break; } if ($bad_input === true) { $_SESSION['wpsc_checkout_error_messages'][$form_data->id] = sprintf(__('Please enter a valid <span class="wpsc_error_msg_field_name">%s</span>.', 'wpsc'), esc_attr($form_data->name)); $_SESSION['wpsc_checkout_saved_values'][$form_data->id] = ''; } } } if ($any_bad_inputs == false && $user_ID > 0) { update_user_meta($user_ID, 'wpshpcrt_usr_profile', $_POST['collected_data']); } $states = array('is_valid' => !$any_bad_inputs, 'error_messages' => $bad_input_message); $states = apply_filters('wpsc_checkout_form_validation', $states); return $states; }
/** * validate_forms method, validates the input from the checkout page * @access public */ function validate_forms() { global $wpdb, $current_user, $user_ID; $any_bad_inputs = false; // Credit Card Number Validation for Paypal Pro and maybe others soon if (wpsc_cart_total(false) != 0) { if (isset($_POST['card_number'])) { if ($_POST['card_number'] != '') { /* $ccregex='/^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|6(?:011|5[0-9][0-9])[0-9]{12}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|(?:2131|1800|35\d{3})\d{11})$/'; if(!preg_match($ccregex, $_POST['card_number'])){ $any_bad_inputs = true; $bad_input = true; $_SESSION['wpsc_gateway_error_messages']['card_number'] = __('Please enter a valid', 'wpsc') . " " . strtolower('card number') . "."; $_SESSION['wpsc_checkout_saved_values']['card_number'] = ''; }else{ $_SESSION['wpsc_gateway_error_messages']['card_number'] = ''; } */ } else { $any_bad_inputs = true; $bad_input = true; $_SESSION['wpsc_gateway_error_messages']['card_number'] = __('Please enter a valid', 'wpsc') . " " . strtolower('card number') . "."; $_SESSION['wpsc_checkout_saved_values']['card_number'] = ''; } } else { $_SESSION['wpsc_gateway_error_messages']['card_number'] = ''; } if (isset($_POST['card_number1']) && isset($_POST['card_number2']) && isset($_POST['card_number3']) && isset($_POST['card_number4'])) { if ($_POST['card_number1'] != '' && $_POST['card_number2'] != '' && $_POST['card_number3'] != '' && $_POST['card_number4'] != '' && is_numeric($_POST['card_number1']) && is_numeric($_POST['card_number2']) && is_numeric($_POST['card_number3']) && is_numeric($_POST['card_number4'])) { $_SESSION['wpsc_gateway_error_messages']['card_number'] = ''; } else { $any_bad_inputs = true; $bad_input = true; $_SESSION['wpsc_gateway_error_messages']['card_number'] = __('Please enter a valid', 'wpsc') . " " . strtolower('card number') . "."; $_SESSION['wpsc_checkout_saved_values']['card_number'] = ''; } } if (isset($_POST['expiry'])) { if ($_POST['expiry']['month'] != '' && $_POST['expiry']['month'] != '' && is_numeric($_POST['expiry']['month']) && is_numeric($_POST['expiry']['year'])) { $_SESSION['wpsc_gateway_error_messages']['expdate'] = ''; } else { $any_bad_inputs = true; $bad_input = true; $_SESSION['wpsc_gateway_error_messages']['expdate'] = __('Please enter a valid', 'wpsc') . " " . strtolower('Expiry Date') . "."; $_SESSION['wpsc_checkout_saved_values']['expdate'] = ''; } } if (isset($_POST['card_code'])) { if ($_POST['card_code'] == '' || !is_numeric($_POST['card_code'])) { $any_bad_inputs = true; $bad_input = true; $_SESSION['wpsc_gateway_error_messages']['card_code'] = __('Please enter a valid', 'wpsc') . " " . strtolower('CVV') . "."; $_SESSION['wpsc_checkout_saved_values']['card_code'] = ''; } else { $_SESSION['wpsc_gateway_error_messages']['card_code'] = ''; } } if (isset($_POST['cctype'])) { if ($_POST['cctype'] == '') { $any_bad_inputs = true; $bad_input = true; $_SESSION['wpsc_gateway_error_messages']['cctype'] = __('Please enter a valid', 'wpsc') . " " . strtolower('CVV') . "."; $_SESSION['wpsc_checkout_saved_values']['cctype'] = ''; } else { $_SESSION['wpsc_gateway_error_messages']['cctype'] = ''; } } } //closes main bracket if (isset($_POST['log']) || isset($_POST['pwd']) || isset($_POST['user_email'])) { $results = wpsc_add_new_user($_POST['log'], $_POST['pwd'], $_POST['user_email']); $_SESSION['wpsc_checkout_user_error_messages'] = array(); if (is_callable(array($results, "get_error_code")) && $results->get_error_code()) { foreach ($results->get_error_codes() as $code) { foreach ($results->get_error_messages($code) as $error) { $_SESSION['wpsc_checkout_user_error_messages'][] = $error; } $any_bad_inputs = true; } } //exit('<pre>'.print_r($results, true).'</pre>'); if ($results->ID > 0) { $our_user_id = $results->ID; } else { $any_bad_inputs = true; } } if ($our_user_id < 1) { $our_user_id = $user_ID; } // check we have a user id if ($our_user_id > 0) { $user_ID = $our_user_id; } //exit('<pre>'.print_r($_POST['collected_data'],true).'</pre>'); //Basic Form field validation for billing and shipping details foreach ($this->checkout_items as $form_data) { $value = $_POST['collected_data'][$form_data->id]; $value_id = (int) $value_id; $_SESSION['wpsc_checkout_saved_values'][$form_data->id] = $value; $bad_input = false; if ($form_data->mandatory == 1 || $form_data->type == "coupon") { switch ($form_data->type) { case "email": if (!preg_match("/^[a-zA-Z0-9._-]+@[a-zA-Z0-9-.]+\\.[a-zA-Z]{2,5}\$/", $value)) { $any_bad_inputs = true; $bad_input = true; } break; case "delivery_country": case "country": case "heading": break; case "select": case 'checkbox': if (is_array($value)) { $select_bad_input = 0; foreach ($value as $v) { if ($v == '-1') { $select_bad_input++; } else { $valid_select_input++; } } if (count($value) == $select_bad_input) { $any_bad_inputs = true; $bad_input = true; } } else { if ($value == '-1') { $any_bad_inputs = true; $bad_input = true; } } break; default: if (is_array($value)) { $select_bad_input = 0; foreach ($value as $v) { if ($v == '') { $select_bad_input++; } else { $valid_select_input++; } } if (count($value) == $select_bad_input) { $any_bad_inputs = true; $bad_input = true; } } else { if ($value == '') { $any_bad_inputs = true; $bad_input = true; } } break; } if ($bad_input === true) { $_SESSION['wpsc_checkout_error_messages'][$form_data->id] = __('Please enter a valid', 'wpsc') . " " . strtolower($form_data->name) . "."; $_SESSION['wpsc_checkout_saved_values'][$form_data->id] = ''; } } } //exit('UserID >><pre>'.print_r($user_ID, true).'</pre>'); if ($any_bad_inputs == false && $user_ID > 0) { $saved_data_sql = "SELECT * FROM `" . $wpdb->usermeta . "` WHERE `user_id` = '" . $user_ID . "' AND `meta_key` = 'wpshpcrt_usr_profile';"; $saved_data = $wpdb->get_row($saved_data_sql, ARRAY_A); //echo "<pre>".print_r($meta_data,true)."</pre>"; $new_meta_data = serialize($_POST['collected_data']); if ($saved_data != null) { $sql = "UPDATE `" . $wpdb->usermeta . "` SET `meta_value` = '{$new_meta_data}' WHERE `user_id` IN ('{$user_ID}') AND `meta_key` IN ('wpshpcrt_usr_profile');"; $wpdb->query($sql); $changes_saved = true; //exit($sql); } else { $sql = "INSERT INTO `" . $wpdb->usermeta . "` ( `user_id` , `meta_key` , `meta_value` ) VALUES ( " . $user_ID . ", 'wpshpcrt_usr_profile', '{$new_meta_data}');"; $wpdb->query($sql); $changes_saved = true; //exit($sql); } } return array('is_valid' => !$any_bad_inputs, 'error_messages' => $bad_input_message); }