Bad Behaviour and Akismet Blocked Counters for WordPress

 
Tags: , , , ,

The Bad Behaviour plug-in for WordPress comes with a weekly counter in the admin dashboard, but do you want a wicked footer like mine?

106,386 dodgy geezas have been blocked by Bad Behaviour and 36,926 spams were eaten by Akismet.

Akismet comes with a counter you can use in themes/plugins…


$akcount = get_option('akismet_spam_count');
$akcount = number_format($akcount);
echo $akcount;

But with Bad Behaviour you have to do a little more work. To start with you need to get BB to record in the database each time it blocks someone, this is done by adding a function to ~/wp-content/plugins/bad-behavior/bad-behavior-wordpress.php , add the following code…..

// Bad Behavior callback functions.
function  bb2_banned_callback() {

        $counter = get_option('bad_behavior_spam_count');
        $counter = $counter + 1;
        update_option( 'bad_behavior_spam_count', $counter );

}

Now BB will store an incrementing number in the WP database for you to use in your theme..


$bbcount = get_option('bad_behavior_spam_count');
$bbcount = number_format($bbcount);
echo $bbcount;

Now you can track how many inter-twats your blocking!

nick

 

One Response to “Bad Behaviour and Akismet Blocked Counters for WordPress”

  1. [...] playing with my bad-behavior callback function, I noticed something quite crucial; plug-ins load in alphabetical [...]

Leave a Reply

 

Some other things that might interest you...

---