Firefox PHP

Module: Check a post for errors

Posted by Brian Moon 
All files from this thread

File Name File Size   Posted by Date  
check_post.tar.gz 1.8 KB open | download Brian Moon 08/09/2007 Read message
Module: Check a post for errors
August 09, 2007 06:02PM
This module will allow an admin to enter regular expressions to check for things they don't want posted in their forums. If a match is found, an error will be raised during the posting process. You can select to have subject, body or author checked or to have them all checked.

One example might be to try and stop posts with all capital letters in it.
^[A-Z \.!\?\(\)]+$
That regular expression matches any string that contains only those characters. So, if the subject for example contained only capital letters, spaces, and the punctuation .!?() it would match. Its not perfect, but this is a very flexible module for lots of uses.

Brian - Cowboy Ninja Coder - Personal Blog - Twitter
Attachments:
open | download - check_post.tar.gz (1.8 KB)
Re: Module: Check a post for errors
August 09, 2007 10:48PM
Thanks Brian. There one I can strike of my wish list :) I will for sure use this to block postings like (tranlated) "question", "need help", "new guitar", "searching", "help me", "beginner", "hello", etc. I spend quite some moderation time on fixing the subjects to represent the content of the message instead of a generic subject, so having a mod take care of telling users what to do is great.


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: Module: Check a post for errors
August 10, 2007 05:40AM
The only thing I am worried about is that I did not give you access to the full regex, just the stuff between the delimiters. So, blocking words could be a little hard I suppose. Tell me what you guys think and I will adjust if needed.

Brian - Cowboy Ninja Coder - Personal Blog - Twitter
Re: Module: Check a post for errors
August 10, 2007 01:12PM
Thanks for writing this Brian, it is a great flexible solution for stopping people from posting in ALL CAPS, and in other annoying ways!

I've installed it and it does exactly what it needs to.

A few notes:
- If multiple rules fail, only the last error message seems to be displayed. I guess this is by design, and is fine by me.
- The checks are not run when the user previews their post. Again, this is not really a problem.

/\dam

--
My notable Phorum sites:
Movie Deaths Database - "review comments" system mostly powered by Phorum
Learn Chinese! - integrated forum quiz
Re: Module: Check a post for errors
August 10, 2007 04:59PM
Quote
sheik
- If multiple rules fail, only the last error message seems to be displayed. I guess this is by design, and is fine by me.

Yeah, it bails out as soon as it sees an error.

Quote

- The checks are not run when the user previews their post. Again, this is not really a problem.

Yeah, the check_post hook is not run on preview. Its basically the same as not putting a subject or body and hitting preview.

Brian - Cowboy Ninja Coder - Personal Blog - Twitter
Sorry, only registered users may post in this forum.

Click here to login