WordPress.org

Ready to get started?Download WordPress

Forums

WP Comment Spam Protection just works (19 posts)

  1. lazymonster
    Member
    Posted 9 years ago #

    I use WP Blacklist, those people came back still and spammed my blog. I'm starting to think if I had applied it wrongly.

  2. Vohiyaar
    Member
    Posted 9 years ago #

    Yeah, I think you are right. :-)

  3. Anonymous
    Unregistered
    Posted 9 years ago #

    I'm pretty ignorant about this, but why shouldn't allowing only registered guys to comment work? to stop spam I mean

  4. Anonymous
    Unregistered
    Posted 9 years ago #

    I'm pretty ignorant about this, but why shouldn't allowing only registered guys to comment work? to stop spam I mean

  5. Kerim
    Member
    Posted 9 years ago #

    I'm having this same problem. The comment moderation is working great (together with the blacklist plugin). However, I'm getting HUNDREDS of e-mails asking me to approve or disapprove comments, and then I have to deal with hundreds of pending posts in the moderation interface.
    To solve this problem it should be possible to permanently ban certain posts based on certain criteria (URL, IP #, etc.) and have these automatically be deleted WITHOUT modernation!
    Even better would be if the system could somehow identify when multiple IDENTICAL posts are awaiting moderation and stop sending e-mails or requesting moderation for future similar messages.
    Another solution is to also not allow the same IP to post too often within a certain amount of time.
    Please - something!!!

  6. charle97
    Member
    Posted 9 years ago #

    For no moderation, straight to rejection:
    install wpblacklist. however, do not activate the plugin. instead, drop the following code in the wp-comments-post.php file in the root of your wp installation directory, after the die( __('Error: please type a comment.') ); line.
    $approved = True;
    $sites = $wpdb->get_results("SELECT regex FROM blacklist WHERE regex_type='url'");
    if ($sites) {
    foreach ($sites as $site) {
    $regex = "/$site->regex/i";
    // echo "Regex: $regex
    ";
    if (preg_match($regex, $url))
    $approved = 0;
    if (preg_match($regex, $email))
    $approved = 0;
    if (preg_match($regex, $comment))
    $approved = 0;
    if (preg_match($regex, $author))
    $approved = 0;
    }
    }
    if ($approved) {
    } else {
    die( __('Sorry, you have tripped my blacklist.') );
    }
    flood protection by ip is already built into wordpress. to adjust the time between comment attempts by the same ip address, again edit the wp-comments-post.php file and scroll down until you see:
    // Simple flood-protection
    then, look for the following line:
    if (($time_newcomment - $time_lastcomment) < 10)
    by default, wp restricts comments by the same ip to every 10 seconds. if you want to expand the time between comment submittals for the same ip to say a minute, replace 10 with 60.

  7. Kerim
    Member
    Posted 9 years ago #

    Thanks! I'll give that a try!

  8. charle97
    Member
    Posted 9 years ago #

    you'll need to use the new one at the link i provided.

  9. Kerim
    Member
    Posted 9 years ago #

    Thanks. I had gone to the link but (1) The documentation made it seem as if the version was older than the one I had installed. And (2) They don't have clear instructions for how to uninstall the old version (with modBlacklist.php). Fortunately I was able to figure it out - I think.

  10. Kerim
    Member
    Posted 9 years ago #

    Yes, I tested it (by attempting to post a comment with a blacklisted URL) and it works. Thanks! Hopefully they can make an option so that this can be configured from within the plugin itself - rather than altering the code.

  11. mboszko
    Member
    Posted 9 years ago #

    Charle97,
    I tried your blacklist code above, but when I do this, I get a repeating string of errors, I'm guessing for each address it's checking against in the blacklist:
    Warning: Unknown modifier '/' in /Library/WebServer/stationinthemetro/wp-comments-post.php on line 50
    Warning: Unknown modifier '/' in /Library/WebServer/stationinthemetro/wp-comments-post.php on line 52
    Warning: Unknown modifier '/' in /Library/WebServer/stationinthemetro/wp-comments-post.php on line 54
    Warning: Unknown modifier '/' in /Library/WebServer/stationinthemetro/wp-comments-post.php on line 56
    Then, at the bottom, I get more errors:
    Warning: Cannot modify header information - headers already sent by (output started at /Library/WebServer/stationinthemetro/wp-comments-post.php:50) in /Library/WebServer/stationinthemetro/wp-comments-post.php on line 112
    Warning: Cannot modify header information - headers already sent by (output started at /Library/WebServer/stationinthemetro/wp-comments-post.php:50) in /Library/WebServer/stationinthemetro/wp-comments-post.php on line 113
    Warning: Cannot modify header information - headers already sent by (output started at /Library/WebServer/stationinthemetro/wp-comments-post.php:50) in /Library/WebServer/stationinthemetro/wp-comments-post.php on line 114
    Warning: Cannot modify header information - headers already sent by (output started at /Library/WebServer/stationinthemetro/wp-comments-post.php:50) in /Library/WebServer/stationinthemetro/wp-comments-post.php on line 116
    Warning: Cannot modify header information - headers already sent by (output started at /Library/WebServer/stationinthemetro/wp-comments-post.php:50) in /Library/WebServer/stationinthemetro/wp-comments-post.php on line 117
    Warning: Cannot modify header information - headers already sent by (output started at /Library/WebServer/stationinthemetro/wp-comments-post.php:50) in /Library/WebServer/stationinthemetro/wp-comments-post.php on line 118
    Warning: Cannot modify header information - headers already sent by (output started at /Library/WebServer/stationinthemetro/wp-comments-post.php:50) in /Library/WebServer/stationinthemetro/wp-comments-post.php on line 119
    Warning: Cannot modify header information - headers already sent by (output started at /Library/WebServer/stationinthemetro/wp-comments-post.php:50) in /Library/WebServer/stationinthemetro/wp-comments-post.php on line 124
    Any ideas on why this is happening? I copy-pasted your code above, so there shouldn't be any coding errors.
    Thanks.

  12. Kerim
    Member
    Posted 9 years ago #

    I'm getting these errors too! I just discovered that over the weekend after someone complained that their post wasn't going through. It actually did go through and I was able to approve it from the moderation panel, but it would be nice not to have such an error message. Any idea how to fix it? I'm using 1.3 alpha 2.

  13. Kerim
    Member
    Posted 9 years ago #

    This works so well, I'd really like to get it to not display the error messages if it is possible to fix it.
    Just to clarify, I'm getting the exact same
    Warning: Unknown modifier '/'
    Warnings in the exact same lines. It seems to have to do with these lines of code (removing the intervening lines so as to just show those mentioned in the warning message):
    if (preg_match($regex, $url))
    if (preg_match($regex, $email))
    if (preg_match($regex, $comment))
    if (preg_match($regex, $author))

    Now, the term $regex seems to be defined here:
    $regex = "/$site->regex/i";
    I tried to remove first one, then the other slash, but it made things much, much, worse. Not sure what else I might try.

  14. Kerim
    Member
    Posted 9 years ago #

    Here is a temporary solution:
    Where it says:
    if ($approved) {
    } else {
    die( __('Sorry, you have tripped my blacklist.') );
    }

    Change it to this:
    if ($approved) {
    echo "<br/><br/><h1>Please wait for me to approve your comment. No need to resubmit. (And ignore those pesky 'warnings'.) Thanks!</h1><br/><br/>";
    } else {
    die( __('Sorry, you have tripped my blacklist.') );
    }

    It will appear after the warnings about backslashes, and before the warnings about modifying headers, but because it is encoded as a header, it should be quite clear and readable!

  15. charle97
    Member
    Posted 9 years ago #

    i don't know how to create the error, so i can't help.

  16. Fahim
    Member
    Posted 9 years ago #

    The error was probably due to an unescaped slash in a regular expression entered into the blacklist. This has been a problem which has been cropping on and off with WPBlacklist since I hadn't totally plugged all the holes. Hopefully, WPBlacklist 2.6 solves the problem since I think I've covered all the places where an unescaped slash could be inserted into the blacklist.

  17. slowdog
    Member
    Posted 9 years ago #

    Thanks to Charle97. I had installed blacklist but it wasn't stopping the texas holdem guy even though the URL was in the blacklist. Your modification to the wp-comment-post file seems to have done the trick instead, so thanks!

  18. Kerim
    Member
    Posted 9 years ago #

    lukiss: Yes, there are some things not well documented in the upgrade which I found out from the developer via e-mail:
    (1) You need to run the installer, even if you are only doing an upgrade.
    (2) The installer has a bug. To fix it you need to do the following:
    You'll need to change the line at the top of the blacklist-install.php file which goes something like require_once("/wp-includes/wpblfunctions.php"); to say require_once("wp-includes/wpblfunctions.php"); Basically remove the slash before wp-includes.

  19. Kerim
    Member
    Posted 9 years ago #

    BTW: After upgrading I still get the same annoying error messages. It may be because i'm still using Alpha 2. Those are the risks of using beta software...

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.