From: Steve Sutton Date: Fri, 29 Jul 2016 12:11:22 +0000 (-0400) Subject: Check time.ly address for commas and only use first part. X-Git-Tag: v1.2.23^2 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=af986e7a7716e9d8e7b28d4defb1b1ba17709c7a;p=WP-Plugins%2Fglm-member-db-events.git Check time.ly address for commas and only use first part. If the address string for time.ly has commas then strip the rest out to use for the street. --- diff --git a/index.php b/index.php index c72ae2c..45b890b 100644 --- a/index.php +++ b/index.php @@ -3,7 +3,7 @@ * Plugin Name: GLM Members Database Events * Plugin URI: http://www.gaslightmedia.com/ * Description: Gaslight Media Members Database. - * Version: 1.2.22 + * Version: 1.2.23 * Author: Chuck Scott * Author URI: http://www.gaslightmedia.com/ * License: GPL2 @@ -20,7 +20,7 @@ * @package glmMembersDatabaseEventsAddOn * @author Chuck Scott * @license http://www.gaslightmedia.com Gaslightmedia - * @version 1.2.22 + * @version 1.2.23 */ /* @@ -38,7 +38,7 @@ * so that we're sure the other add-ons see an up to date * version from this plugin. */ -define('GLM_MEMBERS_EVENTS_PLUGIN_VERSION', '1.2.22'); +define('GLM_MEMBERS_EVENTS_PLUGIN_VERSION', '1.2.23'); define('GLM_MEMBERS_EVENTS_PLUGIN_DB_VERSION', '0.0.18'); // This is the minimum version of the GLM Members DB plugin require for this plugin. diff --git a/models/admin/management/events.php b/models/admin/management/events.php index 255ae0e..976b8bd 100644 --- a/models/admin/management/events.php +++ b/models/admin/management/events.php @@ -1129,7 +1129,7 @@ class GlmMembersAdmin_management_events extends GlmDataEventsManagement } public function importFromTimely() { $limit = 25; - $debug = false; + $debug = true; if ( isset( $_REQUEST['start'] ) ) { $start = filter_var( $_REQUEST['start'], FILTER_VALIDATE_INT ); } else { @@ -1166,7 +1166,7 @@ class GlmMembersAdmin_management_events extends GlmDataEventsManagement AND post_status = 'publish'"; //$sql .= " AND ID IN ( SELECT post_id FROM " . $this->wpdb->prefix . "ai1ec_events //WHERE end >= " . time() . " )"; - //$sql .= " AND ID IN ( 1647 )"; + $sql .= " AND ID IN ( 3785 )"; $sql .= " LIMIT $limit OFFSET $start"; $results = $this->wpdb->get_results( $sql, ARRAY_A ); @@ -1698,7 +1698,12 @@ class GlmMembersAdmin_management_events extends GlmDataEventsManagement $location_format[] = '%s'; } if ($event_data['address']) { - $location_data['address'] = $event_data['address']; + // test the address to see if there's commas + if ( strpos( $event_data['address'], ',' ) === false) { + $location_data['address'] = $event_data['address']; + } else { + $location_data['address'] = substr( $event_data['address'], 0, strpos( $event_data['address'], ',' ) ); + } $location_format[] = '%s'; } if ($event_data['city']) {