Description
Requires users to answer a math question before they can leave a comment. The operation may be addition, subtraction, or multiplication. The range of values produced by the plugin ranges between 1 and 50.
Installation and Setup
In your global /WEB-INF/plugin.properties file, add the following line:
math-comment-moderation=org.blojsom.plugin.comment.MathCommentAuthenticationPlugin
You may then add "math-comment-moderation" to one of the flavor-based plugin chains. The plugin must be placed before the comment plugin. These plugin chains can be found in the individual user's plugin.properties file. For example:
html.blojsom-plugin-chain=..., math-comment-moderation, comment, ...
Login to your blog and navigate to the Weblog Settings | Properties and make sure the Comment Moderation Enabled? setting is set to true. Alternatively, you can set the comment-moderation-enabled property to true in the blog's blog.properties file.
As of blojsom 2.26, there are two settings you can add to your /WEB-INF/blog-id/blog.properties file to control settings for this plugin. They are described in the following table.
| Property |
Default value |
Description |
| math-comment-authentication-operations |
3 |
Controls the available operations. If set to 1, only addition is used. If set to 2, addition and subtraction are used. If set to 3, addition, subtraction, and multiplication are used. |
| math-comment-authentication-bound |
10 |
Sets the bound on the random value chosen for the math operation. |
Usage and URL Parameters
There are no URL parameters to control the operation of the Math Comment moderation plugin.
Usage
You can use the following template text in your comment submission form. The plugin expects a form item named mathAnswerCheck as the value it should check against for the operation.
<p class="label">Answer $!BLOJSOM_MATH_AUTHENTICATOR_PLUGIN_VALUE1 $!BLOJSOM_MATH_AUTHENTICATOR_PLUGIN_OPERATION $!BLOJSOM_MATH_AUTHENTICATOR_PLUGIN_VALUE2 =</p>
<p class="input"><input type="text" name="mathAnswerCheck" value="" class="fixed" /></p>
The following Velocity macros are also available.
| Macro |
Description |
| #MathCommentFormItem() |
Displays the form item above |
| #MathCommentQuestion() |
Displays the math question as value1 operation value2 |
Context Attributes and Types
| Context Attribute |
Type |
Description |
| BLOJSOM_MATH_AUTHENTICATOR_PLUGIN_STATUS_MESSAGE |
java.lang.String |
Status message if the math check passed or not. |