There are a several of plugins available for Habari to deal with spam. Most people seem to prefer the ones that use outside services such as Aksimet and Defensio. I don't like relying on outside services so I rely on the simple spamchecker plugin that comes with Habari and the simple blacklist checker.
The concept behind the simple blacklist plugin is simple. Give it a list of terms or ip addresses to search for in a comment. If the comment contains any of these, discard it. Sad to say, it wasn't working, though. I looked through the code and could find nothing wrong, so submitted a bug report for it and let it go.
The problem kept irking me, though, because every day I would have to manually moderate comments that contained text that I had in the blacklist, so I went back to debugging the plugin myself. I began by using var_dump(), the PHP function that will print any variable you give it. In particular, I used var_dump to see the contents of the blacklist.
It was empty. Obviously, not good. You can't compare against something that doesn't exist. I looked at the code and found this:
$blacklist= explode( "\n", Options::get('SimpleBlacklist:blacklist') );
I looked in the database options and found this:
simpleblacklist:blacklist
Note the capitalization differences. Changing the Options::get() statement to use 'simpleblacklist' solved the problem. The simpleblacklist plugin began quietly discarding comments that contained blacklisted terms. My life has become much easier without having to rely on an outside service. All thanks to the humble var_dump().

