From fb6ebffc85809be764789471b38085f8c0a5cc3d Mon Sep 17 00:00:00 2001 From: Steve Sutton Date: Thu, 14 Feb 2019 16:25:39 -0500 Subject: [PATCH] Update for billing city Add new billing city --- models/admin/contacts/index.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/models/admin/contacts/index.php b/models/admin/contacts/index.php index 01cd30d..6aac15e 100644 --- a/models/admin/contacts/index.php +++ b/models/admin/contacts/index.php @@ -872,6 +872,19 @@ class GlmMembersAdmin_contacts_index extends GlmDataContacts } } + if ($contactID && isset($_REQUEST['billing_city']) && $_REQUEST['billing_city'] == -1 && isset($_REQUEST['newBillingCityName']) && trim($_REQUEST['newBillingCityName']) != '') { + // Clean up city name + $cName = trim(filter_var($_REQUEST['newBillingCityName'])); + // Try to add the city + require_once GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataCities.php'; + $Cities = new GlmDataCities($this->wpdb, $this->config); + $cID = $Cities->addCity($cName); + // If we got a city id back + if (is_int($cID) && $cID > 0) { + // Update submitted city value to use the new ID + $_REQUEST['billing_city'] = $cID; + } + } } /* -- 2.17.1