Word Count Limits

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Word Count Limits
« on December 5th, 2012, 04:02 AM »
OK, so I ported my old Word Count Limits plugin to Wedge[1], and I did some overhauling in the process.

The idea of the plugin is to limit posts that are either too short or too long, and do something about it. In this case, it hooks into the moderation filters stuff, so you can make moderation systems as flexible as you like.

Want to enforce a minimum of 5 words on every post? Easy.

Want to enforce a minimum of 100 words on every new topic (not just replies), but only in a certain board? Almost as easy. (Moderation Filters > New Rule > Prevent the post when... a new topic is started... where board is <given board> and the number of words in the post is less than 100 words)

Yup, moderation filters is damn awesome, even if I do say so myself haha. Screenshot of this feature is attached.

Also, I made it so it could be both words and individual characters (where a complex accented letter or other multi-byte character is counted as 1) could be handled, through the same facility.

There is one caveat: right now moderation filters has one major flaw, in that the 'prevent the post being made' message is not very helpful - it just says 'The post contained content that is not permitted on this forum'. I know about that, I just don't know yet how best to fix it - I've been wrestling with it since I added mod filters months and months ago. The problem is that the combination of rules that could be causing a post to be denied is extremely complicated and potentially multiple rules could all cause the same result.

Imagine a rule that says the post will be prevented if the word 'fuzzlewuck' is in the post, but only if it's in the posted in certain boards, and they have less than 100 posts. How best to convey that to the user? (But the moderation filters can trivially enough create that set of rules.)

Anyway. I digress. Have at it. (It's in the plugin area for beta testers)
Posted: December 5th, 2012, 03:58 AM

Also, the API for extending moderation filters needs cleaning up. I know live627 kind of hinted at that, but damn it is ugly. When I figure out the above problem, I'll clean up the API while I'm at it, it'll probably need it.
 1. http://custom.simplemachines.org/mods/index.php?mod=2117 if you're wondering. Though this is better, even if the underlying detection for word count is much the same.

📎 word_count_limits.png - 28.96 kB, 898x468, viewed 227 times.

When we unite against a common enemy that attacks our ethos, it nurtures group solidarity. Trolls are sensational, yes, but we keep everyone honest. | Game Memorial

MultiformeIngegno

  • Posts: 1,337
Re: Word Count Limits
« Reply #1, on December 5th, 2012, 11:29 AM »
Nice! :))
On StackOverflow there are some limitations and every error appear in one line (so without mixing them: "you posted a too short message AND used badwords")..

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: Word Count Limits
« Reply #2, on December 5th, 2012, 12:37 PM »
I was thinking about just providing the option for admins to specify their own message to users. That way they can make the description as detailed or as vague as they like.

Re: Word Count Limits
« Reply #3, on December 5th, 2012, 05:42 PM »
I think that's a good idea.
The person that makes the rule does that with a specific goal in mind and knows best what to say in the message.

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: Word Count Limits
« Reply #4, on December 5th, 2012, 08:19 PM »
The only downside is that it needs to support multiple languages - and that all has to be stored in the same place. I think there should be enough room but it might be worth a few tests.
Re: Word Count Limits
« Reply #5, on December 10th, 2012, 12:16 AM »
I don't want to get into how much evil had to be perpetrated to make this happen. I have yet to clean the sacrificed programmers' blood off the altar. But here we go, including multiple language support.

📎 mod_filters_lang_warning.png - 43.54 kB, 926x728, viewed 179 times.