Konloch Software

Blocking Forum Spam

Published 08/12/2024

Since 2011 I have been a sys-admin for various public-facing forums. The kind spambots have been written specifically to sign up and spam on.

These are the steps I follow on my forums to ensure spambots are blocked, and if they get around these measures, they can be quickly dealt with.

  1. After sign-up the initial user-group should be classified as Unverified User but not a User - key differences:
    • Unverified Users get automatically upgraded to User after posting an introduction thread.
    • Unverified Users cannot post anywhere, except the introduction section. (They should be able to view the forum normally)
  2. Have an aggressive anti-spam plugin that will auto ban certain phrases when posted in the Introduction Section:
    • This has to be configured so users with more than 5-10 posts aren’t targeted.
    • You will need to come up with your own words, be creative and try to stick to unique words, domains, etc.
  3. A one-click easy to use button to ban and delete the posts of a bot. (Bot-Nuke Button):
    • I still get the occasional bot posting in the Introduction Section, but these are obvious and can be quickly dealt with through a ‘Bot-Nuke’ button.
    • Your mileage varies from platform-to-platform, you may have this button, or you may have to ban then manually delete all threads and comments. If you are manually doing that work, consider adding this button.

I’m going to include the steps written specifically for MyBB, but you should be able to apply this concept to any platform.

MyBB Forum Configuration

Create a new section called Introductions. We will configure the rest of the sections during the user configuration part.

MyBB User Configuration

Edit your initial registered user group to be locked down, so it can only post in the introduction section.

  • Rename the initial user-group to Unverified Members.
    • This group should have limited access to only post in the Introduction Section.
  • Create a secondary user-group called Members.
    • This group has full access to post everywhere.

MyBB Group Promotions

MyBB has a Group Promotion function that allows configuration to be done from entirely within MyBB. Depending on your platform you may need to write a plugin. In MyBB you can go into your admin panel /admin/index.php?module=user-group_promotions and access the group promotions section. Under promotion conditions, configure it so the Thread Count of 1 promotes Unverified Members to Members.

MyBB Aggressive Anti-Spam Plugin

Spam Blocker & Auto Ban or another plugin like this is what I would recommend using.

  • You will need to configure the plugin based on the spam you see on your website.

MyBB Introduction Alert

The only thing you need to do from here is let the users know they need to create an introduction thread before they can post anywhere-else. Since MyBB can’t do that via configuration - here’s a simple script to preform that.

NOTE: Make sure to edit the plugin /newthread.php?fid=3 should be the correct URL for your thread announcing this statement.

inc/plugins/introductionAlert.php

<?php

//Copyright (c) 2016 Konloch. All rights reserved.
//This work is licensed under the terms of the MIT license.  
//For a copy, see <https://opensource.org/licenses/MIT>.

if(!defined("IN_MYBB")) {
	die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.");
}

$plugins->add_hook("pre_output_page", "alertIntroduction");

function introductionAlert_info()
{
	return array(
		'name'		=> 'Alert Unverified Users',
		'description'	=> 'Alerts Unverified Users of the need to post an introduction before they can post anywhere else.',
		'website'	=> 'https://konloch.com',
		'author'	=> 'Konloch',
		'authorsite'	=> 'https://konloch.com',
		'codename' 	=> 'introductionAlert',
		'version'	=> '1.0',
		"compatibility"	=> "16*, 18*",
	);
}
function introductionAlert_deactivate () {}
function introductionAlert_activate () {}
function alertIntroduction($page) {
	global $mybb;
	
	if($mybb->user['usergroup'] == 2)
	{
		$page = str_replace(
			'<div class="newsticker">',
			'<p><b style="color:red">WARNING:</b> <b>Until you post an introduction you will be unable to post ANYWHERE.' .
			' Click <a href="/newthread.php?fid=3">HERE</a> to post an introduction.</b></br>' .
			'<small>It could take up to 20 minutes after you post for your account to become verified.</small></p>' .
			'<div class="newsticker">',
			$page
		);
		return $page;
	}
}

From here you should have the basics to allow you to block forum spam. Obviously there are many ways, this is just an easy solution my friend Bibl and I were able to come across in 2016.