Skip to main content

Blog archives for March 2010

Drupal module: Advanced Comment Trigger

Posted in

I have to admit that I've got it pretty good in the website spam department. The Mollom project, started by some of the same folks who started Drupal, uses content analysis to keep spam users from registering accounts on my site, leaving blog & forum comments, and using my site's contact form to spam me via email as well.

The only problem that I've really seen is the rise of spammers who will post blog comments containing text from the blog post itself, almost entirely unchanged, along with one or more links to their sites. Content-based analysis is of no use here, since the majority of the comment is actual text that I would want on my site -- after all, I blogged it!

Until now, I've been following all blog comments to my site via built-in RSS feeds, noticing spam comments some time after they were posted, and going back and deleting them. Drupal allows for comment moderation, but I want comments to go out there right away.

Drupal also allows for some advanced responses using triggers and actions. I could define a trigger such as "comment contains http://" and then assign it an action such as "unpublish comment". In fact, this is what fellow Cocoa developer and Drupal user David Sinclair of Dejal Systems does currently.

But this presents a problem in my use case, as i want to publish comments of my own sometimes containing hyperlinks. Also, I don't have a problem on my forums, just on the blog.

After some back and forth with David on Twitter, I decided to set out and build a small module to help with this. About twenty-four hours later, I give you: Advanced Comment Trigger.

After enabling the module, head to the trigger configuration in Drupal, then the "Advanced comment trigger" tab. Assign the new trigger to the "Unpublish comment" action, then follow the link to fine-tune the module settings. You can configure the trigger to occur on anywhere from one to five or more hyperlinks in the comment body, as well as exempt certain user roles (for example, site admins) or certain content types (for example, forum topics) from triggering the action.

trigger & action configuration

module configuration

I've also included the source to a Drupal view to create an RSS feed of moderated comments so that you can easily follow the comments to which the trigger applies. Checking this from time to time will allow you to easily publish any comments that accidentally get moderated, as well as get an idea of how well this module is working.

In the near future, I hope to add a few more available actions to the trigger such as emailing a site admin or post author or blocking an offending commenter.

Feedback is welcome. You can follow the project at the Drupal project page or on GitHub.

Pukka's reaching out

Just a note about a couple recent developments with Pukka and other services on the web.

First, I'm happy to announce that Pukka has been successfully supporting Pinboard for some time now. You can see the development of this on the support forum topic. Pinboard is a relatively new service which out of the gate has done a lot of things right. I believe it is run by former Yahoo! employees and they have used their experience with Delicious to rethink social bookmarking. They've been innovating at a fast pace, all the while blogging about their work. It's really refreshing to see rapid, iterative development in the social bookmarking space. They are paying attention to things that matter to today's bookmarkers -- services like Twitter, Instapaper, and Read It Later, dead link detection and bookmark archiving, mobile browsing, Google Reader support, and much more. Not to mention assurance of data integrity and scalability! Keep up the good work, Pinboard!

Second, I wanted to point out another innovative application called Quix. Quix is a bookmarklet that integrates features of many other bookmarklets. For example, you can use Quix's single bookmarklet in your browser as a way to work with Facebook, Delicious, Wikipedia, and Google, as well as a host of Mac applications such as MarsEdit, CSSEdit, ShoveBox, and of course, Pukka. You can check out the full list of services or have a look at a recent TUAW article about Quix, which specifically calls out Pukka.

Lastly, Pukka was recently again featured on MacBreak Weekly, a popular podcast by Leo Laporte, Merlin Mann and others. Pukka was first mentioned on the show about two years ago, when I was dismayed to hear Leo say that he didn't feel that Pukka should cost money. I'm glad to see that Leo has changed his tune in the latest show as he calls Pukka "spectacular" and "worth $17 to me". If you'd like to have a listen, download the episode and forward to about 1:25 in, pretty close to the end. Pukka is also featured prominently in the video version of the podcast as well.

Leo Laporte's web browser
(click to enlarge)

All in all, Pukka's been pretty busy lately. I'm glad to see it getting some press. As always, if there's something you'd like to see Pukka work with better, stop over on the forums and have your say.