Adding categories to event on import

Home Forums Calendar Products Event Aggregator Adding categories to event on import

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #1021813
    Jason
    Participant

    Hi Support,
    This is a follow up to https://theeventscalendar.com/support/forums/topic/set-default-organizer-categories-tags-per-imported-feed/. I’m attempting to add additional categories to events of an ical import other than the 1 category allowed through the ical import interface.

    I’m adding the following code:
    add_action( ‘tribe_events_update_meta’, ‘set_default_event_meta’);
    function set_default_event_meta ( $event_id ) {
    wp_set_object_terms($event_id, array(‘student’), ‘tribe_events_cat’ );
    }

    This works great but unfortunately the code within your plugin wipes out any categories that I apply in this method. Line 473 of importer.php in the ical importer add on has:
    wp_set_object_terms( $event[‘ID’], $terms, Tribe__Events__Main::TAXONOMY, false );

    The last parameter false says replace whatever categories are there with the category defined on the import interface. This wipes out the student category I was trying to add even if there are none defined in the interface. Could this last parameter be changed to be true…then it would append the category rather than wipe them out.

    #1021993
    Cliff
    Member

    Hi Jason. Thanks for your detailed question.

    Have you tried editing that line of /wp-content/plugins/the-events-calendar-importer-ical/src/Tribe/Importer.php and seeing if changing false to true does work as desired?

    #1022132
    Jason
    Participant

    Yes, I changed the false to true and it worked great. I was able to use the code to add the additional categories. Is this something that can be changed in the core code?

    #1022458
    Cliff
    Member

    Thanks for confirming that worked for you.

    I passed the idea along to our developers and they agreed making that filterable would be ok. So the best I can say now is that it likely might come in a future release.

    Thanks for helping make our plugins better!

    #1075448
    Support Droid
    Keymaster

    This topic has not been active for quite some time and will now be closed.

    If you still need assistance please simply open a new topic (linking to this one if necessary)
    and one of the team will be only too happy to help.

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘Adding categories to event on import’ is closed to new replies.