protected function create_post(array $record) { $post_status_setting = Tribe__Events__Aggregator__Settings::instance()->default_post_status('csv'); $venue = $this->build_venue_array(false, $record); $id = Tribe__Events__API::createVenue($venue, $post_status_setting); if ($this->is_aggregator && !empty($this->aggregator_record)) { $this->aggregator_record->meta['activity']->add('venue', 'created', $id); } return $id; }
protected function create_post(array $record) { $venue = $this->build_venue_array($record); $id = Tribe__Events__API::createVenue($venue); return $id; }
/** * 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'; Tribe__Events__API::updateVenue($data['VenueID'], $data); return $data['VenueID']; } } else { // Remove a zero-value venue ID, if set, before creating the new venue if (isset($data['VenueID']) && 0 == $data['VenueID']) { unset($data['VenueID']); } return Tribe__Events__API::createVenue($data, $post_status); } }
/** * 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 Venues */ function tribe_create_venue($args) { $postId = Tribe__Events__API::createVenue($args); return $postId; }