Sync wp users with organizers

Home Forums Calendar Products Community Events Sync wp users with organizers

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #973776
    tpsonline
    Participant

    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’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' );
    #973777
    tpsonline
    Participant

    Would 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?

    #973904
    Brian
    Member

    Hi,

    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

    #973911
    tpsonline
    Participant

    Thanks Brian, that helps. I will just hide the organizer functionality and use WP’s users instead.

    Thanks!

    #974022
    Brian
    Member

    Sounds 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

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘Sync wp users with organizers’ is closed to new replies.