Using TypePad with Comments

Topics: Administration, Customizing Orchard, Writing modules
May 19, 2011 at 4:18 PM
Edited May 19, 2011 at 4:44 PM

I have the Comments module installed (Version: 1.1.30) and I'd like to use the free TypePad API for anti-spam instead of the costly Akismet API. From what I've read the APIs are identical so I was hoping I could just put in my TypePad API Key and the API URL TypePad gave me as my blog URL. After digging further I realize that doesn't work.

The Akismet API URL is rest.akismet.com and the TypePad API URL is api.antispam.typepad.com.

The Comments module has a CommentSettingsPartRecord which has the fields AkismetKey and AkismetUrl. These of course map to what's shown in the administrative dashboard. Unfortunately AkismetUrl is not actually used as the API URL, it's used as the Blog URL. In fact, under the covers the Comment module is using Joel.Net.Akismet which doesn't let you change the API URL.

Sebastien created a wonderfil anti-spam module for Orchard that's hosted here:

http://orchardantispam.codeplex.com/

It supports both Akismet and TypePad.

Is there any chance the Comments module could be updated to use this module for anti-spam?

Until that happens officially I'd like to try to make it happen "unofficially". It seems the only thing that would need to be done is create a new class that implements ICommentValidator and tell the Comments module to use that instead of the AkismetCommentValidator. The class itself shouldn’t be hard to create, but getting my ICommentValidator injected into the CommentService instead of the default one is where things get fuzzy. I’m familiar with DI and I read the Dependency Injection section in the Orchard docs, but it only describes how to take dependencies not override them. Looking in the Comments module I'm not even sure how the AkismetCommentValidator gets registered with the container. Did it happen automatically because of the [UsedImplicitly] attribute? And if so, how can I override it?

Finally, if my module is marked as depending on the Comments module will that guarantee my module is loaded after the Comments module?

Thanks!

Coordinator
May 19, 2011 at 7:13 PM

On TypePad support out of the box: Can you open a bug to track this?

On the other question I'll let others answer but unless I'm missing something you just need to use the OrchardSuppressDependency attribute.