From 87e30c871a88a8a07c3503a3d61c79502faa52d5 Mon Sep 17 00:00:00 2001 From: Steve Sutton Date: Thu, 14 Feb 2019 16:20:51 -0500 Subject: [PATCH] Update for the add new city for business_city Need to add new business_city --- models/admin/contacts/index.php | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/models/admin/contacts/index.php b/models/admin/contacts/index.php index d059439..01cd30d 100644 --- a/models/admin/contacts/index.php +++ b/models/admin/contacts/index.php @@ -829,21 +829,16 @@ class GlmMembersAdmin_contacts_index extends GlmDataContacts */ public function checkNewCities($contactID) { - // If we have a contact ID and this was a submission with a new city (id < 0) if ($contactID && isset($_REQUEST['city']) && $_REQUEST['city'] == -1 && isset($_REQUEST['newCityName']) && trim($_REQUEST['newCityName']) != '') { - // Clean up city name $cName = trim(filter_var($_REQUEST['newCityName'])); - // 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 the city selected for this contact record $sql = " UPDATE ".GLM_MEMBERS_CONTACTS_PLUGIN_DB_PREFIX."contacts @@ -851,12 +846,32 @@ class GlmMembersAdmin_contacts_index extends GlmDataContacts WHERE id = ".$contactID." ;"; $this->wpdb->query($sql); - // Update submitted city value to use the new ID $_REQUEST['city'] = $cID; + } + } + if ($contactID && isset($_REQUEST['business_city']) && $_REQUEST['business_city'] == -1 && isset($_REQUEST['newBusinessCityName']) && trim($_REQUEST['newBusinessCityName']) != '') { + // Clean up city name + $cName = trim(filter_var($_REQUEST['newBusinessCityName'])); + // 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 the city selected for this contact record + $sql = " + UPDATE ".GLM_MEMBERS_CONTACTS_PLUGIN_DB_PREFIX."contacts + SET business_city = $cID + WHERE id = ".$contactID." + ;"; + $this->wpdb->query($sql); + // Update submitted city value to use the new ID + $_REQUEST['business_city'] = $cID; } } + } /* -- 2.17.1