Set default organizer, categories, tags per imported feed

Home Forums Calendar Products Event Aggregator Set default organizer, categories, tags per imported feed

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1012041
    Jason
    Participant

    Hi,
    I’ve been following the suggested feature:
    https://tribe.uservoice.com/forums/195723-feature-ideas/suggestions/6943020-ical-importer-set-default-organizer-category-t

    I would really like that feature to get implemented. However, I did see this topic today:
    https://theeventscalendar.com/support/forums/topic/default-organizer-for-imported-ical-feed-2/

    Is there a way to use that same snippet of code to apply a default organizer, category, or tag but only have it apply to a specific feed? Is there a custom field that I could check in that snippet for a specific feed and apply the appropriate defaults?

    One other question related to this? If I want to apply multiple categories to a feed is it ok to have 2 recurring imports for the same feed but applying a different category? Will this duplicate the events? Will both categories be applied to the same event?

    Thanks

    #1012199
    George
    Participant

    Hey @Jason,

    We haven’t tested that snippet that Nico shared extensively – if what you mean when you say “have it apply to a specific feed” is that you want it to apply to events that are imported from a specific iCal source, then unfortunately I do not know if this is possible for two reasons. First is that the code requires the tribe_events_update_meta() action to run, which I don’t think happens upon an import. Next is that you can’t really specify within code what iCal source the imported event came from at this time.

    Next, you asked this series of questions quoted below:

    One other question related to this? If I want to apply multiple categories to a feed is it ok to have 2 recurring imports for the same feed but applying a different category? Will this duplicate the events? Will both categories be applied to the same event?

    I’m sorry to admit this, but I don’t fully understand your questions…I’m sorry about that! Can you clarify exactly what you mean, perhaps provide some examples and such? This part is the specific part I do not understand: “apply multiple categories to a feed is it ok to have 2 recurring imports for the same feed but applying a different category?”

    I’m sorry about my misunderstanding here – I just want to be 100% certain I know what you’re asking so that I can best help out 🙂

    Cheers,
    George

    #1012217
    Jason
    Participant

    To answer your question I’m trying to figure out a way to apply multiple categories to an imported event. The ical importer unfortunately only allows one category and 0 other meta data (like tags). I’m trying to work around this to apply multiple categories to an imported event. When reading Brian’s responses here: https://theeventscalendar.com/support/forums/topic/import-ics-auto-category-possible/ it made me think that if I had 2 import feeds setup that simply defined 2 different categories to apply an event that was in both feeds would get both categories applied. That doesn’t seem to be the case.

    Nico’s suggested snippet does seem to imply that he thinks that the tribe_events_update_meta action does fire on import since that is what Dan was asking about. Could I get a confirmation on that?

    #1012252
    Jason
    Participant

    Also, could you clarify what type of value I should expect to see in this custom field:
    _EventIcalSource

    #1012635
    George
    Participant

    Hey Jason,

    To answer things in reverse order here, the _EventIcalSource custom field holds string values. This is the “source” of the iCal file/feed, which is equivalent to the X-WR-CALNAME property of the file if it exists.

    As for the importing of events, I double-checked and Nico/you/Dan are all correct that the meta is saved and updated upon import. This means that you can likely then just take Nico’s snippet, and add a call to the wp_set_object_terms() function. You can learn more about this function here → https://codex.wordpress.org/Function_Reference/wp_set_object_terms

    But basically, you can first get the taxonomy IDs of the event categories that you would like to be defaults on imported events; then, using that function above, you can check for the meta field _EventIcalSource to see if the event is one that is imported from iCal. If it is, then wp_set_object_terms() on that event so that it belongs to the default categories you’d like it to belong to…

    That should all work in theory. Nico’s snippet is a great starting place for this and that Codex article above on wp_set_object_terms() should be helpful, too.

    Best of luck with your customizations!

    — George

    #1017240
    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 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Set default organizer, categories, tags per imported feed’ is closed to new replies.