sickprodigy 5b3fa525f4
Publish release / publish (push) Successful in 6s
Show named exempt usergroups
Closes #12
2026-10-03 18:31:03 +00:00
2026-10-03 18:31:03 +00:00
2026-10-03 18:31:03 +00:00
2026-10-03 18:31:03 +00:00
2026-10-03 18:31:03 +00:00

MyBB Spam Preventer Plugin

A configurable MyBB 1.8 plugin that limits common spam behavior for new and low-trust members without restricting established members.

Features

  • Applies only to configured restricted usergroups; MyBB group ID 2 is selected by default.
  • Keeps members restricted until they meet both the configured post-count and account-age thresholds.
  • Defaults to 25 posts and three days, which works well with a typical new-member promotion policy.
  • Detects HTTP, HTTPS, FTP, www, bare-domain, MyCode, hxxp, and common [dot] link formats.
  • Allows configured trusted domains and all of their subdomains.
  • Blocks case-insensitive plain-text phrases in thread subjects and post bodies.
  • Optionally requires original text outside complete MyBB quote blocks in new replies.
  • Supports per-rule actions: log only, reject, send to moderation queue, or ban user and reject.
  • Records optional rule-hit logs for administrator review.
  • Provides a permission-controlled, filterable Spam Preventer log viewer under Tools & Maintenance.
  • Optionally detects rapid new-thread bursts and starts a temporary cooldown.
  • Shows named usergroup exemption checkboxes with group IDs and applies them to primary or additional memberships.
  • Supports user and forum exemptions.
  • Always exempts administrators and forum moderators.
  • Validates through MyBB's server-side post data handler, so direct requests cannot bypass the rules.
  • Preserves the submitted post and displays a clear validation error when content is rejected.
  • Includes the configured post-count and account-age requirements in validation errors.
  • Shows Quick Reply errors inline above the form instead of using MyBB's corner popup.

Installation

Copy the contents of Upload/ into the MyBB installation root:

Upload/inc/plugins/spam_preventer.php -> public_html/inc/plugins/spam_preventer.php
Upload/inc/languages/english/spam_preventer.lang.php -> public_html/inc/languages/english/spam_preventer.lang.php
Upload/inc/languages/english/admin/spam_preventer.lang.php -> public_html/inc/languages/english/admin/spam_preventer.lang.php
Upload/admin/modules/tools/spam_preventer_logs.php -> public_html/admin/modules/tools/spam_preventer_logs.php
Upload/jscripts/spam-preventer/quick-reply-errors.js -> public_html/jscripts/spam-preventer/quick-reply-errors.js

Then install and activate Spam Preventer under Admin CP → Configuration → Plugins.

When updating an existing installation, replace the files and deactivate then reactivate the plugin without uninstalling it. Activation refreshes the setting definitions while preserving existing values and logs.

Configuration

The plugin creates a Spam Preventer settings group under Admin CP → Configuration → Settings.

General

  • Enable Spam Preventer: Turns all plugin checks on or off.
  • Log Rule Hits: Records matched rules, selected actions, user details, forum, subject, excerpt, timestamp, and IP data in the plugin log table.

Logs

Administrators with the Can view and prune Spam Preventer logs? permission can open Admin CP -> Tools & Maintenance -> Logs -> Spam Preventer Logs. The viewer reads the existing dedicated log table and supports user, forum, rule, action, date, and page-size filters. Record details display stored metadata and the complete stored excerpt as escaped text.

Selected records can be deleted with explicit confirmation. The Prune Logs tab can permanently remove records older than 1-3650 days; both operations require a valid Admin CP post key and are recorded in the administrator log. Log pruning does not alter users, posts, or cooldowns.

The dedicated viewer is separate from MyBB's built-in Spam Log. Spam Preventer does not currently duplicate its records into MyBB's core spamlog table.

Eligibility

The default restricted group is ID 2, MyBB's built-in Registered group. If your board uses a separate new-member or probation group, enter that group ID instead.

With the default thresholds, a member in a restricted group remains subject to the rules while either of these conditions is true:

  • The member has fewer than 25 posts.
  • The account is younger than three days.

The member becomes exempt after meeting both thresholds. Setting either threshold to 0 disables that individual condition. Setting both to 0 makes the rules apply to every member of a restricted group regardless of post count or account age.

On SickGaming, Spam Preventer is used alongside MyBB's built-in group promotions. New accounts start in a New-Member group, and MyBB promotes them to the regular Member group after they have at least 25 posts and their account is at least three days old. Spam Preventer itself does not perform that promotion; it is configured to apply only to the New-Member group, so members stop being filtered once MyBB moves them out of that group.

New-Member Attachment Moderation

SickGaming also enables MyBB's built-in Attachments require moderation permission for the New-Member group. New members can still create normal threads and replies, while their uploaded files wait for staff approval. This adds protection against spammy or malicious attachments alongside Spam Preventer's link and phrase checks.

To use the same approach on your board:

  • Enable Attachments require moderation in the new-member group's permissions, and allow uploads only if your community needs them.
  • Keep attachment quotas and per-file size limits conservative, and disable executable or browser-rendered attachment types your community does not need.
  • Have staff review the attachment moderation queue regularly.
  • Use MyBB group promotions to move established users into a regular member group with the intended attachment permissions. SickGaming uses the 25-post and three-day requirements described above.

MyBB manages attachment permissions and group promotions separately from Spam Preventer. Meeting the plugin's thresholds or receiving a Spam Preventer group exemption does not itself remove attachment moderation; check the destination group's permissions and any additional groups too.

Rule Actions

External links, blocked phrases, and quote-only replies each have their own action setting:

  • Log only: Records the match and allows the post.
  • Reject submission: Blocks the post with a validation message.
  • Send to moderation queue: Allows the submission but marks it unapproved.
  • Ban user and reject: Moves the member to the configured ban usergroup and blocks the post.

Link checks inspect MyCode URL targets before MyBB renders them, including single-label targets such as [url=example]. In replies, links inside quoted posts remain subject to the rule; when the restricted link appears only inside a quote, the validation message identifies the quote as the source so the member can remove it.

Enter one domain per line without a protocol or path:

sickgaming.net
github.com
*.edu
*.gov

Subdomains are trusted automatically, so cdn.sickgaming.net is covered by sickgaming.net. A leading wildcard trusts all domains under a suffix. For example, *.edu allows mit.edu and engineering.mit.edu, but not example.education. The default list allows your own trusted site domains, GitHub, .edu domains, and .gov domains.

Blocked Phrases

Enter one case-insensitive plain-text phrase per line. Blank lines and lines beginning with # are ignored. The shipped defaults are tracked in default-blocked-phrases.txt so the starter list can be reviewed outside the AdminCP.

# Recurring coupon spam
shein coupon code
coupon code for new users

The initial release deliberately uses literal phrases instead of regular expressions. This makes rules easier to review and reduces the risk of invalid or overly broad patterns.

Quote-Only Replies

Enable Quote-Only Replies: Enable Rule to require restricted members to add meaningful original text outside quoted content. The rule handles attributed, multiple, and nested MyBB quote blocks and ignores whitespace or empty formatting tags left around them. It applies to Full Reply and Quick Reply, but not to new threads or edited posts.

Rapid Threads

Enable Rapid Threads: Enable Cooldown to temporarily restrict low-trust members who create too many new threads in a rolling window. It is disabled by default.

Default values allow three successfully created non-deleted threads in 15 minutes. The next new-thread attempt starts a 12-hour cooldown. Cooldowns are stored separately and are not extended by repeated blocked attempts. The default scope blocks only new threads, but it can be changed to block all posts and threads during the cooldown.

Ban Action

Set Ban Action: Target Usergroup ID to the usergroup used when a rule action is set to Ban user and reject. MyBB's default Banned group is usually ID 7.

Exemptions

Exempt Usergroups lists every current MyBB group as a checkbox with its name and ID. Selected groups bypass all rules whether they are the member's primary group or an additional group. This lets VIP, donor, booster, trusted, or other approved roles override a restricted New-Member primary group.

User IDs and forum IDs continue to accept comma-separated values. Administrators and moderators of the current forum are exempt automatically.

Relationship to MyBB Controls

This plugin complements rather than replaces MyBB's existing protections. Before using it, configure Cloudflare Turnstile or another CAPTCHA, Stop Forum Spam, group promotions, Purge Spammer, and the per-usergroup maximum-posts-per-day setting.

The plugin intentionally keeps matching rules simple and reviewable. Future releases may add regular-expression rules and account reconciliation tools.

Uninstall

Uninstalling removes the Spam Preventer setting group, plugin settings, rule-hit logs, and rapid-thread cooldowns. It does not alter posts, threads, unrelated MyBB configuration, or users already moved by a ban action.

Testing

Run the focused standalone checks with:

php tests/spam_preventer_test.php

Production testing should use a non-staff account in the configured restricted group. Verify normal text, trusted links, external links, blocked phrases, full replies, Quick Reply inline errors, new threads, edited posts, moderation-queue actions, and rapid-thread cooldown behavior before relying on the plugin.

License

Copyright (C) 2026 SickProdigy.

This project is licensed under the GNU General Public License, version 3 or any later version.

S
Description
No description provided
Readme GPL-3.0
190 KiB
2026-10-03 14:31:18 -04:00
Languages
PHP 97.5%
JavaScript 2.5%