protected function create_post(array $record)
 {
     $this->hack_to_remove_broken_filters();
     $venue = $this->build_venue_array($record);
     $id = TribeEventsAPI::createVenue($venue);
     return $id;
 }
 protected function create_post(array $record)
 {
     $venue = $this->build_venue_array($record);
     $id = TribeEventsAPI::createVenue($venue);
     TribeEventsAPI::updateVenue($id, $venue);
     return $id;
 }
 /**
  * Saves the event venue information passed via an event
  */
 private static function saveEventVenue($data, $post = null, $post_status = 'publish')
 {
     if (isset($data['VenueID']) && $data['VenueID'] > 0) {
         if (count($data) == 1) {
             // Only an ID was passed and we should do nothing.
             return $data['VenueID'];
         } else {
             return TribeEventsAPI::updateVenue($data['VenueID'], $data);
         }
     } else {
         return TribeEventsAPI::createVenue($data, $post_status);
     }
 }
 /**
  * Saves the event venue information passed via an event
  *
  * @param array   $data        The venue data.
  * @param WP_Post $post        The venue object.
  * @param string  $post_status The intended post status.
  *
  * @return mixed.
  */
 private static function saveEventVenue($data, $post = null, $post_status = 'publish')
 {
     if (isset($data['VenueID']) && $data['VenueID'] > 0) {
         if (count($data) == 1) {
             // Only an ID was passed and we should do nothing.
             return $data['VenueID'];
         } else {
             $show_map = get_post_meta($data['VenueID'], '_VenueShowMap', true);
             $show_map_link = get_post_meta($data['VenueID'], '_VenueShowMapLink', true);
             $data['ShowMap'] = $show_map ? $show_map : 'false';
             $data['ShowMapLink'] = $show_map_link ? $show_map_link : 'false';
             TribeEventsAPI::updateVenue($data['VenueID'], $data);
             return $data['VenueID'];
         }
     } else {
         return TribeEventsAPI::createVenue($data, $post_status);
     }
 }
Ejemplo n.º 5
0
 /**
  * Create a Venue
  *
  * $args accepts all the args that can be passed to wp_insert_post(). 
  * In addition to that, the following args can be passed specifically 
  * for the process of creating a Venue:
  *
  * - Venue string - Title of the Venue. (required)
  * - Country string - Country code for the Venue country.
  * - Address string - Street address of the Venue.
  * - City string - City of the Venue.
  * - State string - Two letter state abbreviation.
  * - Province string - Province of the Venue.
  * - Zip string - Zip code of the Venue.
  * - Phone string - Phone number for the Venue.
  * 
  * @param array $args Elements that make up post to insert.
  * @return int ID of the Venue that was created. False if insert failed.
  * @link http://codex.wordpress.org/Function_Reference/wp_insert_post
  * @see wp_insert_post()
  * @category Venue Functions
  */
 function tribe_create_venue($args)
 {
     $postId = TribeEventsAPI::createVenue($args);
     return $postId;
 }
 /**
  * Convert Venue data
  *
  * @param string $post 
  */
 private static function convertVenue($post)
 {
     $venue = array();
     foreach (self::$legacyVenueTags as $tag) {
         $strippedTag = str_replace('_Event', '', $tag);
         $meta = get_post_meta($post->ID, $tag, true);
         $venue[$strippedTag] = $meta;
         delete_post_meta($post->ID, $tag);
     }
     if ($venue['Country'] == 'United States') {
         $venue['StateProvince'] = get_post_meta($post->ID, '_EventState', true);
     } else {
         $venue['StateProvince'] = get_post_meta($post->ID, '_EventProvince', true);
     }
     $unique_venue = $venue['Venue'] . $venue['Address'] . $venue['StateProvince'];
     if ($unique_venue && trim($unique_venue) != "") {
         if (!isset(self::$curVenues[$unique_venue])) {
             self::$curVenues[$unique_venue] = TribeEventsAPI::createVenue($venue);
         } else {
             TribeEventsAPI::updateVenue(self::$curVenues[$unique_venue], $venue);
         }
         update_post_meta($post->ID, '_EventVenueID', self::$curVenues[$unique_venue]);
     }
 }