Integrating Akismet with CakePHP

Fighting comment SPAM is an ongoing battle. When I first created the ability to add comments, I used a simple hidden field and session token thinking that would handle most of the SPAM. That failed quickly. I soon had hundreds of comments linking to Viagra and the like. I put a bandage in place flagging any comment posted that had more than one link. I didn’t expect it to work forever, but hoped it would hold up longer than it did. But, my site soon had SPAM comments all over again. I had to do something more permanent, and fast. I found a class written by Felix Geisendörfer, integrating CakePHP with Akismet.

I quickly downloaded and added it to my project. It didn’t work! Luckily it just needed to be updated to work with CakePHP 1.2. It was a simple fix and I was on my way to turning the tides in the fight against comment SPAM. After updating the class to work with CakePHP 1.2, it was as simple as making a few calls to the class, passing the necessary information. I posted the updated class to CakeForge, allowing me to give back to the open source community for the first time.

All of this functionality is built into the latest version of WordPress, but being the stubborn person that I am, I’m sticking to CakePHP, loving every minute of it, and learning a great deal along the way.

1 comment

  1. I’ll have to keep this in mind whenever I get around to putting up a new site. I used to use the honeypot method as well and also got spammed.

    Glad to hear you’re still using CakePHP. I’ve delved into other PHP frameworks, Ruby on Rails, Django…and I always end up coming back to Cake to get things done.

Comments are closed.