I'm using Solspace calendar on my EE site to handle calendar events. I am also using the built in simple search for the search feature on my site. I would like to have the search include calendar events in possible results, but only if the event has not passed already. I don't see any way to do that with the simple search, unless I can set the calendar events to automatically expire after they pass. Does anyone know of a way to either auto-expire calendar events after they pass, or is there a different search module I can use that would take into account the end date for an event based on how Solspace calendar tracks them (start date/end date, etc.)



1 Answer 1


Calendar events do not use regular entry entry_date and expiration_date values, but rather specialized event data stored in Calendar itself. Since the EE simple search form uses the regular EE channel entries library, it won't be able to filter for upcoming events based on entry_date and expiration_date.

Further, occurrences of an event are not necessarily channel entries themselves (unless you edit one of the occurrences, in which case only that occurrence becomes an entry). The EE simple search module will therefore not be able to display separate occurrences as if they were entries, even less discern upcoming occurrences.

To display upcoming events (another way of saying "events that have not passed yet"), you'll need to use {exp:calendar:cal}. You could try feeding the {entry_id} from your search results into a tag starting like this:

{if channel_short_name == "calendar_events"}
      date_range_end="+1 month"
    // ...more code

This will display, within your search results, all occurrences in the coming month for that event entry. As a note, if you're ordering your regular results by entry entry_date or expiration_date, these occurrences won't "mix in" chronologically with your other regular channel entries.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.