{"id":102684,"date":"2014-02-10T09:33:02","date_gmt":"2014-02-10T17:33:02","guid":{"rendered":"http:\/\/tri.be\/support\/forums\/topic\/how-can-i-set-a-pre-defined-venue-via-php\/"},"modified":"2014-02-14T15:59:13","modified_gmt":"2014-02-14T23:59:13","slug":"how-can-i-set-a-pre-defined-venue-via-php","status":"closed","type":"topic","link":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/how-can-i-set-a-pre-defined-venue-via-php\/","title":{"rendered":"(Solved) How can I set a pre-defined venue via php?"},"content":{"rendered":"<p>Im doing the following to import some data from a csv file via php:<\/p>\n<p>$venueData = array();<br \/>\n$venueData[&#8216;Venue&#8217;] = venuename<br \/>\n$venueData[&#8216;post_type&#8217;] = &#8216;tribe_venue&#8217;;<br \/>\n$venueData[&#8216;Country&#8217;] = country;<br \/>\n$venueData[&#8216;Address&#8217;] = address;<br \/>\n$venueData[&#8216;City&#8217;] = city;<br \/>\n$venueData[&#8216;State&#8217;] = state;<br \/>\n$venueData[&#8216;Zip&#8217;] = zip;<br \/>\n$venueData[&#8216;ShowMap&#8217;] = true;<br \/>\n$venueData[&#8216;ShowMapLink&#8217;] = true;<br \/>\n$venueData[&#8216;Phone&#8217;] = phone;<br \/>\n$venueData[&#8216;URL&#8217;] = url;<br \/>\n$event[&#8216;Venue&#8217;]=$venueData;<br \/>\n$event[&#8216;post_title&#8217;] = Title;<br \/>\n$event[&#8216;post_status&#8217;] = &#8216;pending&#8217;;<br \/>\n$event[&#8216;post_type&#8217;] = &#8216;tribe_events&#8217;;<br \/>\n$event[&#8216;post_author&#8217;] = $postAuthor;<br \/>\n$event[&#8216;post_content&#8217;] = $postBody;<br \/>\n$event[&#8216;EventStartDate&#8217;] = date(&#8220;Y-m-d H:i:s&#8221;, now());<br \/>\n$event[&#8216;EventEndDate&#8217;] = date(&#8220;Y-m-d H:i:s&#8221;, &#8216;+1 day&#8217;);<br \/>\n$event[&#8216;EventShowMapLink&#8217;] = true;<br \/>\n$event[&#8216;EventShowMap&#8217;] = true;<\/p>\n<p>$postID = tribe_create_event($event);<\/p>\n<p>This works fine (I might have an error in the code above as I wrote this off the top of my head, but you get the point).<\/p>\n<p>1. How do I test to see if a venue already exists in my db? For example, if the venue name in the csv is &#8220;my place&#8221; but I already have &#8220;my place&#8221; defined in the database, I dont want to create a second instance. I want to use the one thats already there<\/p>\n<p>2. If I already have it defined, how can I set the params above to use THAT venue name \/ id instead of defining it like above?<br \/>\nThanks!<\/p>\n","protected":false},"template":"","class_list":["post-102684","topic","type-topic","status-closed","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>(Solved) How can I set a pre-defined venue via php? -<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/how-can-i-set-a-pre-defined-venue-via-php\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"(Solved) How can I set a pre-defined venue via php? -\" \/>\n<meta property=\"og:description\" content=\"Im doing the following to import some data from a csv file via php: $venueData = array(); $venueData[&#8216;Venue&#8217;] = venuename $venueData[&#8216;post_type&#8217;] = &#8216;tribe_venue&#8217;; $venueData[&#8216;Country&#8217;] = country; $venueData[&#8216;Address&#8217;] = address; $venueData[&#8216;City&#8217;] = city; $venueData[&#8216;State&#8217;] = state; $venueData[&#8216;Zip&#8217;] = zip; $venueData[&#8216;ShowMap&#8217;] = true; $venueData[&#8216;ShowMapLink&#8217;] = true; $venueData[&#8216;Phone&#8217;] = phone; $venueData[&#8216;URL&#8217;] = url; $event[&#8216;Venue&#8217;]=$venueData; $event[&#8216;post_title&#8217;] = Title; $event[&#8216;post_status&#8217;] [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/how-can-i-set-a-pre-defined-venue-via-php\/\" \/>\n<meta property=\"article:modified_time\" content=\"2014-02-14T23:59:13+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/how-can-i-set-a-pre-defined-venue-via-php\/\",\"url\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/how-can-i-set-a-pre-defined-venue-via-php\/\",\"name\":\"(Solved) How can I set a pre-defined venue via php? -\",\"isPartOf\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/#website\"},\"datePublished\":\"2014-02-10T17:33:02+00:00\",\"dateModified\":\"2014-02-14T23:59:13+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/how-can-i-set-a-pre-defined-venue-via-php\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/how-can-i-set-a-pre-defined-venue-via-php\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/how-can-i-set-a-pre-defined-venue-via-php\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/theeventscalendar.com\/support\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Topics\",\"item\":\"https:\/\/theeventscalendar.com\/support\/topics\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Calendar Products\",\"item\":\"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Events Calendar PRO\",\"item\":\"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/events-calendar-pro\/\"},{\"@type\":\"ListItem\",\"position\":5,\"name\":\"(Solved) How can I set a pre-defined venue via php?\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/#website\",\"url\":\"https:\/\/theeventscalendar.com\/support\/\",\"name\":\"\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/theeventscalendar.com\/support\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"(Solved) How can I set a pre-defined venue via php? -","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/how-can-i-set-a-pre-defined-venue-via-php\/","og_locale":"en_US","og_type":"article","og_title":"(Solved) How can I set a pre-defined venue via php? -","og_description":"Im doing the following to import some data from a csv file via php: $venueData = array(); $venueData[&#8216;Venue&#8217;] = venuename $venueData[&#8216;post_type&#8217;] = &#8216;tribe_venue&#8217;; $venueData[&#8216;Country&#8217;] = country; $venueData[&#8216;Address&#8217;] = address; $venueData[&#8216;City&#8217;] = city; $venueData[&#8216;State&#8217;] = state; $venueData[&#8216;Zip&#8217;] = zip; $venueData[&#8216;ShowMap&#8217;] = true; $venueData[&#8216;ShowMapLink&#8217;] = true; $venueData[&#8216;Phone&#8217;] = phone; $venueData[&#8216;URL&#8217;] = url; $event[&#8216;Venue&#8217;]=$venueData; $event[&#8216;post_title&#8217;] = Title; $event[&#8216;post_status&#8217;] [&hellip;]","og_url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/how-can-i-set-a-pre-defined-venue-via-php\/","article_modified_time":"2014-02-14T23:59:13+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/how-can-i-set-a-pre-defined-venue-via-php\/","url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/how-can-i-set-a-pre-defined-venue-via-php\/","name":"(Solved) How can I set a pre-defined venue via php? -","isPartOf":{"@id":"https:\/\/theeventscalendar.com\/support\/#website"},"datePublished":"2014-02-10T17:33:02+00:00","dateModified":"2014-02-14T23:59:13+00:00","breadcrumb":{"@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/how-can-i-set-a-pre-defined-venue-via-php\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/theeventscalendar.com\/support\/forums\/topic\/how-can-i-set-a-pre-defined-venue-via-php\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/how-can-i-set-a-pre-defined-venue-via-php\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/theeventscalendar.com\/support\/"},{"@type":"ListItem","position":2,"name":"Topics","item":"https:\/\/theeventscalendar.com\/support\/topics\/"},{"@type":"ListItem","position":3,"name":"Calendar Products","item":"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/"},{"@type":"ListItem","position":4,"name":"Events Calendar PRO","item":"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/events-calendar-pro\/"},{"@type":"ListItem","position":5,"name":"(Solved) How can I set a pre-defined venue via php?"}]},{"@type":"WebSite","@id":"https:\/\/theeventscalendar.com\/support\/#website","url":"https:\/\/theeventscalendar.com\/support\/","name":"","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/theeventscalendar.com\/support\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic\/102684","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic\/102684\/revisions"}],"wp:attachment":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/media?parent=102684"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}