*/
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
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;
}
}
+
}
/*