Dev Question: FIltering all discussion queries by selected categories
I'm just wondering the best way to go about this.
I have a forum with some metadata against each category. That metadata will determine which categories a user can see at any time. I would like to limit the discussions a user can see to just the discussions that match the relevant metadata.
I have looked at add-ons such as hidecategories that visually hide posts in specified categories using just CSS. I would like to filter these discussions at the query level - so when a discussion query is performed, or when a search is done, only a sub-set of categories is included in the results.
Now in WordPress there is a central core query object that performs all the queries, and you can hook into that to modify how it filters results. That same query object is used in all instances - searching, index pages, displaying posts etc. Is there something similar in Vanilla that can be hooked into, or are the queries distributed all over the place?
Now, this is not a permissions-based thing. I do not want to use roles to prevent a user from ever seeing a category. I just want to effectively layer a category-based filter over the top of all discussion queries. Is there is an add-on that does something like this, that may give me some pointers?