Limit the amount of topics per user in a specific category

Originally got the idea from this topic: Limit one post per person? though I had a slightly different use case for it.

On a community that I’m a forum moderator for, I got tired of people creating multiple advertisement topics in the advertising section. At first, I created a feature request on these forums, but after some trial and error I came up with my own plugin that does the job.

Current features list
  • Configurable list of enabled categories is availalbe in the admin settings page.
  • Configurable message that will be used to notify the user that their post was closed.
  • Configurable amount of allowed topics one can post in a category before it is blocked.
  • Configurable toggle to ignore staff members creating topics.
  • Configurable toggle to delete the closed topic after 24 hours.

Of course there are plenty of things that can/need to be improved but considering this is my first plugin that I tried to make myself (instead of editing others) I feel like it was worth releasing for anyone that wants to use or improve it.


This is what you’ll see when you create an excess topic:

And this is what the admin settings look like:

Feel free to fork, pr or edit it however you like. I’d love to see some improvements by the community. This would also help me out while starting to learn more about discourse plugin development. :slight_smile:

Planned features
  • Something I would like to add later on is an option to auto-delete the closed topics 24 hours after being closed. But so far I’ve not been able to figure out how to set a Topic Timer when using Ruby. If anyone can help me figure this out: that’d be great!
    This has been added in a recent update (13-04-2018), it now has a configurable toggle in the admin settings page to enable/disable topic deleting after 24 hours.
  • Not sure if this will be added anytime soon, but I’m hoping to implement these features into the UI itself to prevent users from creating the topic in the first place, instead of locking the new topic they just created. If anyone wants to help me create this then please let me know because I could use some help figuring this out.
  • Add configuration options in the category settings page and allow for category-specific limits and options.

Support for multiple categories has been added in this commit. Note that all settings (the amount of topics per category, staff exemption, etc) are shared/used for all those enabled categories. There’s no option to set per-category limits right now.

Automatic deletion of the closed topics after 5 minutes is now added as an option in the admin settings. (Enabled by default)

1 Like

Firstly, congrats on releasing a plugin. From experience, I know it’s a non-trivial acheivment!

I’m interested in this type of plugin - in my case I’d like to avoid people dominating certain “firestarter” topics. Although I’d like to deploy a softer implementation that perhaps rate-limited users as opposed to preventing users posting

In fact, it seems a bit heavy-handed to allow the user to take the time to write a post, only for it to be immediately closed/unlisted/deleted afterwards.

With this plugin, I think it would be friendlier if the composer UX was modified to prevent a user wasting time posting a new topic if they’ve reached their limit.


That was indeed my initial goal, but after many attempts not working out the way I needed it: figured this would work for my use case just as much, considering most people just copied their old advertisements and “spam” created a new topic for it every day to “bump” it. Though I do prefer the idea you mentioned, if I find a way to get that to work or if anyone has some suggestions then I’d defninatly change it.

1 Like

Small update:
Changed the 5 minutes auto-deletion timer to be 24 hours instead, 5 minutes was nice for keeping the forums clean quickly, but it was too quick for most users to realize what was happening or to even “appeal” the auto-closing of the topic before it got deleted. 24 hours gives staff and users enough time to cancel the deletion if there is a need for that.