SilverStripe Quick Tip: Enable Akismet spam filter
Posted May 23rd, 2010 in Quick Tips and SilverStripe
Any page on a SilverStripe website can have comments on it and can easily be passed through the Akismet spam filtering service to check if it is spammy. This quick tip shows how to enable Akismet in SilverStripe after you've got an API key.
Get an Akismet API Key
First of all go to akismet.com to get an API key. They are free for personal use and are $5 a month for commercial use. Their guide is that if you are making more than $500 a month from your blog then you should use a $5 a month pro-blogger Akismet API key.
Configure SilverStripe to use Akismet
Now that you've got your Akismet key, add the following line to your site's main _config.php file at mysite/_config.php:
SSAkismet::setAPIKey('YOUR API KEY GOES HERE');
If you haven't already set the admin email as a configuration option then set that as well:
Email::setAdminEmail('YOUR ADMIN EMAIL ADDRESS GOES HERE');
If it's not set, then the error message displayed if and when someone submits a spammy comment will say "If you believe this was in error, please email ." which looks a little odd without an email address. The email address set with setAdminEmail is modified so it would read e.g. chris_(at)_electrictoolbox.com instead of chris@electrictoolbox.com
Related posts:
- SilverStripe Quick Tip: Enable comment moderation (Wednesday, May 19th 2010)
- SilverStripe Quick Tip: Comments in Templates (Tuesday, May 11th 2010)
- SilverStripe cache directory (Saturday, March 13th 2010)

Comments
blog comments powered by Disqus