Comment-Policy WordPress Plugin

This is a WordPress plugin that forces commenters to check an extra required field in the comment form indicating that they have read and agreed to the web site's comment policy. Please note that this plugin has been discontinued.

This plugin adds an extra required field in the comment form. This is actually a checkbox with a link to your comment policy page. The visitor must accept the provided comment policy in order to submit a comment. This plugin affects the comment submission and not trackbacks/pingbacks.

Notice – Plugin discontinued

This plugin has been discontinued and will not be developed any further.

Configuration

Prior to installing this plugin, you need to take care of three simple configuration options. Open the comment-policy.php file in a text editor and fill the proper URL and page title of a web page that contains your site’s policy about comments and interaction in general.

$policy_page_URI = 'http://www.example.org/commentpolicy/';
$policy_page_title = 'Privacy Statement and Terms of Use';

Also, set a custom name for the new field this plugin adds to the comment-form. You can type anything you like as long as you use only letters. Read the next section for more info on this.

$cp_form_field_name = 'anynamewithletters';

How it works

This plugin adds an extra required field to your comment form, a checkbox, which the reader needs to check in order to successfully submit a comment. In other words, the reader needs to accept your comment policy before submitting the comment.

Note that pingbacks/trackbacks are in no way affected.

Visuals

WordPress’ default stylesheet sets the width of all the input fields of the comment form to 170 pixels. This results in a … w-i-d-e checkbox. If you don’t like this (which is very likely), you could simply comment out the width property in your stylesheet:

#commentform input {
    /* width: 170px; */
    padding: 2px;
    margin: 5px 5px 1px 0;
}

Or, better, define a separate class for the form elements, for which you want to set the width property. But this will not be covered here… If anybody feels like writing a step-by-step guide for novice users, I’d be glad to link to such a tutorial.

Compatibility

For WP versions prior to 2.00, you are on your own…

License

This project is released under the terms of the GNU General Public License version 2 or later.

Downloads, Issue Tracking, Support

For the latest releases of Comment-Policy please visit the Comment-Policy development web site.

This plugin is not available on the WordPress Plugin Repository.

This project is no longer supported. Submitting support requests, issue reports or feature requests is not possible at this time.

Development Status

This plugin has been discontinued.

Comment-Policy WordPress Plugin by George Notaras is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. Permissions beyond the scope of this license may be available at Licensing Information.
Copyright © 2006 - Some Rights Reserved

George Notaras avatar

About George Notaras

George Notaras is the editor of G-Loaded Journal, a technical blog about Free and Open-Source Software. George, among other things, is a GNU/Linux enthusiast, a self-taught programmer and system administrator. He strongly believes that "knowledge is power" and has created this web site to share the IT knowledge and experience he has gained over the years with other people. George primarily uses CentOS and Fedora and spends some of his spare time developing open-source software. Follow George on Twitter: @gnotaras

17 responses on “Comment-Policy WordPress Plugin

  1. greenr Permalink →

    Thanks for this plugin. I will most likely soon be integrating it.

  2. scart Permalink →

    does it work in ajax comment? or any ajax plugin installed in the blog?

  3. KeepReadingUs Permalink →

    Hi,

    I am using wpv2.0.5 and activated this plugin based on the instructions on this page. But the checkbox option doesn’t show up for me.

    I also have the ajax comments installed. is that causing any problem for this to work fine?

    Thanks

  4. George Notaras Post authorPermalink →

    Unfortunately, I don’t have the time to check what the problem might be. The comment policy plugin is supposed to work with the default comment form of WordPress. Sorry.

  5. KeepReadingUs Permalink →

    Thank you Gnot. i wish i could get this to work. :)

    Pls do check whenever you get some spare time or when you update this plugin next time.

    Thank you.

  6. Tom Permalink →

    Finaly…
    i wait it long!

  7. RandomLogic Permalink →

    Great plugin, just what my simple mind needs.

    It’s working great with ajax comments too!

    I have a suggestion though: The “secret” key used to rename the formfield could also be done in a more sophisticated why by calculating a fieldname based on a secret and algorith only known to the server (e.g. XOR or something like that) which is reversed when the post is made to calculate the correct name to be retrieved.

    Does that sound sane to you?

    +rl

  8. George Notaras Post authorPermalink →

    Thanks for testing it with AJAX comments. :-) Indeed, there are more sophisticated ways to implement this concept.

    IIRC, I had tried to use a secret field name that was modified dynamically every time the page was loaded, but this method had a drawback in the case a human user had forgot to accept the terms and had to go back and check the checkbox. Actually, I cannot remember what exactly was wrong (I have to try it again :-) ), but I would have to make the code more complex in order to overcome that issue, which is something I generally do not like. I like the plugin code to be as simple as possible for easy maintenance. But, I’ll recheck this when I have some free time.

    Although the current implementation is very simple, it works fine for the moment. Almost all comment spam attempts from bots (and these are some thousands/month) end up with a 403 (forbidden) error code and never even reach akismet, which eventually has to deal with trackback/pingback spam only.

  9. Melle Permalink →

    Thanks, I needed this!

  10. Eduardo Larequi Permalink →

    Thank you for this excellent plugin.

    I’ve trying to style Comment-Policy in order to have it just before the Submit Comment button (“enviar comentario” in spanish), but to no avail.

    I’m using the Tarski theme. Any idea?

    Thanks in advance.

  11. George Notaras Post authorPermalink →

    Hi Eduardo,

    The plugin should take care of this, provided that the comment textarea id is “comment”. Your textarea has this id, so I am out of ideas of what might be wrong. I’ll try to use the theme you use on a test blog and also would like to know the name of the “comment preview” plugin you use in your blog. Maybe there is a conflict with that plugin which needs to be resolved.

    Thanks for your feedback.

  12. Eduardo Larequi Permalink →

    Thanks, GNot, for your quick answer.

    I’m using Live Comment Preview plugin. I’ve deactivated it for a while in order to check the position of Comment-Policy checkbox, but even without Comment Preview this checkbox appears under Submit Comment button.

    After this test, I’ve reactivated the Live Comment Preview plugin.

  13. George Notaras Post authorPermalink →

    I had some time to take a look at it. Finally, it has nothing to do with the preview pluging.

    The automatic (using javascript) placement of the comment-policy checkbox does not work with the Tarski theme’s comment form. I tried for a while to find a quick workaround, but I didn’t manage to do it. I’ll try to find another more general way to arrange elements in a future version.

    Until then, if you find a workaround, I would be very glad to know about.

  14. Eduardo Larequi Permalink →

    I’ll try to contact Tarski theme creators. If they can find an easy solution, I’ll inform you.

    Anyway, thank you very much for your interest.