Spam protection suggestion – simple to implement
Quote from GvE on March 21, 2025, 12:31 amHi @asgaros,
Love your forum software. It’s been running on my site for many years.
I’d like to suggest a spam protection implementation that should be easy to implement:
Require approval for someone’s first topic or post.
- Whenever a new user joins and creates a new topic or responds to an existing one for the first time, it requires approval.
- They can’t create any other topic or response, until that first topic / post has been approved.
- Only after approval of that first topic / post they will be able to add new topics and responses, who don’t need approval anymore.
Why? The spam I receive on the forum is always from newly created users (my forum doesn’t allow guests), who then create 1 to dozens of topics in a small timeframe. If I’m awake, I’m usually very fast in blocking them, but if I’m sleeping, I sometimes wake up to many new spam topics and responses.
I know I can set to approve everything, but I don’t want to do that. I trust my existing forum users, and I don’t need to monitor every topic/post.
I did some research on some of the spam posts that I got, and I found similar spam post on other asgaros forum implementation. It seems that there is a group of people out there that know that Asgaros has a weak spot from spam protection perspective.
I hope this is helpful.
Thank you and best regards,
Guido
Hi @asgaros,
Love your forum software. It’s been running on my site for many years.
I’d like to suggest a spam protection implementation that should be easy to implement:
Require approval for someone’s first topic or post.
- Whenever a new user joins and creates a new topic or responds to an existing one for the first time, it requires approval.
- They can’t create any other topic or response, until that first topic / post has been approved.
- Only after approval of that first topic / post they will be able to add new topics and responses, who don’t need approval anymore.
Why? The spam I receive on the forum is always from newly created users (my forum doesn’t allow guests), who then create 1 to dozens of topics in a small timeframe. If I’m awake, I’m usually very fast in blocking them, but if I’m sleeping, I sometimes wake up to many new spam topics and responses.
I know I can set to approve everything, but I don’t want to do that. I trust my existing forum users, and I don’t need to monitor every topic/post.
I did some research on some of the spam posts that I got, and I found similar spam post on other asgaros forum implementation. It seems that there is a group of people out there that know that Asgaros has a weak spot from spam protection perspective.
I hope this is helpful.
Thank you and best regards,
Guido
Quote from Guido on May 2, 2025, 3:29 pmI have found a way to protect from spam. It’s easy to implement if you know a bit of coding.
In forum_content.php add this function:
private function checkSpam($name, $text, $author_id) {
$stringsToCheck = [“RPD77”, “ELD.gg”, “mcdvoice”,”diablo”,”BO6″,”escort”,”call girls”,”nituroy”,”warfare”,”nocramming”];
foreach ($stringsToCheck as $term) {
if (stripos($name, $term) !== false || stripos($text, $term) !== false) {
update_user_meta($author_id, ‘asgarosforum_role’, ‘banned’);
die;
}
}
}Then, in the same file, in the insert_topic function and in the insert_post function, call checkSpam.
// Inserts a new topic.
public function insert_topic($forum_id, $name, $text, $author_id = false, $uploads = array()) {// Set the author ID.
if (!$author_id) {
$author_id = $this->asgarosforum->permissions->currentUserID;
}$this->checkSpam($name, $text, $author_id);
…
// Inserts a new post.
public function insert_post($topic_id, $forum_id, $text, $author_id = false, $uploads = array()) {// Set the author ID.
if (!$author_id) {
$author_id = $this->asgarosforum->permissions->currentUserID;
}$this->checkSpam(“”, $text, $author_id);
…
Of course, this is very rudimentary, but it works. The disadvantage is that:
– this code has to be added each time the Asgaros plugin is updated and
– every time you want to add a term, you need to go into the code
That’s why I’d like to suggest to @asgaros to implement something like this by default.Better yet, use the Akismet Client Library for PHP in the checkSpam function instead of just checking a list of terms. Most wordpress sites use the Akismet spam protection anyway.
What do you think?
I have found a way to protect from spam. It’s easy to implement if you know a bit of coding.
In forum_content.php add this function:
private function checkSpam($name, $text, $author_id) {
$stringsToCheck = [“RPD77”, “ELD.gg”, “mcdvoice”,”diablo”,”BO6″,”escort”,”call girls”,”nituroy”,”warfare”,”nocramming”];
foreach ($stringsToCheck as $term) {
if (stripos($name, $term) !== false || stripos($text, $term) !== false) {
update_user_meta($author_id, ‘asgarosforum_role’, ‘banned’);
die;
}
}
}
Then, in the same file, in the insert_topic function and in the insert_post function, call checkSpam.
// Inserts a new topic.
public function insert_topic($forum_id, $name, $text, $author_id = false, $uploads = array()) {// Set the author ID.
if (!$author_id) {
$author_id = $this->asgarosforum->permissions->currentUserID;
}$this->checkSpam($name, $text, $author_id);
…
// Inserts a new post.
public function insert_post($topic_id, $forum_id, $text, $author_id = false, $uploads = array()) {// Set the author ID.
if (!$author_id) {
$author_id = $this->asgarosforum->permissions->currentUserID;
}$this->checkSpam(“”, $text, $author_id);
…
Of course, this is very rudimentary, but it works. The disadvantage is that:
– this code has to be added each time the Asgaros plugin is updated and
– every time you want to add a term, you need to go into the code
That’s why I’d like to suggest to @asgaros to implement something like this by default.
Better yet, use the Akismet Client Library for PHP in the checkSpam function instead of just checking a list of terms. Most wordpress sites use the Akismet spam protection anyway.
What do you think?