Add event: filter to the topic filter query language (Discourse Events plugin extension)

AI-generated summary

nathank proposed extending the Discourse Events plugin to support event: filters within the topic filter query language. Currently, isolating event topics from non-event topics using the /filter route is difficult, as existing workarounds like the /upcoming-events calendar route or client-side theme components lack true server-side filtering, pagination support, and permission awareness. The proposal suggested a syntax similar to the Solved plugin (status:solved) to create shareable, filtered lists of events across any category.

In response, awesomerobot implemented a comprehensive suite of filters and sorting options, which were merged into the core plugin. The new capabilities include:

  • Status filters: event:any (topics with events), -event:any (topics without), and specific states like event:upcoming, event:ongoing, and event:past.
  • Combinators: Commas allow “any of” logic (e.g., event:upcoming,ongoing), while hyphens exclude specific states (e.g., -event:past).
  • Date ranges: event-after:YYYY-MM-DD and event-before:YYYY-MM-DD allow filtering by start dates.
  • RSVP filtering: event-attending:<username> or event-attending:me to find events a specific user is attending.
  • Custom sorting: order:event-start and order:event-start-asc for chronological sorting.

nathank praised the implementation and requested an additional order:event-smart sorting option to replicate the behavior of the “sort categories by event start date” feature, which sorts upcoming events soonest-first followed by past events most-recent-first. This would allow the “smart chronological” view to be applied to custom topic lists, not just dedicated categories. putty confirmed that a similar “smart” sorting feature had been added to their custom Event List Calendar theme component.

:information_source: This would allow filtering for topics that have an Event attached via the Events plugin, using the /filter route and the Custom Topic Lists plugin.

The problem

The Discourse Events plugin creates rich event topics, but there’s currently no way to isolate them from non-event topics using the topic filter query language.

The existing workarounds all have downsides:

  • The /upcoming-events route shows events as a calendar, not a filterable topic list - although it perhaps should!!!
  • The Events Calendar on Custom Lists theme component has a client-side “Only show topics with events” setting, but it operates after the list loads — it’s not a true server-side filter, doesn’t play well with pagination, and can behave inconsistently
  • Convention-based approaches (dedicated categories, required tags) require strict content management discipline

Proposed solution

The Events plugin should extend the topic filter DSL with an event: filter, following the same pattern already used by the Solved plugin (status:solved / status:unsolved) and the Assign plugin (?assigned=username).

Example syntax:

event:yes                          # Topics with an event attached
event:no                           # Topics without an event (via -event:yes)
-category:announcements event:yes  # Events outside of announcements
tag:meetup event:yes order:created # Tagged meetup topics that have events, sorted by newest

A status:events variant could also be considered for consistency with the existing status: namespace, but event: reads more naturally for the primary use case.

Why this is the right layer

The filter documentation explicitly states:

The Events plugin already stores structured event data (start date, end date, status, RSVPs) in dedicated tables. A server-side filter can query this efficiently — something a client-side component simply can’t do.

Use case example

As a community manager, I want a shareable URL — linkable in my sidebar, embeddable via Custom Topic Lists, and usable in the Filtered Topic Lists theme component — that reliably shows all topics across any category that have an event attached, sorted by event date.

Today, I can’t construct that query with confidence. With an event: filter, I could:

event:yes order:created

…and get a clean, paginated, permission-aware topic list of all events on my site.


Related Topics

3 Likes

good idea! how about:

  • event:any topics with an event
  • -event:any topics without an event
  • event:upcoming events that haven’t started yet
  • event:ongoing events happening now
  • event:past events that have ended, including closed events
  • event:upcoming,ongoing a comma means “any of”
  • -event:<state> excludes topics whose event is in that state (e.g. -event:past)
  • event-after:YYYY-MM-DD events starting on or after a date
  • event-before:YYYY-MM-DD events starting before a date
  • event-attending:<username> events that user is going to
  • event-attending:me events you’re going to
  • order:event-start sort by event start, latest first
  • order:event-start-asc sort by event start, soonest first
5 Likes

This is brilliant - and I’m enjoying using it!

Do you think it would be possible to add one more event-specific filter to replicate the functionality in existing Events categories?

What I’m missing is the behavior of sort categories by event start date enabled — upcoming events (soonest first), then past events (most recent first).

Proposal:

order:event-smart  # upcoming soonest → furthest, then past most-recent → oldest

This would let me replicate the Events category experience via the filter, so I can put the same “smart chronological” view on any list, not just dedicated categories.

1 Like

Hey Nathan, fyi I just added this to my Event List Calendar TC.

2 Likes