Home › Forums › Calendar Products › Community Events › Sync wp users with organizers
- This topic has 4 replies, 2 voices, and was last updated 10 years, 10 months ago by
Brian.
-
AuthorPosts
-
June 29, 2015 at 10:59 pm #973776
tpsonline
ParticipantAs 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’t make sense for my project to have my users select “Organizer” for each event, when I need it to be them (the logged in user) every time.
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’m not sure I’m getting (and setting) the correct data from the $_POST array, I can’t find the documentation on that.
Can somebody steer me in the right direction, of tell me a better way to associate wp users with event organizers?
//Adds custom fields support to events calender organizers add_action('init', 'tps_event_add_support'); function tps_event_add_support() { add_post_type_support( 'tribe_organizer', 'custom-fields' ); } //Adds the "organizer" field to the event when it is created based on the logged in user function tps_add_organizer($post_id) { global $current_user; get_currentuserinfo(); $linkedOrganizer = get_user_meta($current_user->ID, 'linked_organizer', true); if ($linkedOrganizer) { $_POST['Organizer'] = array('OrganizerID'=>$linkedOrganizer); } else { $linkedOrganizer = tribe_create_organizer(array('Organizer'=>$current_user->display_name)); update_user_meta($current_user->ID, 'linked_organizer', $linkedOrganizer); $_POST['Organizer'] = array('OrganizerID'=>$linkedOrganizer); } } add_action( 'save_post_tribe_events', 'tps_add_organizer' );June 29, 2015 at 11:08 pm #973777tpsonline
ParticipantWould it make sense to just do away with the Organizer system altogether and only link to my wp user profile pages? Is there any downfall in events NOT having an organizer?
June 30, 2015 at 8:49 am #973904Brian
MemberHi,
Thanks for using our plugins.
I am limited in support customizations per our terms and conditions, but to answer your last question. The organizer is not needed so you could not use it and hide the display of it.
You can remove the Organizer from all the templates following our themer’s guide:
https://theeventscalendar.com/knowledgebase/themers-guide/
Let me know if you have any follow up questions.
Thanks
June 30, 2015 at 8:56 am #973911tpsonline
ParticipantThanks Brian, that helps. I will just hide the organizer functionality and use WP’s users instead.
Thanks!
June 30, 2015 at 4:25 pm #974022Brian
MemberSounds good.
If you have any new questions please let us know in a new thread.
I am going to close this ticket, but if you need anything else related to this topic or another please post a new topic on the forum and we can help you out.
Thanks
-
AuthorPosts
- The topic ‘Sync wp users with organizers’ is closed to new replies.
