Math Comment Spam Protection Plugin
This plugin for WordPress 2.9 and 3.0+ asks the visitor making the comment to answer a simple math question. This is intended to prove that the visitor is a human being and not a spam robot.
Example of such question:
This plugin does not require JavaScript or cookies. It uses a special encryption function; the result of the question is being passed via a hidden field. The result is being compared with the value entered by the visitor – after encrypring this value as well.
Downloads
zip, 6.4k
Installation
- Download the plugin (see „Downloads“ above), decompress the .zip archive and put the files into your plugins directory (/wp-content/plugins/) or into a sub directory of the plugins directory.
- Enable the plugin in the WordPress Plugins admin page.
- Go to Options > Math Comment Spam, adjust the options and save.
- Adding the HTML code to your theme by using way a, b, or c:
- The new field for the math question will be added automatically when the option ‚Add math question field automatically‘ is activated. This works well for the standard WordPress 3 theme (Twenty Ten), but may not work for some other (and older) themes. In this case use way b or c.
- If ‚Add math question field automatically‘ does not work for your theme, you can also deactivate this option and add the following code to the
comments.php
of your theme for example right after the field for the website URL:<?php if ( function_exists('mcsp_html') ) mcsp_html(); ?>
mcsp_html()
will output the HTML code from the plugin option ‚HTML code for the math question field‘. - Furthermore, you can also add the HTML code directly to your
comments.php
by using for example the following code:<?php if ( function_exists('math_comment_spam_protection') ) { $mcsp_info = math_comment_spam_protection(); ?> <p><input type="text" name="<?php echo $mcsp_info['fieldname_answer'] ?>" id="<?php echo $mcsp_info['fieldname_answer'] ?>" value="" size="22" tabindex="4" /> <label for="<?php echo $mcsp_info['fieldname_answer'] ?>">Spam protection: Sum of <?php echo $mcsp_info['operand1'] . ' + ' . $mcsp_info['operand2'] . ' ?' ?></label> <input type="hidden" name="<?php echo $mcsp_info['fieldname_hash'] ?>" value="<?php echo $mcsp_info['result']; ?>" /> </p> <?php } // if function_exists... ?>
Frequently Asked Questions
- Question: I’ve installed this plugin but still get spammed, why?
Answer: Are you sure that you get comment spam, isn’t it trackback spam? In case of trackback spam consider installing a plugin like Simple Trackback Validation Plugin.
Other Plugins for Spam Protection
I recommend to use the following 3 plugins for protecting your weblog from spam:
- Simple Trackback Validation Plugin: Eliminates spam trackbacks by retrieving the web page located at the URL used in the trackback and checking if the page contains a link to your blog: if not, the trackback is placed into comment moderation queue.
- Math Comment Spam Protection (this plugin)
- Akismet: additional protection in case of attacks by human spammers or trackback spammers that use the permalink on the web page located at the trackback’s URL.
Related Plugins
I got the idea for this plugin from Steven Herod’s plugin Did You Pass Math?. However, the code of the Math Comment Spam Protection Plugin is completely differently. While Did You Pass Math? provides a one-click-installation which works for standard themes only, my plugin requires you to place the form in the comments.php
on your own. But this has one big advantage: You can add the field whereever you want and JavaScript is not needed for positioning it. So you can use this plugin in every theme. Furthermore, it is not necessary that the visitor has enabled cookies in his/her browser. In addition, I have seen that when using the Did You Pass Math plugin and if you entered a wrong or no answer and press the back button in your browser, the comment is no more available! This is not the case when using the Math Comment Spam Protection Plugin.
Any ways: if you are afraid of modifying the source code of your theme, I recommend that you go for the Did You Pass Math? plugin.
Donation
Do you like my work? Any donation would be highly appreciated.
Version History and Changelog
See wordpress.org/extend/plugins/math-comment-spam-protection/changelog/
How to Report a Bug: Before you report a bug, please make sure you have double-checked that you have followed the above installation instructions correctly.
Please send me your bug report by e-mail.
Bug reports are highly appreciated and will help for the continuous improvement of this plugin, however I can’t promise to get back to you in time regarding your reported bug.