Protected by Akismet

Filed under:  Google about "Akismet" |  Google about "Drupal" |  Google about "Open source"
Akismet module for Drupal

This site is now running live a module that uses Akismet to check for spam in real time. This is something I starter to write a few months ago, but I had to delay because Drupal 4.7 was not stable enough. But now it's been a few weeks it was released, and it seems I'll have some spare time this week, so I decided to blow off the dust on that folder...

It currently checks for spam in comments. I need to finish the hooks for checking nodes (in Drupal jargon it is normal posts, books, etc.) and add a report or something for the admin side of the site.

I have commited to CVS what I have right now, if you wish to check...

When finished, I would like to find the time to write a MOD for phpBB. Update: please see 2nd comment below.


Just an update...

Should you wish to check how the code is looking, latest changes have been committed to CVS.

I am polishing the self contained documentation and re-working a couple of settings, but now the real time spam checker and publish/unpublish or submit spam/ham operations for comments and nodes are implemented.

I'm planning to spend some time later today to finish this part and also to think about and work out a spam moderation queue. I may also add an opt-in option for administrators to e-mail them when content is posted (maybe for all posts, or for detected spam or nothing). Not sure about it yet.

Just wanted to mention... in order to use the Akismet service it is necessary to have a WordPress.com API key. If you don't have one already, you can get it by simply signing up for a free account at WordPress.com.


About the MOD for phpBB

Oh, I'm very happy to see that Fountain of Apples already started this project, which can be found in its own DEV Topic at phpBB.

FoA, if you read this, I'm really glad you started this project. I just got your comment posted today to the spam-stopper mailing list :-). Your MODs rock, Akismet rocks and such a MOD for phpBB is really a must!


Quick phpBB hack to check

Quick phpBB hack to check posts:

http://www.randombyte.net/wiki/phpbb_akismet


Please, contact Douglas Bell (FoA).

Eli, let me paste your quick hack here and add a few comments below

-- Download --
http://www.l33thaxor.com/Akismet.class.zip

-- Open --
posting.php

-- Find --
include(
$phpbb_root_path 'includes/functions_post.'.$phpEx);
 
-- 
AfterAdd --
//Akismet - START
include($phpbb_root_path 'Akismet.class.php');
//Akismet - END
 
 
-- Find --
prepare_post($mode$post_data$bbcode_on$html_on$smilies_on$error_msg$username$bbcode_uid$subject$message$poll_title$poll_options$poll_length);
 
-- 
AfterAdd --
//Akismet - START
      
if ( $error_msg == '' )
      {        
        
$akismet = new Akismet('http://www.your-site.net/forum/''your-wp-api-key');
        
$akismet->setCommentAuthor($username);
        
$akismet->setCommentContent($message);         
        if(
$akismet->isCommentSpam())
            
$error_msg "Error: Your message looks like spam.";
      }  
//Akismet - END
 
 
-- Find --
if( 
$preview )
 
-- 
Replace With --
//Akismet - START       
      
$akismet = new Akismet('http://www.your-site.net/forum/''your-wp-api-key');
      
$akismet->setCommentAuthor($username);
      
$akismet->setCommentContent($message);       
      if(
$akismet->isCommentSpam())
          
$error_msg "Error: Your message looks like spam.";
              
//    if( $preview )
  
if( $preview and ($error_msg == ''))
//Akismet - END

If you ask me, your code needs a bit more love. One of the things that's making Akismet so great is the fact that users send back information to the system, to mark missed spam or correct false possitives (ham). Akismet needs that to learn from mistakes and become better and better.

Also, if you ask the phpBB MOD Team... well, that's an insta-deny for several reasons (hardcoded language, coding style, MOD template...).

Please, contact Douglas Bell (Fountain of Apples). He's already working on a MOD-ification to integrate Akismet into phpBB. See my previous comment for references.


What's left?

I just implemented a spam counter (that may also display the date since the counter started to increment). It can be modified (reset or whatever) from the settings panel of the module. A themable block (or something similar) is on the works.

The following is the list of things, in no particular order, that I will be working on next:

  • Think about and implement the spam moderation queue.

  • Review the help page.

  • Implement an opt-in option for administrators to e-mail them when content is posted (maybe for all posts, or for detected spam or nothing).

  • I'm not particulary good with graphics, but I'll also try to include a set of buttons for those who use the Control Panel module.


...and also hook_cron!

Oh, just noticed the cron task also needs a bit more love.


hook_cron is now there.

I hope to get some time to work on the rest today.


More granular permissions for spam moderation

I have just implemented different permission sets to allow site administrators delegate spam moderation more easily.

For those who have simple role requirements, users with administer nodes or administer comments permission might be enough.

However, there may be sites that need more granularity so they can now delegate moderate spam in comments or moderate spam in nodes of type %type to any user role. This way it won't be necessary to be a complete content administrator to just publish/unpublish content or submit spam/ham to Akismet.


Good to know

Good to know


Download available for testing

I have created a project page for this module, from where it can be downloaded.

This module is still in development. However, I flagged the version as beta, because I feel it can already be used. Feedback is more than welcome. There are some TODO notes on top of the module source, should you wish to see what's missing. Do not try it on a production environment and please make sure you have good backups before.

Current list of features:

  • Options to choose which content types should be checked for spam.
  • Ability to check for spam for comments and/or nodes, sending a query to Akismet, in real time. Real time connections can be disabled.
  • Detected spam is still recorded into database. However, a cron task can be customized to automatically remove spam older than a specified age.
  • Moderators can submit missed spam or false possitives (ham) back to Akismet.
  • Moderators are users who have 'administer nodes' and/or 'administer comments' permission.
  • More complex scenarios can be customized by granting moderator permission at content type level.
  • Ability to perform publish/unpublish and submit spam/ham operations from links at the bottom of content.
  • Basic moderator queue to review unpublished content or content that has been marked as spam.
  • All operations are logged to watchdog, trying not to generate a lot of records though.
  • Spam counter that also reminds the 'counting since date'. This information can be changed at will from the settings panel.
  • Comprehensive settings panel where every option has been self documented with descriptions. Almost every feature can be customized.
  • A couple of buttons are included in the contrib subdirectory for those who use the control panel module. I'm not really good with graphics, I did it the best that I could...

What's coming:

  • Implement a themable block (or something for spam counter).
  • Implement an opt-in option for administrators to e-mail them when content is posted (maybe for all posts, or for detected spam or nothing).
  • Review the help page.
  • Enhance moderation queue with a form to allow multiple operations (not sure about this yet).

Support:

  • During the beta stage, if request, I'll provide upgrade functions, should the table used by this module needs to be changed. If not requested I won't. It's just to save some time, but don't hesitate to ask. I will be happy to do it.
  • For any questions you may have during this beta stage, feel free to reply to this post or the post related to this module at Drupal site. However, I would prefer to use the forums.

Spam counter with customizable (and themable) block

I have just implemented a customizable (and themable) block to display the akismet spam counter.

There is also a new option in the settings panel that allows administrators set how many blocks they wish to use (or none at all). This is aimed to keep the block administration panel as clean as possible.

For now, these changes are available from CVS only. See diff for details.


Automatic version checking

I decided to add an automatic version checker. It will check this server for version information, at 24h intervals (default). This interval can be customized from the settings panel. The automation can also be disabled.

It is based on a feature that I have just added to my custom projects area. Appending /version to any project, a small file with the version number is returned. Feel free to try it here:

http://www.phpmix.org/projects/drupal/4_7/akismet/version

Well, it is being worked on. I'll commit to CVS when ready...

Update: See diff for details.


Akismet module v1.0.0 released!

For further information, please consult the release announcement. :-)