• Resolved ssvtom

    (@ssvtom)


    When using the newer ORM interface, it seems there’s an inconsistency between events and venues. If I compare the two calls:

    $event_post = tribe_events()->where('ID', $event_id)->first();

    $venue_post = tribe_venues()->where('ID', $location_id)->first();

    both return WP_Post results, however $event_post holds all add’l TEC data such as start_date, end_date, duration, multiday, etc, whereas $venue_post only returns core wp post data and is missing for instance address, zip code, city, etc. I am, of course able to access venue meta data with

    $venue_address = get_post_meta($location_id, '_VenueAddress', true);

    Is this how this is supposed to work? I would expect this data to also be included in the WP_Post result for venue…

    I am using TEC 6.9.0, WP 6.7.1, PHP 8.2.6

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter ssvtom

    (@ssvtom)

    After investigating this a bit further, it turns out, that the ORM all() and first() functions for venues do NOT return decorated post objects as there is no format_item function in the venues repository implementation; i.e. all() and first() return raw WP_Post objects (as returned from get_post()).

    Potential solutions:

    • add a format_item function to the current venue repository implementation
    • use the undocumented filter tribe_repository_venues_format_item to provide a custom format_item function

    For the first solution pls have a look at the Pull Request https://github.com/the-events-calendar/the-events-calendar/pull/4870, which includes fixes for two issues we encountered.

    Wrt. the second solution

    add_filter('tribe_repository_venues_format_item', function($formatted, $id) {
    return tribe_get_venue_object($id);
    }, 10, 2);

    did the trick for me.

    Plugin Support Darian

    (@d0153)

    Hi @ssvtom

    Thanks for reaching out.

    I truly appreciate you taking the time to share your feedback and suggestions. I’ll ensure this is shared with our team for further review and consideration.

    Feel free to let me know if you have other questions or concerns.

    Plugin Support Darian

    (@d0153)

    Hi there,

    It appears that there hasn’t been any recent activity on this thread, so we’ll go ahead and close this for now. However, if you have any additional questions or concerns, feel free to start a new thread.

    Plugin Support Chika Ibeneme

    (@chikaibeneme)

    Hi @ssvtom ,

    Thanks so much for your patience here.

    With the latest release of our plugin we’ve resolved your issue, when you get a chance we ask that you please update your plugins in order to take advantage of this release.

    You can learn more about our releases here:

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.