Page 1 of 1

A Form of Auto-Moderation/Post Filtering...

Posted: Tue Apr 21, 2015 2:24 pm
by Jackanape
I've been considering this for a while, now, and I'm going to sit down this week and accomplish it, come hell or high water...here's the thought:

Like many other boards, we have a specific forum or topic put aside for Jokes, another for videos, etc. Also like many other boards, we have people coming in and posting jokes in the politics section--ok that was a bad example, LOL--or in the "how to" section, posting videos in the "Recommended Reading" section, you get the idea. Most times, this is because the user is new and maybe not used to forum heirarchies yet. Obviously, we try to help them along, and in time, experienced users get it down, and help the next ones to come along.

However, in the meantime, new users' mis placed posts have to be manually moved or deleted, placing the onus squarely on the admin and mod staff, and as we all know a tired mod staff is a cranky mod staff. Never good for building community. My solution:

During the posting process, add some "phrase filters" and "word filters" to the mix that will gently give the poster reminders where a post may belong. For example:

Code: Select all

if (stripos($data['post_text'],'joke') !== false) 
		{
		trigger_error('Jokes don't go here!  Try again in our Joke forum!  You can find it <a href="xxxxx">HERE!</a>  We can't wait to read it!')
		}
or

Code: Select all

if (!stripos($data['post_text'],'Contest Submission') !== false) 
		{
		trigger_error('This is our contest forum--you need to start your post with "Contest Submission" in order for it to be accepted!  Hit the back button and try again!')
		}
All designed to help new members find their way, while lifting some of the tedious work from the mods tasklist.

You get the idea. My question is, where is the best place to set up this routine? posting.php? message_parser.php? Someplace else I'm not looking? In most of my hacks, Ive tried not to dig too deeply into phpbb3 functions, but I suspect this one will require it.

What do you think?

Re: A Form of Auto-Moderation/Post Filtering...

Posted: Tue Apr 21, 2015 2:29 pm
by david63
But would this not mean that the "new" member who was posting in all good faith would be told that they were in the wrong place and be directed to the "correct" place where they would have to enter the post again? If so then it is, in my opinion, a sure fire way to alienate new members (it would me)

Re: A Form of Auto-Moderation/Post Filtering...

Posted: Tue Apr 21, 2015 2:42 pm
by Jackanape
david63 wrote:But would this not mean that the "new" member who was posting in all good faith would be told that they were in the wrong place and be directed to the "correct" place where they would have to enter the post again? If so then it is, in my opinion, a sure fire way to alienate new members (it would me)
Yes, I suppose it would. However, they're not coming into a vacuum; we have a comprehensive welcome package, including a personal helper from the current membership for every new member. This is to catch the occasional mistake, yes, but there's a bigger issue:

There's always a few folks who just don't care what you say, or how you say it, they'll just do what they want. Like the people that drive the wrong way down a one way street. Now, we could follow them around, move or delete their posts, send friendly reminders, etc., but these folks aren't wired to understand that. Doesn't make them bad to have around, they just need some more clearly defined limits. One could argue "just issue warnings and ban them if it gets out of hand", but isn't THAT far more alienating? People are different, and learn and respond differently.

So NO, I wouldn't recommend this to an out of the box phpBB3 board, without FIRST having a comprehensive welcome/indoctrination system in place. That said, I have that, and I'm now moving ahead with this.

Anyone with any ideas where to look to begin this project?

Re: A Form of Auto-Moderation/Post Filtering...

Posted: Wed Apr 22, 2015 12:26 pm
by Jackanape
I'm still searching everywhere for a flow chart or order of events for the phpbb3 posting process. I've never dug deeply into it, and don't want to break it by fiddling. With all the functions pulling me back and forth, tracing it has been a bear so far.

Obviously, I'm starting in posting.php, and then heading over to message_parser.php, but I'm getting mired trying to suss out the order of business here. Can anyone point me to a good tutorial for dissecting the posting process?

Re: A Form of Auto-Moderation/Post Filtering...

Posted: Thu Apr 23, 2015 1:46 pm
by Jackanape
I decided to hit this right where it starts before any bbcode parsing, etc., really takes place.

So, in posting.php, around line 666:

Code: Select all

if ($submit || $preview || $refresh)
{
	$post_data['topic_cur_post_id']	= request_var('topic_cur_post_id', 0);
	$post_data['post_subject'] = utf8_normalize_nfc(request_var('subject', '', true));
	$message_parser->message = utf8_normalize_nfc(request_var('message', '', true));
I added two "check" variables:

Code: Select all

if ($submit || $preview || $refresh)
{
	$post_data['topic_cur_post_id']	= request_var('topic_cur_post_id', 0);
	$post_data['post_subject'] = $subcheck = utf8_normalize_nfc(request_var('subject', '', true));
	$message_parser->message = $postcheck = utf8_normalize_nfc(request_var('message', '', true));
Then, right afterwards, I ran some quick content loops, like this one:

Code: Select all

if (stripos($subcheck,'joke') !== false || stripos($subcheck,'funny') !== false ||stripos($subcheck,'humor') !== false) 
		{				
		$message_parser->warn_msg = 'If you are trying to post a joke or funny picture, please post it in one of these topics:<br />&nbsp; &bull;<u><a href="' . append_sid($phpbb_root_path . 'viewtopic.' . $phpEx, 'f=128&t=14233') . '">Joke of the Day</a></u>
		&nbsp; &bull;<u><a href="' . append_sid($phpbb_root_path . 'viewtopic.' . $phpEx, 'f=128&t=13362') . '">Funny Images, Videos, Memes, and Demotivational Posters</a></u><br />Thanks for your understanding!'';
		$error[] = $message_parser->warn_msg;
		$message_parser->warn_msg = array();
		}
In the above case, I'm checking the post subject, but I also have some checking the post text for formatted contest keywords, if the keywords for the contest submission are posted in the right forum, etc., which both helps members know where to post without being scolded by a moderator, and keeps the onus off the mod team.

I did, however, eliminate the "trigger error()" I had planned on using, in favor of the $error[], which gives the normal posting warning, returning the whole form, so someone can cut and paste their post, and easily take it to where it needs to go, without retyping the whole thing.

I'm sure this could have been done neater, but it works, and quite well, at that. I'm open to suggestions, questions, or comments, if anyone has any.

Cheers!