Blocking Kunena Forum Spammers

Overview

The Kunena extention is a great solution for your Joomla forum deployment. And it integrates nicely with Community Builder and many of its add-ons. Forums are great targets for spammers that register and login to your website and start posting third party advertisements with one or more embedded links in each post. In the past, when such a spammer posts on your forum post, your forum moderators would get email notifications (Kunena does this) and a moderator would rush (as quickly as possible) to remove the forum post (typically more than one) and then perhaps manually block the user (so they could not login again). You might get dozens of spam posts weekly. It's like stepping on ants.

The CB Team got together and we came up with this cool CB Auto Actions automation that can block spammers when the post on your forums.

Solution / Example

We analyzed the pattern and basically identified that there were different sequences these spammers would follow. Sometimes the spammer would register and then right away jump to forum area and start posting. In other instances the spammers would first register a series of new accounts and use them days or even weeks later to spam our forums. And each such forum post would contain one or more URLs.

We concluded that it would be great if we could block a forum post that has one or more (third party) URLs in it and belongs to a user that has under 10 (legitimate) forum posts.

The CB Auto Action plugin available for Professional members can be easily configured to implement such a use case with the following two actions:

  • Create a new field named cb_forumposts of the Forum Status type. Be sure Status under Parameters > Display is set to Posts. This will allow cb_forumposts to output the forum post count of the user.
  • Type: Email
    Trigger: joomla_onKunenaBeforeSave
    User: Self
    Access: All Non-Moderators
    Conditions:
        [var1] Equal To com_kunena.KunenaForumMessage
        [cb_forumposts] Less Than or Equal To 10
        [var2_message] Is REGEX
    /(\b(?:(?:https?|ftp|file):\/\/|www\.|ftp\.)(?!example\.com|www\.example\.com)[-A-Z0-9+&@#\/%=~_|$?!:,.]*[A-Z0-9+&@#\/%=~_|$])|(\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}\b)/i
    (Replace the example and .com parts with your domain elements)
    Action > To: email1,email2,email3 (list of emails here)
    Action > Subject: Forum Post Blocked
    Action > Body:
    A forum post from [username] ([user_id]) ([registeripaddr]) has been blocked with the following message:

    [var2_message]



  • Type: Redirect
    Trigger: joomla_onKunenaBeforeSave
    User: Self
    Access: All Non-Moderators
    Conditions:
        [var1] Equal To com_kunena.KunenaForumMessage
        [cb_forumposts] Less Than or Equal To 10
        [var2_message] Is REGEX
    /(\b(?:(?:https?|ftp|file):\/\/|www\.|ftp\.)(?!example\.com|www\.example\.com)[-A-Z0-9+&@#\/%=~_|$?!:,.]*[A-Z0-9+&@#\/%=~_|$])|(\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}\b)/i

    (Replace the example and .com parts with your domain elements)
    Action > URL: [server_HTTP_REFERER]
    Action > Message: As a free user your first few posts can not contain URLs. Please include text only for your first few posts. Thank you for your understanding.
    Action > Type: Error

With these auto actions published you can stop your human spammers cold. Note the auto action order is important as the redirect action will interrupt the sending of the email.

Here is a sample email alert message your moderators (email1, email2, email3) will get when a forum poster is blocked:

 

A forum post from spammer (#####) (###.###.###.###) has been blocked with the following message:

[url=http://spammerlink[/url]

Here is a screenshot of the conditions for both auto actions:

 

Relevant Information

Facebook Twitter LinkedIn