/**
  * Check to make sure that the event data is saved properly.
  *
  */
 function test_tribe_create_event_template_tag_meta_information()
 {
     $post = get_post(tribe_create_event($this->postExampleSettings));
     $this->assertEquals(3, $post->post_author);
     $this->assertEquals('This is event content!', $post->post_content);
     $this->assertEquals('', get_post_meta($post->ID, '_EventAllDay', true));
     $this->assertEquals(1, get_post_meta($post->ID, '_EventHideFromUpcoming', true));
     $this->assertEquals(5, get_post_meta($post->ID, '_EventOrganizerID', true));
     $this->assertEquals(8, get_post_meta($post->ID, '_EventVenueID', true));
     $this->assertEquals(1, get_post_meta($post->ID, '_EventShowMapLink', true));
     $this->assertEquals(1, get_post_meta($post->ID, '_EventShowMapLink', true));
     $this->assertEquals(1, get_post_meta($post->ID, '_EventShowMap', true));
     $this->assertEquals('2012-01-03 15:25:00', get_post_meta($post->ID, '_EventEndDate', true));
 }
 /**
  * Ensure we have events with a range of different costs and also
  * some events where the cost is not defined.
  */
 public function setUp()
 {
     // This needs to come first so that the post_example_settings template is created
     parent::setUp();
     $costs = [null, '4,92', '4,999', '5', '5.99', '25', '100', '180.067', '3.00 8.00 125.95', '*&^$@#%@', '東京は都会です', '1995.95'];
     $iterations = 0;
     foreach ($costs as $event_cost) {
         $iterations++;
         $new_event = $this->post_example_settings;
         $new_event['post_title'] .= uniqid();
         $new_event['EventStartDate'] = date_i18n('Y-m-d', strtotime("+{$iterations} days"));
         if (null !== $event_cost) {
             $new_event['EventCost'] = $event_cost;
         }
         $this->test_events[] = [$event_cost, tribe_create_event($new_event)];
     }
 }
 /**
  * Imports the schedule.
  *
  * @access  public
  * @since   1.0.0
  */
 public function import_wordcamp_schedule()
 {
     global $wpdb;
     // There's no point if TEC doesn't exist
     if (!function_exists('tribe_create_event')) {
         return false;
     }
     // Get the schedule
     if (($response = wp_remote_get('https://central.wordcamp.org/wp-json/posts?type=wordcamp&filter[posts_per_page]=30')) && ($body = wp_remote_retrieve_body($response)) && ($schedule = json_decode($body))) {
         // Get current WordCamp IDs so we don't duplicate events
         $wordcamp_ids = $wpdb->get_col("SELECT meta.meta_value FROM {$wpdb->postmeta} meta INNER JOIN {$wpdb->posts} posts ON posts.ID = meta.post_id AND posts.post_type = 'tribe_events' WHERE meta.meta_key = '_wordcamp_id'");
         // Set datetime format
         $date_format = 'Y-m-d';
         // H:i:s';
         foreach ($schedule as $event) {
             // Get post ID
             $event_post_id = in_array($event->ID, $wordcamp_ids) ? $wpdb->get_var("SELECT post_id FROM {$wpdb->postmeta} WHERE meta_key = '_wordcamp_id' AND meta_value = '{$event->ID}'") : false;
             // Setup event args
             $event_args = array('post_title' => $event->title, 'post_content' => $event->content, 'post_status' => 'publish', 'EventAllDay' => true, 'EventTimezone' => $event->date_tz);
             // Set timezone
             $event_timezone = new DateTimeZone($event->date_tz);
             // Will hold venue info
             $event_venue = array();
             // Process all the meta
             foreach ($event->post_meta as $meta) {
                 // Get meta value
                 $meta_value = $meta->value;
                 // Get start date
                 if (preg_match('/^Start\\sDate/i', $meta->key)) {
                     // We must have a value
                     if ($meta_value) {
                         // Create DateTime
                         $start_date = new DateTime(date('Y-m-d', $meta_value), $event_timezone);
                         // Store for event
                         $event_args['EventStartDate'] = $start_date->format($date_format);
                     } else {
                         // Change status to draft since no start date
                         $event_args['post_status'] = 'draft';
                         // No start date
                         $event_args['EventStartDate'] = null;
                     }
                 } else {
                     if (preg_match('/^End\\sDate/i', $meta->key)) {
                         // We must have a value
                         if ($meta_value) {
                             // Create DateTime
                             $end_date = new DateTime(date('Y-m-d', $meta_value), $event_timezone);
                             // Store for event
                             $event_args['EventEndDate'] = $end_date->format($date_format);
                         }
                     } else {
                         if ($meta_value) {
                             switch ($meta->key) {
                                 case 'URL':
                                     $event_args['_EventURL'] = $meta_value;
                                     break;
                                 case 'Venue Name':
                                     $event_venue['Venue'] = $meta_value;
                                     break;
                             }
                         }
                     }
                 }
             }
             // If we have event info
             if (!empty($event_venue)) {
                 $event_args['Venue'] = $event_venue;
             }
             // If we have event info...
             if (!empty($event_args)) {
                 // Make sure we have an end date
                 if (!$event_args['EventEndDate']) {
                     $event_args['EventEndDate'] = $event_args['EventStartDate'];
                 }
                 // Update the event
                 if (in_array($event->ID, $wordcamp_ids)) {
                     // Update the event
                     if ($event_post_id > 0) {
                         // @TODO Don't update the post content
                         // until I figure out how to not override changes
                         unset($event_args['post_content']);
                         tribe_update_event($event_post_id, $event_args);
                     }
                 } else {
                     if ($event_post_id = tribe_create_event($event_args)) {
                         // Store the WordCamp ID
                         if ($event_post_id > 0) {
                             add_post_meta($event_post_id, '_wordcamp_id', $event->ID, true);
                         }
                     }
                 }
                 // Make sure the category is set
                 if ($event_post_id > 0) {
                     wp_set_object_terms($event_post_id, 'wordcamps', 'tribe_events_cat', true);
                 }
             }
         }
     }
 }
function fbes_send_events($events)
{
    $eids = array();
    $query = new WP_Query(array('post_type' => 'tribe_events', 'posts_per_page' => '-1'));
    foreach ($query->posts as $post) {
        if (!empty($post->to_ping)) {
            $segments = fbes_segments($post->to_ping);
            $eid = array_pop($segments);
            $eids[$eid] = $post->ID;
        }
        //if you're reading this and you want to delete all those duplicate events, uncomment this temporarially. Note, it will also delete all manually made events since June 13
        //http://codex.wordpress.org/Version_3.4 - June 13, 2012
        //depending on many duplicates you had, you might end up re-loading this script a bunch of times after it times out. Me, I had 14k duplicates. Had to run the script like 10 times.
        /*
        		else {
        			$post_date = trim(substr($post->post_date, 0, 10));
        			if($post->post_date > '2012-06-12')
        				wp_delete_post($post->ID);
        		}
        */
    }
    //file_put_contents($_SERVER['DOCUMENT_ROOT'].'/fbevent.log', print_r(array(time(),$events,$eids),1)."\n".str_repeat('=',40)."\n", FILE_APPEND);
    foreach ($events as $event) {
        $args['post_title'] = $event['name'];
        $offset = get_option('gmt_offset') * 3600;
        $offsetStart = $event['start_time'] + $offset;
        $offsetEnd = $event['end_time'] + $offset;
        //don't update or insert events from the past.
        if ($offsetStart > time()) {
            $args['EventStartDate'] = date("Y-m-d", $offsetStart);
            $args['EventStartHour'] = date("H", $offsetStart);
            $args['EventStartMinute'] = date("i", $offsetStart);
            $args['EventEndDate'] = date("Y-m-d", $offsetEnd);
            $args['EventEndHour'] = date("H", $offsetEnd);
            $args['EventEndMinute'] = date("i", $offsetEnd);
            $args['post_content'] = $event['description'];
            $args['Venue']['Venue'] = $event['location'];
            $args['post_status'] = "Publish";
            $args['post_type'] = "tribe_events";
            //$args['to_ping'] = $event['eid']; //damn you, sanitize_trackback_urls in 3.4
            $args['to_ping'] = 'https://www.facebook.com/events/' . $event['id'] . '/';
            $inserting = $post_id = false;
            if (!array_key_exists($event['id'], $eids)) {
                //double check
                $already_exists = false;
                foreach ($query->posts as $post) {
                    if ($post->to_ping == $args['to_ping'] || trim($post->pinged) == $args['to_ping']) {
                        $already_exists = true;
                    }
                }
                if (!$already_exists) {
                    file_put_contents($_SERVER['DOCUMENT_ROOT'] . '/fbevent.log', print_r(array(time(), 'creating', $args, $eids, $query->posts), 1) . "\n" . str_repeat('=', 40) . "\n", FILE_APPEND);
                    $post_id = tribe_create_event($args);
                    echo "<br />Inserting: " . $post_id;
                    $inserting = true;
                }
            }
            if (!$inserting) {
                $post_id = $eids[$event['id']];
                echo "{$post_id}";
                tribe_update_event($post_id, $args);
                echo "<br />Updating: " . $eids[$event['id']];
            }
            if ($post_id) {
                update_metadata('post', $post_id, 'fb_event_obj', $event);
            }
            //eid, name, start_time, end_time, location, description
        }
        if ($eids) {
            reset($eids);
        }
    }
}
Пример #5
0
 /**
  * Inserts events, venues, and organizers for the Import Record
  *
  * @param array $data Dummy data var to allow children to optionally react to passed in data
  *
  * @return array|WP_Error
  */
 public function insert_posts($items = array())
 {
     add_filter('tribe-post-origin', array(Tribe__Events__Aggregator__Records::instance(), 'filter_post_origin'), 10);
     // Creates an Activity to log what Happened
     $activity = new Tribe__Events__Aggregator__Record__Activity();
     $args = array('post_status' => $this->meta['post_status']);
     $unique_field = $this->get_unique_field();
     $existing_ids = $this->get_existing_ids_from_import_data($items);
     //cache
     $possible_parents = array();
     $found_organizers = array();
     $found_venues = array();
     //if we have no non recurring events the message may be different
     $non_recurring = false;
     $show_map_setting = Tribe__Events__Aggregator__Settings::instance()->default_map($this->meta['origin']);
     $update_authority_setting = Tribe__Events__Aggregator__Settings::instance()->default_update_authority($this->meta['origin']);
     $unique_inserted = array();
     foreach ($items as $item) {
         $event = Tribe__Events__Aggregator__Event::translate_service_data($item);
         // set the event ID if it can be set
         if ($unique_field && isset($event[$unique_field['target']]) && isset($existing_ids[$event[$unique_field['target']]])) {
             $event['ID'] = $existing_ids[$event[$unique_field['target']]]->post_id;
         }
         // only set the post status if there isn't an ID
         if (empty($event['ID'])) {
             $event['post_status'] = $args['post_status'];
         }
         /**
          * Should events that have previously been imported be overwritten?
          *
          * By default this is turned off (since it would reset the post status, description
          * and any other fields that have subsequently been edited) but it can be enabled
          * by returning true on this filter.
          *
          * @var bool $overwrite
          * @var int  $event_id
          */
         if (!empty($event['ID']) && 'retain' === $update_authority_setting) {
             // Log this Event was Skipped
             $activity->add('event', 'skipped', $event['ID']);
             continue;
         }
         if ($show_map_setting) {
             $event['EventShowMap'] = $show_map_setting;
             $event['EventShowMapLink'] = $show_map_setting;
         }
         if (empty($event['recurrence'])) {
             $non_recurring = true;
         }
         // set the parent
         if (!empty($event['ID']) && ($id = wp_get_post_parent_id($event['ID']))) {
             $event['post_parent'] = $id;
         } elseif (!empty($event['parent_uid']) && ($k = array_search($event['parent_uid'], $possible_parents))) {
             $event['post_parent'] = $k;
         }
         //if we should create a venue or use existing
         if (!empty($event['Venue']['Venue'])) {
             $v_id = array_search($event['Venue']['Venue'], $found_venues);
             if (false !== $v_id) {
                 $event['EventVenueID'] = $v_id;
             } elseif ($venue = get_page_by_title($event['Venue']['Venue'], 'OBJECT', Tribe__Events__Main::VENUE_POST_TYPE)) {
                 $found_venues[$venue->ID] = $event['Venue']['Venue'];
                 $event['EventVenueID'] = $venue->ID;
             } else {
                 $event['Venue']['ShowMap'] = $show_map_setting;
                 $event['Venue']['ShowMapLink'] = $show_map_setting;
                 $event['EventVenueID'] = Tribe__Events__Venue::instance()->create($event['Venue'], $this->meta['post_status']);
                 // Log this Venue was created
                 $activity->add('venue', 'created', $event['EventVenueID']);
             }
             // Remove the Venue to avoid duplicates
             unset($event['Venue']);
         }
         //if we should create an organizer or use existing
         if (!empty($event['Organizer']['Organizer'])) {
             $o_id = array_search($event['Organizer']['Organizer'], $found_organizers);
             if (false !== $o_id) {
                 $event['EventOrganizerID'] = $o_id;
             } elseif ($organizer = get_page_by_title($event['Organizer']['Organizer'], 'OBJECT', Tribe__Events__Main::ORGANIZER_POST_TYPE)) {
                 $found_organizers[$organizer->ID] = $event['Organizer']['Organizer'];
                 $event['EventOrganizerID'] = $organizer->ID;
             } else {
                 $event['EventOrganizerID'] = Tribe__Events__Organizer::instance()->create($event['Organizer'], $this->meta['post_status']);
                 // Log this Organizer was created
                 $activity->add('organizer', 'created', $event['EventOrganizerID']);
             }
             // Remove the Organizer to avoid duplicates
             unset($event['Organizer']);
         }
         $event['post_type'] = Tribe__Events__Main::POSTTYPE;
         /**
          * Filters the event data before any sort of saving of the event
          *
          * @param array $event Event data to save
          * @param Tribe__Events__Aggregator__Record__Abstract Importer record
          */
         $event = apply_filters('tribe_aggregator_before_save_event', $event, $this);
         if (!empty($event['ID'])) {
             if ('preserve_changes' === $update_authority_setting) {
                 $event = Tribe__Events__Aggregator__Event::preserve_changed_fields($event);
             }
             add_filter('tribe_aggregator_track_modified_fields', '__return_false');
             /**
              * Filters the event data before updating event
              *
              * @param array $event Event data to save
              * @param Tribe__Events__Aggregator__Record__Abstract Importer record
              */
             $event = apply_filters('tribe_aggregator_before_update_event', $event, $this);
             $event['ID'] = tribe_update_event($event['ID'], $event);
             // since the Event API only supports the _setting_ of these meta fields, we need to manually
             // delete them rather than relying on Tribe__Events__API::saveEventMeta()
             if (isset($event['EventShowMap']) && (empty($event['EventShowMap']) || 'no' === $event['EventShowMap'])) {
                 delete_post_meta($event['ID'], '_EventShowMap');
             }
             if (isset($event['EventShowMapLink']) && (empty($event['EventShowMapLink']) || 'no' === $event['EventShowMapLink'])) {
                 delete_post_meta($event['ID'], '_EventShowMapLink');
             }
             remove_filter('tribe_aggregator_track_modified_fields', '__return_false');
             // Log that this event was updated
             $activity->add('event', 'updated', $event['ID']);
         } else {
             /**
              * Filters the event data before inserting event
              *
              * @param array $event Event data to save
              * @param Tribe__Events__Aggregator__Record__Abstract Importer record
              */
             $event = apply_filters('tribe_aggregator_before_insert_event', $event, $this);
             $event['ID'] = tribe_create_event($event);
             // Log this event was created
             $activity->add('event', 'created', $event['ID']);
         }
         Tribe__Events__Aggregator__Records::instance()->add_record_to_event($event['ID'], $this->id, $this->origin);
         //add post parent possibility
         if (empty($event['parent_uid'])) {
             $possible_parents[$event['ID']] = $event[$unique_field['target']];
         }
         if (!empty($event[$unique_field['target']])) {
             update_post_meta($event['ID'], "_{$unique_field['target']}", $event[$unique_field['target']]);
         }
         //Save the meta data in case of updating to pro later on
         if (!empty($event['EventRecurrenceRRULE'])) {
             update_post_meta($event['ID'], '_EventRecurrenceRRULE', $event['EventRecurrenceRRULE']);
         }
         $terms = array();
         if (!empty($event['categories'])) {
             foreach ($event['categories'] as $cat) {
                 if (!($term = term_exists($cat, Tribe__Events__Main::TAXONOMY))) {
                     $term = wp_insert_term($cat, Tribe__Events__Main::TAXONOMY);
                     if (!is_wp_error($term)) {
                         $terms[] = (int) $term['term_id'];
                         // Track that we created a Term
                         $activity->add('cat', 'created', $term['term_id']);
                     }
                 } else {
                     $terms[] = (int) $term['term_id'];
                 }
             }
         }
         // if we are setting all events to a category specified in saved import
         if (!empty($this->meta['category'])) {
             $terms[] = (int) $this->meta['category'];
         }
         wp_set_object_terms($event['ID'], $terms, Tribe__Events__Main::TAXONOMY, false);
         // If we have a Image Field from Service
         if (!empty($event['image'])) {
             // Attempt to grab the event image
             $image_import = Tribe__Events__Aggregator::instance()->api('image')->get($event['image']->id);
             /**
              * Filters the returned event image url
              *
              * @param array|bool $image       Attachment information
              * @param array      $event       Event array
              */
             $image = apply_filters('tribe_aggregator_event_image', $image_import, $event);
             // If there was a problem bail out
             if (false === $image) {
                 continue;
             }
             // Verify for more Complex Errors
             if (is_wp_error($image)) {
                 continue;
             }
             if (isset($image->status) && 'created' === $image->status) {
                 // Set as featured image
                 $featured_status = set_post_thumbnail($event['ID'], $image->post_id);
                 if ($featured_status) {
                     // Log this attachment was created
                     $activity->add('attachment', 'created', $image->post_id);
                 }
             }
         }
     }
     remove_filter('tribe-post-origin', array(Tribe__Events__Aggregator__Records::instance(), 'filter_post_origin'), 10);
     return $activity;
 }
 /**
  * Test a non-linear closest event list
  *
  * The order should be:
  *
  *   ID  EventStartDate
  *   2   2015-12-01 12:00:00
  *   1   2015-12-02 15:00:00
  *   3   2015-12-02 15:00:00
  *   4   2015-12-02 15:00:00
  *   5   2015-12-03 16:00:00
  */
 public function test_closest_event_non_linear()
 {
     $main = \Tribe__Events__Main::instance();
     $settings = $this->post_example_settings;
     unset($settings['EventHideFromUpcoming']);
     $settings['EventStartDate'] = date('Y-m-d', strtotime('+2 days'));
     $settings['EventEndDate'] = date('Y-m-d', strtotime('+2 days'));
     $settings['EventStartHour'] = '3';
     $settings['EventStartMinute'] = '00';
     $settings['EventStartMeridian'] = 'pm';
     $settings['EventEndHour'] = '4';
     $settings['EventEndMinute'] = '00';
     $settings['EventEndMeridian'] = 'pm';
     $post_id = tribe_create_event($settings);
     $post_1 = tribe_get_events(array('p' => $post_id))[0];
     $settings['post_title'] = 'Test event 2';
     $settings['EventStartDate'] = date('Y-m-d', strtotime('+1 day'));
     $settings['EventEndDate'] = date('Y-m-d', strtotime('+1 day'));
     $settings['EventStartHour'] = '12';
     $settings['EventEndHour'] = '1';
     $post_id = tribe_create_event($settings);
     $post_2 = tribe_get_events(array('p' => $post_id))[0];
     $settings['post_title'] = 'Test event 3';
     $settings['EventStartDate'] = date('Y-m-d', strtotime('+2 days'));
     $settings['EventEndDate'] = date('Y-m-d', strtotime('+2 days'));
     $settings['EventStartHour'] = '3';
     $settings['EventEndHour'] = '4';
     $post_id = tribe_create_event($settings);
     $post_3 = tribe_get_events(array('p' => $post_id))[0];
     $settings['post_title'] = 'Test event 4';
     $post_id = tribe_create_event($settings);
     $post_4 = tribe_get_events(array('p' => $post_id))[0];
     $settings['post_title'] = 'Test event 5';
     $settings['EventStartDate'] = date('Y-m-d', strtotime('+3 days'));
     $settings['EventEndDate'] = date('Y-m-d', strtotime('+3 days'));
     $settings['EventStartHour'] = '4';
     $settings['EventEndHour'] = '5';
     $post_id = tribe_create_event($settings);
     $post_5 = tribe_get_events(array('p' => $post_id))[0];
     $this->assertEquals($post_2->ID, $main->get_closest_event($post_1, 'previous')->ID, "Post 1's previous post should be Post 2");
     $this->assertEquals($post_3->ID, $main->get_closest_event($post_1, 'next')->ID, "Post 1's next post should be Post 3");
     $this->assertEquals(null, $main->get_closest_event($post_2, 'previous'), "Post 2's previous post should be null");
     $this->assertEquals($post_1->ID, $main->get_closest_event($post_2, 'next')->ID, "Post 2's next post should be Post 1");
     $this->assertEquals($post_1->ID, $main->get_closest_event($post_3, 'previous')->ID, "Post 3's previous post should be Post 1");
     $this->assertEquals($post_4->ID, $main->get_closest_event($post_3, 'next')->ID, "Post 3's next post should be Post 4");
     $this->assertEquals($post_3->ID, $main->get_closest_event($post_4, 'previous')->ID, "Post 4's previous post should be Post 3");
     $this->assertEquals($post_5->ID, $main->get_closest_event($post_4, 'next')->ID, "Post 4's next post should be Post 5");
     $this->assertEquals($post_4->ID, $main->get_closest_event($post_5, 'previous')->ID, "Post 5's previous post should be Post 4");
     $this->assertEquals(null, $main->get_closest_event($post_5, 'next'), "Post 5's next post should be null");
 }
function bp_ning_import_get_events()
{
    global $wpdb;
    $ning_id_array = get_option('bp_ning_user_array');
    //delete_option('bp_ning_events_imported');
    $imported = get_option('bp_ning_events_imported', array());
    $events = bp_ning_import_prepare_json('events', false);
    $counter = 0;
    foreach ((array) $events as $event) {
        if (isset($imported[$event->id])) {
            continue;
        }
        if ($counter >= 30) {
            update_option('bp_ning_events_imported', $imported);
            printf(__('%d out of %d events done.'), count($imported), count($events));
            return false;
        }
        $post_date = date('Y-m-d H:i:s', strtotime($event->createdDate));
        if ($post_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM {$wpdb->posts} WHERE post_title = %s AND post_type=%s AND post_date = %s", $event->title, TribeEvents::POSTTYPE, $post_date))) {
            echo "<strong>Event already exists: {$event->title}</strong><br />";
            $imported[$event->id] = true;
            continue;
        }
        $ning_group_creator_id = $event->contributorName;
        $creator_id = $ning_id_array[$ning_group_creator_id];
        $creator = get_userdata($creator_id);
        $start = strtotime($event->startDate);
        $end = strtotime($event->endDate);
        $args = array('post_title' => $event->title, 'post_content' => $event->description, 'post_date' => $post_date, 'post_modified' => date('Y-m-d H:i:s', strtotime($event->updatedDate)), 'post_status' => 'publish', 'post_author' => $creator_id, 'EventStartDate' => date('Y-m-d', $start), 'EventEndDate' => date('Y-m-d', $end), 'Venue' => array(), 'Organizer' => array('Organizer' => $creator->display_name, 'Email' => $creator->user_email));
        if (isset($event->isPrivate) && $event->isPrivate) {
            $args['post_status'] = 'private';
        }
        if (isset($event->allDay) && $event->allDay) {
            $args['EventAllDay'] = true;
        } else {
            $args['EventStartHour'] = date('h', $start);
            $args['EventStartMinute'] = date('i', $start);
            $args['EventStartMeridian'] = date('a', $start);
            $args['EventEndHour'] = date('h', $end);
            $args['EventEndMinute'] = date('i', $end);
            $args['EventEndMeridian'] = date('a', $end);
        }
        if (isset($event->location)) {
            $args['Venue'] = array('Venue' => $event->location, 'Country' => 'AU');
            if (isset($event->street)) {
                $args['Venue']['Address'] = $event->street;
            }
            if (isset($event->city)) {
                $args['Venue']['City'] = $event->city;
            }
            if (isset($event->contactInfo)) {
                $args['Venue']['Phone'] = $event->contactInfo;
            }
        }
        $event_id = tribe_create_event($args);
        if (is_wp_error($event_id)) {
            echo "<strong>Unable to create event: {$event->title} - Error was " . $event_id->get_error_message() . '</strong><br />';
            continue;
        }
        if (isset($event->website)) {
            add_post_meta($event_id, '_bp_ning_event_website', $event->website);
        }
        $imported[$event->id] = true;
        $counter++;
        echo "<strong>Event created: {$event->title}</strong><br />";
    }
    update_option('bp_ning_events_imported', $imported);
    return true;
}