Open hcavanaugh opened 1 year ago
To update on this: The first issue with retrieving the series id was cleaned up by using the ORM function tec_series()
to get the id by the event_post_id:
$series_id = tec_series()->where( 'event_post_id', $source->databaseId )->first()->ID;
However, the second issue on hiding subsequent recurrences persists. For now, we are using the Event Calendar's REST API to retrieve events, using the tribe_events_archive_get_args
hook to set the tribeHideRecurrence query argument to true.
@hcavanaugh Is this issue persisting in v0.3.1?
@kidunot89 Tested using GraphQL queries with tribeHideRecurrenceDefault
set to true in TEC settings, recurring events return as expected: Only return the next upcoming recurring event in a series. Thank you for the fix and checking on this!
To other readers, note that where: startsAfter must be set to "now" in the query:
events(where: {startsAfter: "now"}) {
nodes {
title
link
startDate
}
}
Tested in both: TEC 6.1.3 + Pro 6.1.1 (with ql-events/feature/events-query-fix PR, otherwise
events
query returns empty, see #59 ) TEC 6.0.3.1 + Pro 6.0.2QL events 0.3.0
When using graphQL to retrieve recurring events, the
eventId
is depreciated for thedatabaseId
, but thedatabaseId
field gives the occurrence id. In the database, occurrence_ids are associated with the parentevent_id
post ID that originally created the event. There is currently no registered graphql field that gets the event_id associated with an occurrence.For example, if you want to retrieve the event series ID associated with a given recurring event to run a separate
tribeEventSerie
query, the only event data retrieved in theevents
query that contains that event_id is the&p=x
or038;p
parameter value in theguid
field.It's definitely a hacky way to go about getting the series id, but it does work when using
tec_event_series
:The other issue is that when
tribeHideRecurrenceDefault
is set to true in TEC Settings, this setting is not applied to the GQL queries. I tried the fork in #22, but this did not hide recurring events beyond the next upcoming recurring event in a series.There is no
hide_subsequent_recurrences
in the where arguments. I tried to create ahide_subsequent_recurrences
where arg and call theCondense_Events_Series
class controller inEvent_Connection_Resolver::sanitize_input_fields
if that where arg is true, but was receiving anUndefined constant
graphql error when calling that controller.This latter issue is imperative for our work: We want to be able to query all single events and only the next upcoming recurring event in series within a given date.