API questions

Home Forums Calendar Products Events Calendar PRO API questions

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #974240
    Henrico County
    Participant

    We are updating our site to include events on specific department pages. Each department has a single organizer in the Events Calendar Pro plugin.

    This is what we need:

    1. A way to get a list of all organizers (name and id) so I can code a <select> statement dropdown.
    2. A way to display the next 3 or 4 future events for a specific organizer.
    3. A way to have the number of future events returned for a specific organizer (really just need to know if there are future events for a particular organizer to know whether or not to display the event block for this department).

    I can go into the WordPress post and postmeta data directly to get this information – but I would rather get this information from available API tools if they exist.

    Can you please point me in the right direction?

    Thanks!

    #974251
    Henrico County
    Participant

    I have resolved #1 using tribe_get_organizers. What I need for #2 (and could be used for #3) is something like tribe_get_organizer_events ( $organizer_id ). Does this exist?

    Thanks!

    #974488
    Barry
    Member

    Hi @henricocounty,

    Glad you were able to solve the first aspect of this 🙂

    I’m not actually aware of any functions that behave in the way you require for the second and third points, you’d probably need to build out your own customization here or leverage something like the venue shortcode provided by this third party plugin (though please note we do not provide support for it here).

    If you want to build this out yourself the basic idea is that each event has an associated piece of post meta data (“_EventVenueID”) which points to the corresponding venue post, so, with some custom querying, it’s fairly straightforward to piece this together if you are familiar with WP dev in general.

    I hope that helps!

    #974717
    Henrico County
    Participant

    Thanks, Barry, for your response. Can you tell me if https://theeventscalendar.com/function/tribe_organizer_upcoming_events/ is available? I get a Fatal error: Call to undefined function tribe_organizer_upcoming_events() when I attempt to use it. And – it doesn’t appear to give any return data in the function verbiage.

    I have the queries I need into the post and postmeta data – but if the meta key names change – I would have to update my code and the code would break until I realized there was an issue. I was trying to use the API but I need an organizer’s events (not a venue’s events) and I don’t see it.

    Thanks for your help.

    #974738
    Barry
    Member

    Ah yes, good find!

    You should certainly be able to use that (and it’s sister function, tribe_venue_upcoming_events(), too) although direct control over the number of posts they return is not too easy.

    If you’re getting a fatal (undefined function) error when you try to use it, it may be that you are trying to access it too early in the lifetime of the request.

    What action is your code running on, or where does your code live if it isn’t wrapped in an action call?

    #974788
    Henrico County
    Participant

    The function was being called in a shortcode. The page has been loaded and the content area of the page calls this shortcode. So – it seems like the function should be okay to run.

    I’ve moved my call to tribe_get_organizers() in this same section – and it works perfectly.

    But tribe_organizer_upcoming_events() does not. The tribe_organizer_upcoming_events is not listed as an API function. And tribe_venue_upcoming_events also gives me a fatal error. It seems these two functions are not part of the API…? Is there something I need to do to be able to utilize these functions?

    #974824
    Barry
    Member

    It looks like the version of The Events Calendar currently running at the URL you provided when you opened this topic is a couple of releases out of date: our documentation typically reflects the latest release, so I’d advise updating if you need to take advantage of these functions 🙂

    #974827
    Henrico County
    Participant

    Okay. Thanks. You are right – the testing environment I am working on is a bit dated. Our production version is current. I will work on getting that updated. Thanks for your help.

    #974831
    Barry
    Member

    No problem!

    I’ll go ahead and close this topic, but of course please don’t hesitate to create new topics as needed if we can assist with anything else 🙂

Viewing 9 posts - 1 through 9 (of 9 total)
  • The topic ‘API questions’ is closed to new replies.