XF 2.1 Spam Keywords

Chad

Active member
I have certain keywords in the "Spam phrases" section including http to prevent spam and malicious links from being posted.

However, is there any possibility or mod that will allow certain websites to be bypassed (not usergroup method)? Whitelist method for certain websites or such.
 
I have certain keywords in the "Spam phrases" section including http to prevent spam and malicious links from being posted.

However, is there any possibility or mod that will allow certain websites to be bypassed (not usergroup method)? Whitelist method for certain websites or such.
I assume you want your legitimate users to be able to post let's say, youtube videos without their post going into the moderation que?


Not sure how you have it set up, but here's what I do:

In setup>options>Spam Management scroll down to where you see "Maximum messages to check for spam" and make it '1'

Look down at "Spam Phrases" and insert this regex:
Code:
/https?:|www\./i
/^\[url.*\[\/url\]$/si
/^http\S+$/si
/\[url=("|')?([^"'\]]+)("|')?\].*\[url\]\2\[/si
/\[url=("|')?([^"'\]]+)("|')?\].*\[url=("|')?\2("|')?\]/si
/^https?:\/\/\S+\n/si

Get rid of any other blocking you have there, and tick the "Manually approve" option. Then click "save" at the bottom of the page.

So that any first posts that contain links will go to approval queue. And since post count only counts published posts, the spammer can post any number of spam links and none of them will show except to you and your moderators.

You can get rid of the annoying notice that your post is awaiting approval by inserting this code in your extra.less template:

CSS:
.messageNotice--moderated {
    display: none;
}
And click "Save."

So that legitimate new users aren't annoyed waiting for their post to be approved, and the spammer thinks he accomplished his task, and leaves.
 
ok. this is working for me.

For anyone else who wants to do this, Here's my working solution. In Options -> Spam Managerment

Add this to your Spam Phrases. And check off "Manually Approve". Maximum Messages to Check for Spam -- I chose 10.

Code:
/((([A-Za-z]{3,9}:(?:\/\/)?)(?!|(www\.|forums\.)*domain1\.com|(www\.)*domain2\.com|domain3\.com)[A-Za-z0-9.-]+[A-Za-z0-9.-]+)((?:\/[\+~%\/.\w-_]*)?\??(?:[-\+=&;%@.\w_]*)#?(?:[\w]*))?)/mi

I included 3 different domain examples. They are separated by "|"

1st. multiple subdomains separated by |
- Matches www.domain1.com or forums.domain1.com or domain1.com

2nd. only www or not
- Matches www.domain2.com or domain2.com

3rd. only base domain
- Matches domain3.com

Just replace what you need to. This will cause any posts by users under the Max # to be checked against this regex. If they post anyl link in the post, unless it's an excluded domain, it will be sent to moderation queue.

arn
 
thanks a lot .. I'm trying this method
PHP 7.3 and 7.4 changes some regex rules. So here's fixed regex, along with some other changes:

Code:
(((https?:(?:\/\/)?)(?!(www\.)*youtube\.com|youtu\.be|(www\.|rover\.)*ebay\.com|(www\.)*amazon\.)[A-Za-z0-9.\-]+[A-Za-z0-9.\-]+)((?:\/[\+~%\/.\w\-_]*)?\??(?:[\-\+=&;%@.\w_]*)#?(?:[\w]*))?)
It should work with PHP <7.3 too I think. But I haven't tested.

Edit: made more changes.

Here you can test it live:
 
Back
Top Bottom