{"id":1192306,"date":"2016-11-15T01:30:57","date_gmt":"2016-11-15T09:30:57","guid":{"rendered":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/tribe_create_event-not-saving-venue-and-organizer\/"},"modified":"2016-11-15T01:30:57","modified_gmt":"2016-11-15T09:30:57","slug":"tribe_create_event-not-saving-venue-and-organizer","status":"closed","type":"topic","link":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/tribe_create_event-not-saving-venue-and-organizer\/","title":{"rendered":"tribe_create_event not saving Venue and Organizer"},"content":{"rendered":"<p>Hi there,<\/p>\n<p>I&#8217;ve been using tribe_create_event to manually create events in an ajax action based on user input. It has been working fine until recently. Now neither venues or organizers are saved.<\/p>\n<pre><code>\n\/\/ [.....]\n$venue = [\n      &#039;Venue&#039;           =&gt; $_POST[&#039;event-venue-name&#039;],\n      &#039;Country&#039;         =&gt; __(&#039;Denmark&#039;, &#039;the-events-calendar&#039;),\n      &#039;Address&#039;         =&gt; $_POST[&#039;event-venue-address&#039;],\n      &#039;City&#039;            =&gt; $_POST[&#039;event-venue-city&#039;],\n      &#039;Zip&#039;             =&gt; $_POST[&#039;event-venue-zip&#039;],\n      &#039;URL&#039;             =&gt; $_POST[&#039;event-venue-website&#039;],\n    ];\n\n  $organizer = [\n      &#039;Organizer&#039;       =&gt; $_POST[&#039;event-organizer-name&#039;],\n      &#039;Email&#039;           =&gt; $_POST[&#039;event-organizer-email&#039;],\n      &#039;Website&#039;         =&gt; $_POST[&#039;event-organizer-website&#039;],\n      &#039;Phone&#039;           =&gt; $_POST[&#039;event-organizer-phone&#039;],\n    ];\n\n    $args = [\n      &#039;post_status&#039;     =&gt; &#039;pending&#039;,\n      &#039;post_author&#039;     =&gt; 1,\n      &#039;post_title&#039;      =&gt; $title,\n      &#039;post_excerpt&#039;    =&gt; substr( $description, 0, 150  ),\n      &#039;EventStartDate&#039;  =&gt; $start_date,\n      &#039;EventEndDate&#039;    =&gt; $end_date,\n      &#039;EventAllDay&#039;     =&gt; $all_day,\n      &#039;Venue&#039;           =&gt; $venue,\n      &#039;Organizer&#039;       =&gt; $organizer,\n      &#039;EventURL&#039;        =&gt; $website\n    ];\n\n    if( ! $all_day ){\n      $args[&#039;EventStartHour&#039;] = $start_hour;\n      $args[&#039;EventStartMinute&#039;] = $start_minute;\n      $args[&#039;EventEndHour&#039;] = $end_hour;\n      $args[&#039;EventEndMinute&#039;] = $end_minute;\n    }\n\n    \/\/ Create the event\n    $event_id = tribe_create_event( $args );\n<\/code><\/pre>\n<p>The event is created fine, but no venues or organizers are created nor referenced in the event. The issue seems to go away when I&#8217;m logged into wordpress.<\/p>\n<p>I&#8217;ve managed to work around it by manually creating the venue and organizer using tribe_create_venue and tribe_create_organizer respectively, and then adding EventOrganizerID and EventVenueID to $args. This still feels hacky and keeps me wondering, if something else is wrong.<\/p>\n","protected":false},"template":"","class_list":["post-1192306","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>tribe_create_event not saving Venue and Organizer -<\/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\/tribe_create_event-not-saving-venue-and-organizer\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"tribe_create_event not saving Venue and Organizer -\" \/>\n<meta property=\"og:description\" content=\"Hi there, I&#8217;ve been using tribe_create_event to manually create events in an ajax action based on user input. It has been working fine until recently. Now neither venues or organizers are saved. \/\/ [.....] $venue = [ &#039;Venue&#039; =&gt; $_POST[&#039;event-venue-name&#039;], &#039;Country&#039; =&gt; __(&#039;Denmark&#039;, &#039;the-events-calendar&#039;), &#039;Address&#039; =&gt; $_POST[&#039;event-venue-address&#039;], &#039;City&#039; =&gt; $_POST[&#039;event-venue-city&#039;], &#039;Zip&#039; =&gt; $_POST[&#039;event-venue-zip&#039;], &#039;URL&#039; =&gt; [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/tribe_create_event-not-saving-venue-and-organizer\/\" \/>\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\/tribe_create_event-not-saving-venue-and-organizer\/\",\"url\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/tribe_create_event-not-saving-venue-and-organizer\/\",\"name\":\"tribe_create_event not saving Venue and Organizer -\",\"isPartOf\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/#website\"},\"datePublished\":\"2016-11-15T09:30:57+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/tribe_create_event-not-saving-venue-and-organizer\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/tribe_create_event-not-saving-venue-and-organizer\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/tribe_create_event-not-saving-venue-and-organizer\/#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\":\"tribe_create_event not saving Venue and Organizer\"}]},{\"@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":"tribe_create_event not saving Venue and Organizer -","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\/tribe_create_event-not-saving-venue-and-organizer\/","og_locale":"en_US","og_type":"article","og_title":"tribe_create_event not saving Venue and Organizer -","og_description":"Hi there, I&#8217;ve been using tribe_create_event to manually create events in an ajax action based on user input. It has been working fine until recently. Now neither venues or organizers are saved. \/\/ [.....] $venue = [ &#039;Venue&#039; =&gt; $_POST[&#039;event-venue-name&#039;], &#039;Country&#039; =&gt; __(&#039;Denmark&#039;, &#039;the-events-calendar&#039;), &#039;Address&#039; =&gt; $_POST[&#039;event-venue-address&#039;], &#039;City&#039; =&gt; $_POST[&#039;event-venue-city&#039;], &#039;Zip&#039; =&gt; $_POST[&#039;event-venue-zip&#039;], &#039;URL&#039; =&gt; [&hellip;]","og_url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/tribe_create_event-not-saving-venue-and-organizer\/","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\/tribe_create_event-not-saving-venue-and-organizer\/","url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/tribe_create_event-not-saving-venue-and-organizer\/","name":"tribe_create_event not saving Venue and Organizer -","isPartOf":{"@id":"https:\/\/theeventscalendar.com\/support\/#website"},"datePublished":"2016-11-15T09:30:57+00:00","breadcrumb":{"@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/tribe_create_event-not-saving-venue-and-organizer\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/theeventscalendar.com\/support\/forums\/topic\/tribe_create_event-not-saving-venue-and-organizer\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/tribe_create_event-not-saving-venue-and-organizer\/#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":"tribe_create_event not saving Venue and Organizer"}]},{"@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\/1192306","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\/1192306\/revisions"}],"wp:attachment":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/media?parent=1192306"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}