» Part of Wolfey's Website

Two Anti-Spam Fields for Comments?

October 15, 2006 at 4:24 PM

A lot of spammers have been commenting on the entries in my weblog - fortunately, most are being stopped by the Spam Karma 2 plugin =)

However, I want to keep them from even posting their spam in the first place, so I'm wondering: Would it be possible to edit the "Comments" file for my theme to use two fields that have to be filled in a certain way in order to post a comment? If so, what code would I need to add (and what would I have to manually change for it to work with my site) to accomplish this?

I'd prefer it to be simple, and (for accessbility) not use any JavaScript - I've managed to do something very similar to this with a relative's form submission page, but unfortunately, I can't figure out how to do the same with a WordPress theme =/

  • The first anti-spam field is one that has to be left blank - when a comment is submitted, if that field is not blank, then the person can't post their comment. I haven't decided yet whether that field will be blank from the start, or if there will be text in it that the user must remove to make it blank.
  • The other will be a blank field that has to be filled in with a particular word - if that word isn't used (either by being left blank or having something else typed in), the user can't post their comment.

In other words, if either (or both) of the two fields are filled in improperly, a comment can't be posted - if both fields are filled in properly, however, then the comment can be posted.

One more thing to note: I am using the Filosofo Comments Preview WordPress plugin, and have modified my template so that the "Post" button is not displayed when viewing a blog entry. Instead, a "Preview" button is shown, which takes the commenter to another page that shows them what their comment will look like if no further changes are made when they post it ("Preview" is still there in case more checking has to be made, but there will be a "Post" button to click on this time around if everything looks good). This was done to ensure that anyone who comments on an entry will see a preview of what their comment will look like (very useful if the viewer has JavaScript disabled, since the Comment Live Preview plugin doesn't work if JavaScript is disabled), and fix any errors that may be present before posting their comment.  Please take this into account with any code that you may come up with.

If you can help me out with this, I'd greatly appreciate it =D


No comments yet.

RSS feed for comments on this post.

Comments are closed for this entry.

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License. | Wolfey's Weblog