Spam Karma and Staticize Reloaded

I figured out why my spam plugin was eating everything. I know other people are having the same problem, so I thought I’d post my solution.

The problem is that Spam Karma’s OSA code is dynamic, but Staticize Reloaded caches the results before sending it to the user. Therefore, the first IP address ever used to access the page is recorded, along with the relevant access time, and everyone trying to comment after that has to match the original IP and time. This is impossible, of course, unless you fake your IP and have a time machine.

I present to you the solution. This patch adds a tag to spam-karma.php in your plugins folder that tells Staticize to skip caching just the OSA code, i.e. {$osa_time} and {$osa_code}. You’ll get the benefits of static caching for the rest of the page, and still have reliable spam protection. Anyway, I hope it’s useful, enjoy.

[edit]: As a note, you can protect some things from staticize by wrapping them in the following html tags: (more info)
<!--mfunc your_name_here--> dynamic code <!--/mfunc-->

[update]: It seems there’s currently a bug with Staticize Reloaded that causes it to sometimes drop the dynamic code completely when using mfunc. I’ll look into this more, but make sure to double-check your output so that you get what you want.