Delete Unreplied Topics plugin

The Delete Unreplied Topics plugin scans designated categories for topics that exist over x days which did not get any replies, and deletes them. This keeps your forum clean of topics that did not gain any traction for whatever reason.

Settings:

  • delete_unreplied_topics_categories the categories to work on
  • delete_unreplied_topics_days the amount of days before a topic without any posts will be deleted
  • delete_unreplied_topics_dry_run a safety net to test and make sure the plugin will not delete unwanted parts of your forum

The plugin logs its actions in /logs.

The repository can be found here.

This work has been sponsored by @outofthebox.

13 Likes

Amazing work @RGJ! Your skillful development of this plugin is a huge time saver and greatly improves our community.

8 Likes

Thank you for writing this.

It would be good if it would log the topic title as well as ID (DeleteUnrepliedTopics removing Topic ID #{t.id}).

And it would be more reassuring if delete_unreplied_topics_dry_run would default to true :slight_smile:

2 Likes

Thank you, those are very useful suggestions. I have made those changes.

5 Likes

I finally installed this plugin, so far in dry run mode. It seems correctly to identify the topics to delete.

In the logs each line like DeleteUnrepliedTopics would remove Topic ID *number* (*topic title*) (dry run mode) is preceded by the X indicator for an “Error”. I’d have expected it be “Info” or even “Warning”.

@RGJ Is that expected? Thanks. I’m using the latest version of Discourse.

1 Like

Yes, that seems to be by design. I vaguely remember that there was some issue with debug levels so I made it to be an error. Sorry for any confusion!

4 Likes

Thanks for clarifying that. The plugin works as expected, thanks - though, interestingly, unlisted topics are displayed by Discourse as having at least one reply (i.e. the act of unlisting) which means your plugin does not delete them.

1 Like

I’ve just noticed that your plugin doesn’t delete pinned topics either, as the act of pinning a topic is deemed to be a reply. This turns out to be a good thing.

2 Likes


Do you know why these error messages appear?

When this is enabled the plugin will only log its actions and not actually perform them.

2 Likes

Hello,
this plugin seems to be exactly what I’m looking for, but I’m a bit anxious to install it as there hasn’t been any activity in the repo for 4 years.
Do you think it should still be working with current Discourse version, or is it likely to break anything?

1 Like

It was just written very well :sunglasses:

And it’s a very specific plugin. I’m 99,9% sure it still works correctly.
You can first set it to “dry run” so it won’t break anything, if that comforts you.

4 Likes

Perfect. Thanks for the quick response!

1 Like

@RGJ based on multiple requests from other users:

couldn’t this plugin of yours be used as the foundation for a new plugin that deletes topics in a particular category if they are older than N days, set by the user?

If your plugin is already scanning topics, wouldn’t it possible to set some rules that say:
If category is X, scan for topics where the creation date and the current date is more than N days, and if so, delete them.

I don’t know the ins and outs of creating and changing plugins, but this would be a great addition.

It would be a matter of removing a single line. (Or, obviously, creating a setting max_replies, default 0, which can then be set to 99999 to accomplish the desired effect).

That said, I’m struggling to think of a good use case for this.

3 Likes

One case use I could think of would be maybe a ln off topic lounge that resets each month. As meant for maybe a let off steam type free for all.

Otherwise not sure either of many use cases. Plus though ATM think it is manual only unless an automation could be made. To simply apply topic timer with the delete function? Don’t recall if it gives option to delete topic or if it is just replies.

1 Like

There’s a discussion about different cases here:

For my particular case (similar to one of the users on that topic above), I would like to have a category called “Classifieds” for musicians (e.g. singers who want to find producers and vice-versa), but I don’t want topics to be available forever, or that get renewed just by adding a new reply. I want to set a timer, for example, where all topics inside that category that are 2 weeks old get deleted, regardless of the replies. That way, users know that they need to create a new topic, instead of just adding a meaningless reply such as an emoji, otherwise the topic will be filled with 1 emoji replies, which looks bad. It also forces users who really want to find people to work with, to put in the work and create a new topic. This kinda filters out people who are too lazy to create a new topic, save their text on their computer or phone, etc.

Hope it makes sense?

So if this indeed becomes a plugin and I’m using Communiteq for my hosting, what plan would I need to be on to being able to install the plugin?

You could set auto-close on the topics?

That would be the Professional plan.

2 Likes

This would be less effective than your plug-in, because it would allow old topics to be visible when they are no longer effective. Why would I want topics of people looking for musicians from 3 years ago? I want them deleted.

Also, closing the topic is the same as your plug-in: it depends on replies, which is not what I would like to have. As i mentioned, this would be prone to having users just adding an emoji type comment to let the topic stay active.

I basically just want topics to be deleted after N days/weeks, no matter what. And as you can see from the topic I shared, other users have the same need. Since your plug-in is already doing something similar, I would assume that creating a version to delete regardless of the replies wouldn’t be a big deal and each admin could pick what they want for their forum based on their needs.

Wrong question, BTW. What you want is totally unrelevant. What a user want is relevant. And topics don’t cost anything.

1 Like