Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Function to add your own data to the array being sent to FoxyCart when creating a new user
- function my_sso_user_update($foxy_data, $user_id, $act) {
- //This Will Only Run When Users Are Added
- if ($act == "add") {
- //This Will Only Run When Users Are Updated
- } elseif ($act == "update") {
- }
- //These Will Run Any Time And Are All The Fields that the FoxyCart Customer API Will Support
- if (isset($_POST['customer_first_name'])) $foxy_data['customer_first_name'] = $_POST['customer_first_name'];
- if (isset($_POST['customer_last_name'])) $foxy_data['customer_last_name'] = $_POST['customer_last_name'];
- if (isset($_POST['customer_address1'])) $foxy_data['customer_address1'] = $_POST['customer_address1'];
- if (isset($_POST['customer_address2'])) $foxy_data['customer_address2'] = $_POST['customer_address2'];
- if (isset($_POST['customer_city'])) $foxy_data['customer_city'] = $_POST['customer_city'];
- if (isset($_POST['customer_state'])) $foxy_data['customer_state'] = $_POST['customer_state'];
- if (isset($_POST['customer_postal_code'])) $foxy_data['customer_postal_code'] = $_POST['customer_postal_code'];
- if (isset($_POST['customer_country'])) $foxy_data['customer_country'] = $_POST['customer_country'];
- if (isset($_POST['customer_phone'])) $foxy_data['customer_phone'] = $_POST['customer_phone'];
- if (isset($_POST['shipping_first_name'])) $foxy_data['shipping_first_name'] = $_POST['shipping_first_name'];
- if (isset($_POST['shipping_last_name'])) $foxy_data['shipping_last_name'] = $_POST['shipping_last_name'];
- if (isset($_POST['shipping_address1'])) $foxy_data['shipping_address1'] = $_POST['shipping_address1'];
- if (isset($_POST['shipping_address2'])) $foxy_data['shipping_address2'] = $_POST['shipping_address2'];
- if (isset($_POST['shipping_city'])) $foxy_data['shipping_city'] = $_POST['shipping_city'];
- if (isset($_POST['shipping_state'])) $foxy_data['shipping_state'] = $_POST['shipping_state'];
- if (isset($_POST['shipping_postal_code'])) $foxy_data['shipping_postal_code'] = $_POST['shipping_postal_code'];
- if (isset($_POST['shipping_country'])) $foxy_data['shipping_country'] = $_POST['shipping_country'];
- if (isset($_POST['shipping_phone'])) $foxy_data['shipping_phone'] = $_POST['shipping_phone'];
- //If passing in CC numbers, your server should be secure
- if (isset($_POST['cc_number'])) $foxy_data['cc_number'] = $_POST['cc_number'];
- if (isset($_POST['cc_exp_month'])) $foxy_data['cc_exp_month'] = $_POST['cc_exp_month'];
- if (isset($_POST['cc_exp_year'])) $foxy_data['cc_exp_year'] = $_POST['cc_exp_year'];
- //Always return $foxy_data, even if nothing has been updated
- return $foxy_data;
- }
- add_filter('foxyshop_save_sso_to_foxycart', 'my_sso_user_update', 10, 3);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement