(Note: since this post is frequently read, I updated it for phpBB 3.2 on June 28, 2017 and August 1, 2019)
I am frequently sought out to help address issues with spam registrations on phpBB forums. The most typical spam problem I encounter is not spam posts, but spam registrations. The symptoms are lots of bogus usernames in your member list or inactive user list, often strings of random letters and numbers for the username, with a “website” listed in their profile that points to a spam site.
I am happy to fix these for you. You may wish to try some of the solutions below first. The solutions discussed apply principally to phpBB 3.0, 3.1 and 3.2.
Getting rid of existing spam registrations
Most of these “users” don’t bother to complete registration, simply want to leave a spam memberlist link and be gone. Consequently they show up as inactive users.
- Inactive users can be deleted in the Administration Control Panel. ACP > Users and Groups > Inactive Users. Select the inactive users you believe to be spam registrations and in the little drop down box in the bottom right of the screen select Delete and press Submit. You may have to do this many times for many screens to get rid of them all. (Note the Mark All link at the bottom of the page. This can speed up things.) This is the safest approach.
- You can also use the Prune Users function: ACP > Users and Groups > Prune users. A user that has not completed registration is not necessarily a spammer. Unfortunately, the Prune User function is not smart enough to be able to examine the profile website field to see if it contains data as this is often the key to filtering out likely spammers. However, if you prune a legitimate inactive user they can always come back to the board and register again. To remove these users it helps to look at your memberlist by date and see if you can figure out when the spam started. In the Prune users utility you can enter this date in the Joined field. Entering 0000-00-00 in the Last Active field essentially is the same as filtering inactive users only. You can select the option to delete posts for these users too but if they haven’t completed registration there should be no posts to delete.
- You can globally delete these on the backend with SQL but beware: you may also delete legitimate new users that haven’t finished the registration process. Running any raw SQL statement is inherently risky, so backup the database first! Make sure you select the right table prefix (phpbb_ is shown in the examples) for the users table. Your config.php file contains your table prefix, which is usually “phpbb_” as well as the database you are using. If you have more than one application this will distinguish the one containing the data for your forum. You can use a tool (typically phpMyAdmin in your web host control panel) to issue SQL to delete these. Here’s an example of SQL for MySQL that will remove all inactive users with zero posts but with a website URL:
- For phpBB 3.1 and 3.2:
delete from phpbb_users where user_id in (select user_id from (select u.user_id from phpbb_users u, phpbb_profile_fields_data p where u.user_id = p.user_id and user_posts = 0 and user_type = 1 and pf_phpbb_website <> '') as u)
- For phpBB 3.0:
delete from phpbb_users where user_id in (select user_id from (select user_id from phpbb_users where user_posts = 0 and user_type = 1 and user_website <> '') as u)
Reducing spam registrations
Since most spam comes in the form of registrations and not spam posts, generally tightening up the registration process can reduce or eliminate these registrations. Many admins require administrator approval for each registration, but this becomes labor intensive. Most CAPTCHAs have been thoroughly hacked and are to be avoided. Here are some better alternatives:
- Tighten up your spambot countermeasure to something more likely to work, like the question and answer one.
- ACP > General > Board configuration > Spambot countermeasures
- Under Available plug ins, select Q&A and press Configure
- Create a question that is unique to the focus of your forum and won’t be guessed with a Google search. Create as many questions as you want. All must be successfully answered to complete registration.
- Go back to Spambot countermeasures, select Q&A again and press Submit. This will change the countermeasure.
- If this stops the spam, it’s probably safe to change it so the admin doesn’t have to approve every registration. An email verification is a good approach. ACP > Board configuration > User registration settings > Account activation > By user (email verification)
- As a best practice or whenever you start to notice spam registrations again or quarterly change the registration question(s)
- phpBB 3.2 supports Google’s new version of reCaptcha as a spambot countermeasure.
- First go to the reCaptcha site and generate the public and private keys you will need for your domain.
- ACP > General > Board configuration > Spambot countermeasures
- Under Available plug ins, reCaptcha and press Configure
- Enter the public and private keys from the reCaptcha site into the fields and press Submit.
- Go back to Spambot countermeasures, select reCaptcha again and press Submit. This will change the countermeasure.
Some sites get hammered and even these steps are not enough. If this happens to you try these options:
- phpBB 3.2 has an Akismet Anti-spam extension. Using it is not necessary free, but usually is for personal or club forums. The extension doesn’t cost anything but the Akismet service requests money depending on your usage. The extension also checks posts for spam.
- If you don’t mind paying $8USD a year, my customers report 100% success with Cleantalk. You will have to download the modification or extension, create an account on Cleantalk and enter your registration key in phpBB. It’s worth the time and expense.
- phpBB 3.1 and 3.2: Install the Stop Forum Spam extension. This checks the IP and some other information of the user registering or the guest poster against popular blacklists, and if there is a match they cannot post. It’s not 100% perfect so some legitimate people may not get through and it’s also possible some spam will get through.
- phpBB 3.1: Install and use the Sortable Captcha extension
- phpBB 3.0: Install the Advanced Block Mod. Warning: this is a very complex mod to install and configure correctly. You will need to point it to more updated blacklists. You may want to have me install it professionally.
I will cover how to remove spam posts in a future blog post.