This is a plugin that will block a spammer if he already has been tagged as a spammer. I use it together with the Akismet plugin. Akismet tags the spammer, and wp-denyhost prevents him from adding more comment spam.
Core functionality :
define('PS_DENYHOST_THRESHOLD', 5);
function ps_denyhost() {
global $wpdb;
$suspect = $this->get_IP();
$count = (int) $wpdb->get_var("SELECT COUNT(comment_ID) FROM $wpdb->comments WHERE comment_approved = 'spam' AND comment_author_IP = '$suspect'");
if ($count > PS_DENYHOST_THRESHOLD) {
exit;
}
}
add_action('init', 'ps_denyhost');
Download / install: http://wordpress.org/extend/plugins/wp-denyhost/
View-source: http://soderlind.no/code/view/ps_wp_denyhost.php
Changelog (updated 28.12.2009):
v1.1.3: Fixed a minor bug
v1.1.2: Added response 403 Forbidden
v1.1.1: Added languages/wp-denyhost.pot
v1.1.2: Added response 403 Forbidden
v1.1.1: Added languages/wp-denyhost.pot
v1.1.0: Major rewrite. Added option page
v1.0.1: Replaced LIKE (‘%$suspect%’) with = ‘$suspect’ i.e. look for exact match
v1.0: Initial release




28.12.2009 at 1:04
Great plugin.
Have a request though: Would like to be able to send spammers to a 403 Forbidden page instead of 404 not found page. I have a 404 notifier feature set up to alert me when people can’t find content, and so sending spammers to a 404 error page is not ideal. Redirecting to Google is not ideal either.
Can this be implemented?
28.12.2009 at 4:32
Thanks Andrew. “403 Forbidden” is added to v1.1.2
28.12.2009 at 5:38
If you add /blog/ to the website address, you find the blog, under development. I noticed something when I looked at source code of blog homepage:
the path includes an extra blog/ subdirectory! like this:
http://www.example.com/blog/blog/wp-content/plugins/wp-denyhost/ps_wp_denyhost.php?ps_wp_denyhost_javascript&ver=2.9
I don’t understand why this happened. I installed by the wp-admin dashboard.
28.12.2009 at 12:10
Thanks ChipD, this was a bug. Fixed in v1.1.3
28.12.2009 at 17:30
Thank you very much, PerS; I appreciate your quick reply and fix. The automatic upgrade succeeded.
22.1.2010 at 12:11
Is there any button available? I thougt I found a documentation some time ago, but I really don’t remember…
23.1.2010 at 17:40
Button ? What do you mean ?
12.2.2010 at 18:01
Hi!
I’ve got by activateing:
Fatal error: Call to undefined function plugins_url() in /is/htdocs/wp1078111_GSWBBDOKG5/www/wp-content/plugins/wp-denyhost/ps_wp_denyhost.php on line 66
any idea what das it mean?