Working on the ical feed import
authorSteve Sutton <steve@gaslightmedia.com>
Tue, 25 Apr 2017 18:36:45 +0000 (14:36 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Tue, 25 Apr 2017 18:36:45 +0000 (14:36 -0400)
Working on getting the address fixed.
Working on the categories.

models/admin/management/events.php
models/front/events/icalFeedImport.php

index b9231d6..f069f3f 100644 (file)
@@ -210,6 +210,8 @@ class GlmMembersAdmin_management_events extends GlmDataEventsManagement
                 break;
 
             case 'icalfeed':
+                //echo '<pre>$_REQUEST: ' . print_r( $_REQUEST, true ) . '</pre>';
+                //exit;
                 if ( isset( $_REQUEST['option2'] ) ) {
                     $option2 = filter_var( $_REQUEST['option2'], FILTER_SANITIZE_STRING );
                 }
@@ -248,8 +250,11 @@ class GlmMembersAdmin_management_events extends GlmDataEventsManagement
                     if ( !wp_next_scheduled( GLM_MEMBERS_EVENTS_PLUGIN_CRON_EVENT, $feed_id ) ) {
                         wp_schedule_event( time(), GLM_MEMBERS_EVENTS_PLUGIN_CRON_RECURRANCE, GLM_MEMBERS_EVENTS_PLUGIN_CRON_EVENT, array( $feed_id ) );
                     }
+                } else {
+                    $icalFeedResult = 'Not a valid url';
                 }
 
+                $event_settings = $this->editEntry(1);
                 break;
 
             case 'eventImagesImport':
index 70e064d..45b2554 100644 (file)
@@ -287,11 +287,13 @@ class GlmMembersFront_events_icalFeedImport
                 // Location Data
                 if ( isset( $event['LOCATION'] ) ) {
                     $location_data = explode( ',', str_replace( '\\', '', $event['LOCATION'] ) );
-                    $place         = ( isset( $location_data[0] ) ? $location_data[0]: '');
-                    $address       = ( isset( $location_data[1] ) ? $location_data[1]: '');
-                    $city          = ( isset( $location_data[2] ) ? $location_data[2]: '');
-                    $state         = ( isset( $location_data[3] ) ? $location_data[3]: '');
-                    $zip           = ( isset( $location_data[4] ) ? $location_data[4]: '');
+                    // Place will be before the first dash
+                    $placeParts    = explode( ' - ', $location_data[0] );
+                    $place         = ( isset( $placeParts[0] ) ? $placeParts[0]: '');
+                    $address       = ( isset( $placeParts[1] ) ? $placeParts[1]: '');
+                    $city          = ( isset( $location_data[1] ) ? $location_data[1]: '');
+                    $state         = ( isset( $location_data[2] ) ? $location_data[2]: '');
+                    $zip           = ( isset( $location_data[3] ) ? $location_data[3]: '');
                     $location      = array(
                         'event'   => $event_id,
                         'name'    => $place,