S.AAKASH_MUTHIAH seeks to enforce a required tag for topic creation in a specific category using the Blackout theme’s JavaScript. chapoi suggests using built-in tools by creating a tag group and selecting it in the category settings. However, S.AAKASH_MUTHIAH reports that this method isn’t working as expected, allowing topics to be created without the required tag. chapoi confirms this might be a bug and pings the relevant team. Later, chapoi clarifies that the restriction doesn’t apply to admins, which Kartoon agrees with, stating that admins should be able to override such constraints. tobiaseigen confirms that the suggested method works for non-admin users and reminds that admins are not subject to these restrictions.
I want to enforce a rule in my Discourse forum where, for a specific category only, users must attach a particular tag when creating a topic. Users can attach any number of tags, but one specific tag must be present; otherwise, the topic creation should be blocked with an error message.
I’m using the Blackout theme (or custom theme), and I want to add this validation client-side with JavaScript.
Is there a way to add such a condition in the theme’s JavaScript (e.g., in the Blackout theme’s custom code) to:
Check if the topic being created belongs to the specific category,
Check if the required tag is attached,
Show an error and prevent topic creation if the required tag is missing?
If yes, could someone please share an example or the best approach to do this?
I personally would rather it not apply globally, the point of Admins is supposed to be you can override anything and this would make it impossible to override this specific thing. Unless you add a way to get around that, which just seems like a lot more work than leaving it as is.
I mean Admins can post in closed topics just like they’re normal topics, and that’s obviously intended. It’s completely normal behavior for them not to be constrained by anything they put on the site IMO
@S.AAKASH_MUTHIAH were you able to resolve your issue? I think @chapoi’s advice works for your use case. You just have to remember that you as admin are not impacted by it, as you are not impacted by other restrictions for non-admins.