Hierarchial Event Venues?

This topic contains 4 replies, has 2 voices, and was last updated by  Brian Hanna 8 years, 8 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #23187

    We are trying to figure out how to implement a hierarchy for event venues that is also reflected on the main calendar.

    I have hooked into eventorganiser_register_taxonomy_event-venue and set hierarchial to true. All good there. The issue is when the fullCalendar displays on the front end, events aren’t being filtered as expected. For example:

    -Venue 1
    --Child Venue 1
    --Child Venue 2
    

    We would expect selecting Venue 1 from the venue dropdown filter to show events for both child venues, whereas the specific child venues only show their own events. I’ve poked around the source quite a bit, as well as played around with the eventorganiser_fullcalendar filter but since it gets called on calendar load, I’m not really sure how to filter the individual requests when the dropdown is selected. Do you have any suggestions? Wondering if you’ve come across this before… Thanks so much, love the plugin!

    I should note that it’s not important that they show up as hierarchical on the new/edit event page, or even in the dropdown on the fullCalendar, just that the events get filtered correctly when displayed.

    Brian Hanna
    #23200

    Hi Brian,

    The issue is that the fullCalendar, when filtering by venue, checks that the event has a venue ID which matches exactly the ID of the selected venue. It doesn’t check if the event is at a venue which is the child of the selected venue because the plug-in works on the assumption that venues are non-hierarchical.

    Unfortunately there is no solution to this (except perhaps to use categories). The problematic code is here: https://github.com/stephenharris/Event-Organiser/blob/develop/js/frontend.js#L180-L182

    There maybe another way around this, but which involve re-factoring the surrounding code that I’ve just linked to. You could (you can’t as it is) use the wp-js filter to over-ride whether an event appears or not, which could take into account your own logic concerning hierarchical venues.

    The event.venue_slug would be still only be that, a single-slug but you could use another filter to insert the extra information (i.e. the parents of that venue).

    I could look at introducing the necessary changes in frontend.js for the next (non-patch) release.

    Stephen Harris
    #23244

    Stephen

    Thanks for the quick reply. It would definitely be a nice feature as I can think of some use cases where hierarchical venues would be helpful and considering venues are already a taxonomy that could be classified as hierarchical, would make sense as something to add in down the line.

    In the meantime, I will see what I can hash out with the js hooks (didn’t even know those existed until you pointed me in the right direction – those are nice!) and if I come up with anything helpful logic I can make a pull request on Github.

    In the meantime, I have set up a custom taxonomy-event-venue.php template that checks for venue children and adds them to the fullCalendar args array, which means separate pages for each “parent venue” with customized dropdowns of child venues. If anyone stumbles across this, it is a helpful workaround that I have documented (simply) in this gist: https://gist.github.com/brianjohnhanna/b366a386ba3b69e76f720d221ab2be22

    Brian Hanna
    #23391

    Hi Brian,

    Just to let you know 3.1.1 refactored that hook. So you can now completely over-ride the logic for determining whether or not an event appears on the calendar via that JS hook.

    That should help you get most of the way there.

    Stephen Harris
    #23400

    Stephen – you are awesome. I look forward to playing around with the hook and customizing it to my needs. Thank you so much!

    Brian Hanna
Viewing 5 posts - 1 through 5 (of 5 total)
To enable me to focus on Pro customers, only users who have a valid license for the Pro add-on may post new topics or replies in this forum. If you have a valid license, please log-in or register an account using the e-mail address you purchased the license with. If you don't you can purchase one here. Or there's always the WordPress repository forum.