{"id":973776,"date":"2015-06-29T22:59:13","date_gmt":"2015-06-30T05:59:13","guid":{"rendered":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/sync-wp-users-with-organizers\/"},"modified":"2015-06-30T16:25:47","modified_gmt":"2015-06-30T23:25:47","slug":"sync-wp-users-with-organizers","status":"closed","type":"topic","link":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/sync-wp-users-with-organizers\/","title":{"rendered":"Sync wp users with organizers"},"content":{"rendered":"<p>As far as I can tell, there is no way to associate my wp users with event organizers, is that correct? If not, I want to do it manually, because it doesn&#8217;t make sense for my project to have my users select &#8220;Organizer&#8221; for each event, when I need it to be them (the logged in user) every time.<\/p>\n<p>I have tried the below function to try and set the organizer to the current user and use meta data to connect the two, but it is not working. I&#8217;m not sure I&#8217;m getting (and setting) the correct data from the $_POST array, I can&#8217;t find the documentation on that. <\/p>\n<p>Can somebody steer me in the right direction, of tell me a better way to associate wp users with event organizers?<\/p>\n<pre><code>\/\/Adds custom fields support to events calender organizers\nadd_action(&#039;init&#039;, &#039;tps_event_add_support&#039;);\nfunction tps_event_add_support() {\n\tadd_post_type_support( &#039;tribe_organizer&#039;, &#039;custom-fields&#039; );\n}\n\n\/\/Adds the &quot;organizer&quot; field to the event when it is created based on the logged in user\nfunction tps_add_organizer($post_id) {\n\tglobal $current_user;\n\tget_currentuserinfo();\n\t$linkedOrganizer = get_user_meta($current_user-&gt;ID, &#039;linked_organizer&#039;, true);\n\tif ($linkedOrganizer) {\n\t\t$_POST[&#039;Organizer&#039;] = array(&#039;OrganizerID&#039;=&gt;$linkedOrganizer);\n\t} else {\n\t\t$linkedOrganizer = tribe_create_organizer(array(&#039;Organizer&#039;=&gt;$current_user-&gt;display_name));\n\t\tupdate_user_meta($current_user-&gt;ID, &#039;linked_organizer&#039;, $linkedOrganizer);\n\t\t$_POST[&#039;Organizer&#039;] = array(&#039;OrganizerID&#039;=&gt;$linkedOrganizer);\n\t}\n}\nadd_action( &#039;save_post_tribe_events&#039;, &#039;tps_add_organizer&#039; );<\/code><\/pre>\n","protected":false},"template":"","class_list":["post-973776","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>Sync wp users with organizers -<\/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\/sync-wp-users-with-organizers\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Sync wp users with organizers -\" \/>\n<meta property=\"og:description\" content=\"As far as I can tell, there is no way to associate my wp users with event organizers, is that correct? If not, I want to do it manually, because it doesn&#8217;t make sense for my project to have my users select &#8220;Organizer&#8221; for each event, when I need it to be them (the logged [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/sync-wp-users-with-organizers\/\" \/>\n<meta property=\"article:modified_time\" content=\"2015-06-30T23:25:47+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\/sync-wp-users-with-organizers\/\",\"url\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/sync-wp-users-with-organizers\/\",\"name\":\"Sync wp users with organizers -\",\"isPartOf\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/#website\"},\"datePublished\":\"2015-06-30T05:59:13+00:00\",\"dateModified\":\"2015-06-30T23:25:47+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/sync-wp-users-with-organizers\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/sync-wp-users-with-organizers\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/sync-wp-users-with-organizers\/#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\":\"Community Events\",\"item\":\"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/community-events\/\"},{\"@type\":\"ListItem\",\"position\":5,\"name\":\"Sync wp users with organizers\"}]},{\"@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":"Sync wp users with organizers -","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\/sync-wp-users-with-organizers\/","og_locale":"en_US","og_type":"article","og_title":"Sync wp users with organizers -","og_description":"As far as I can tell, there is no way to associate my wp users with event organizers, is that correct? If not, I want to do it manually, because it doesn&#8217;t make sense for my project to have my users select &#8220;Organizer&#8221; for each event, when I need it to be them (the logged [&hellip;]","og_url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/sync-wp-users-with-organizers\/","article_modified_time":"2015-06-30T23:25:47+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\/sync-wp-users-with-organizers\/","url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/sync-wp-users-with-organizers\/","name":"Sync wp users with organizers -","isPartOf":{"@id":"https:\/\/theeventscalendar.com\/support\/#website"},"datePublished":"2015-06-30T05:59:13+00:00","dateModified":"2015-06-30T23:25:47+00:00","breadcrumb":{"@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/sync-wp-users-with-organizers\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/theeventscalendar.com\/support\/forums\/topic\/sync-wp-users-with-organizers\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/sync-wp-users-with-organizers\/#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":"Community Events","item":"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/community-events\/"},{"@type":"ListItem","position":5,"name":"Sync wp users with organizers"}]},{"@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\/973776","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":1,"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic\/973776\/revisions"}],"predecessor-version":[{"id":973778,"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic\/973776\/revisions\/973778"}],"wp:attachment":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/media?parent=973776"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}