Sat 12 Aug 2006
Challenge plugin for WordPress is available! Challenge restricts comment spam by throwing the commenter a challenge. The challenge and the answer can be user-defined, and can be of anything including PHP-evaluatable expressions. This plugin can also be used to ensure the commenter’s basic intelligence before he/she/it leaves a comment. The current version of Challenge is version 1.0.
Download and documentation are available here.
Challenge is under GPL and is available for free. You can download, use, modify, or keep in the back of your plugins directory in total disregard for eternity.
Please leave a comment here for bug report and additional support.
**Update: Version 1.1 is now available.






August 12th, 2006, 6:56 am
Hello. I like the idea of this plugin very much. If only you can make it work for all voting polls. hahahaha. I digress.
I am receiving this error when activating the plugin.
Parse error: parse error, unexpected $end in C:\Inetpub\wwwroot\mysit\wp-content\plugins\challenge.php on line 312
I noticed a space at the end of the php file so I took it out but all it does is change the error to:
Parse error: parse error, unexpected $end in C:\Inetpub\wwwroot\mysite\wp-content\plugins\challenge.php on line 311
August 12th, 2006, 11:32 am
That is weird…I am using the same plugin here without problem. I will take a look. Thanks.
August 12th, 2006, 12:49 pm
I’ve tested the plugin on two-other blogs, and can’t seem to reproduce the problem…so I’m rather puzzled at the moment. Perhaps it’s a PHP version thing (I can only test on PHP4)…or a linux/Windows thing (did you upload the plugin using ascii-only transfer type?).
In any case, try the new bug-fix version (1.1), and see if it makes any difference.
August 12th, 2006, 5:28 pm
A strange bug has been reported on some earlier versions of WP1.5. Apparently if you install and activate both Challenge and Amusements, both option pages will appear the to be for Challenge, i.e. you will not be able to change options for Amusements.
A work-around is to deactivate one of the plugins while you are changing the options for the other. It’s stupid, I know, but since WP1.5 is on the way out and 2.0 has no such problems, I probably won’t be spending too much time looking into this problem.
However on the other hand, if you have a solution to this, I’ll certainly be very glad to hear it.
August 13th, 2006, 8:23 am
New error.
Warning: Cannot modify header information - headers already sent by (output started at C:\Inetpub\wwwroot\mysite\wp-content\plugins\challenge.php:319) in C:\Inetpub\wwwroot\mysite\wp-includes\pluggable-functions.php on line 272
I’m using Windows Server 2003, PHP5, Apache
August 13th, 2006, 12:48 pm
Ah..I see. I was using PHP4+Linux. I just switched my server to PHP5 and still no problem. I will see if I can get my hands on a Windows Server and test it. Thanks again.
—
I found a possible source of the problem here. I looked at the file challenge.php with a hex-enabled editor, and removed all the extra characters before the first < ? php and the last ? > (even though in text-mode you might not see them). You can do this yourself, or download the zip file again. When you upload the php file to your Windows Sever, try uploading the zip file directly and unzip on the server instead of transfering the text file (as the transfer process might add extra characters to text files).
August 16th, 2006, 1:11 am
Hi,
I just downloaded the zip file and when unzipped it seems to be unusable. Wordpress won’t detect it as a plugin, and the source itself looks rather jumbled. Here’s the first line:
0000000: 3c3f 7068 700d 0a2f 2a0d 0a50 6c75 6769
August 16th, 2006, 1:54 am
Wow that was really messed up. Thank you for letting me know. It should be okay now, please download it agian.
August 16th, 2006, 6:13 pm
Thanks! I’ll give it a whirl after lunch. Seems like just the plugin I’ve been after since I’d rather avoid the whole image code nonsense for as long as possible. :))
August 17th, 2006, 3:22 am
*** This is a whisper message for ΛορδΧηαος! ***
August 17th, 2006, 11:10 am
1.1 is working fine now. GJ. /me likes. What are your future plans for the plugin?
August 18th, 2006, 10:26 am
Thanks. Well, let’s see….may be a Turing Test conversationalist: “Lo! Who goes there? Where did you get those coconuts?”
September 22nd, 2006, 11:02 pm
It would be useful if this plugin allowed a symbol syntax to base answers on the properties of the post. For example, a question like “How many letters are there in the first word of this post’s title?” is a better check than using equations (which computers can solve easily), but configuring this plugin’s answer field with an expression that determines this answer is difficult. It might not even be possible right now.
September 23rd, 2006, 9:34 pm
That’s an interesting thought.
Anyway, even though computers can solve equations easily, they still have trouble parsing natural language questions. So all you have to do is wrapping your equation in a convoluted grammar, e.g.:
“What would you get if you were to take 2 from 5 and multiply the result by the result you get from summing 7 and 9?”
There are three operations, two “from”s and two “results”…all with different roles and syntaxes. It should confuse the hell out of even sophisticated natural language parsers (and perhaps some people who can’t read properly :P)!
October 6th, 2006, 5:31 pm
is there any possibility to save the answer in a cookie? i just want the suer to write “spam” in the field.
October 9th, 2006, 9:15 pm
Great plugin, thanks!
October 14th, 2006, 1:03 am
Hello, I like your extension.
I made something quite similar on my blog but didn’t pack it into a real extention (with parameters and so on).
However, I think you should test the answer dynmically with javascript, rather than waiting for the post to anwser with an error.
At a ergonomic point of view, people may not see that the answer is required and may post the comment without it. Having them redirected on a raw error page might be discouraging.
I have made a simple javascript test on my page and I highlight the field if the answer is not filled or wrong.
You don’t need to pass the anwser in clear to the browser to do so : I pass the md5 hash of the answer and I test that it is similar with the hash of the anwser of the visitor.
You can try it on my site. I’ll send you the code if you need it.
October 19th, 2006, 9:23 pm
Thank you for this plugin. Finally I don’t have to watch those bloody long lists of spam recognized by Akismet. Cheers from Poland,
Jano
October 20th, 2006, 4:15 am
Great plugin! I wish I found and used this plugin earlier. Just like what Jano said, I don’t have to deal with those pesky spam comments. This is a great complimentary plugin to Akismet.
November 5th, 2006, 7:03 pm
Bug report:
Slashes appear when an admin uses apostrophes in their challenge question, or their error responses.
To reproduce: enter a question like “What’s the capital of France?” - press submit, and you’ll see it appear as “What\’s the capital of France?”.
Workarounds: Rephrase your question/responses to avoid apostrophes.
I’ve not coded a WordPress plugin before, but to fix this, you need to use PHP’s strip_slashes() function when echoing out the question/errors. Might give it a go later.
November 5th, 2006, 7:12 pm
Not that difficult to fix, so it seems - so I’ve emailed a replacement file to you.
(It’s stripslashes() not strip_slashes() by the way; my bad)
November 13th, 2006, 8:40 am
I have a stupid one - how do you call the plugin to appear in comment form?
November 26th, 2006, 4:58 pm
Just setting this up on my blog, however it doesn’t work well for large numbers with maths, there is also some rather gaping security problems.
Due to the way you do your comparison with substring matching (stristr) entering “a” can be a correct answer for “answer”.
The same problem can happen with numbers.
I’ve changed the way this works so the list of strings must be seperated with |’s.
e.g: “hello world|test|lol”
correct answers: “hello world”, “test”, “lol”.
Numbers still work as before.
I recommend that you also remove the hidden no_session mode, as it is a security hole:
if ($this->_no_session_cookies)
{?>
” />
and it probably doesn’t work if the user doesn’t support sessions:
$correct_answer = $_SESSION[’CHALLENGE_ANSWER’];
I’ve uploaded a version with my changes here:
http://localhost.geek.nz/challenge/
December 4th, 2006, 12:45 am
After successful activate of the plugin, when i try to test, I get the following error: (after comment is submitted)
Fatal error: Call to undefined function: array() in /web/nridivorce/wp-includes/functions.php on line 1122
December 6th, 2006, 9:42 am
This is a fabulous plugin. Kudos! A couple of questions though. How can I modify the plugin so that the question appears before my ‘Add Comment’ button on my site? Is there anyway to have a popup appear when the question is not answered or answered incorrectly? Being directed to a mostly blank page is not as sexy.
December 7th, 2006, 1:27 am
Thanks for this nice plugin - works flawlessly on my WordPress 2.0.3 blog : )
December 7th, 2006, 2:54 am
Great plugin but some problems:
1) The ‘ problem of slashes also happens with “’s (i.e., both single and double quotes). This also appears to discard chunks of the question.
2) For “Answer Position” I select before but it always appears after.
3) I have had a significant number of users who report that they do enter the correct response but it tells them they got it wrong.
4) Back button for some browsers apparently discards the comment text.
Suggestion, if the answer is wrong or blank, show the same page again with the error message and give them a chance to retry preserving what ever comments they wrote. If available on the user’s browser, javascript would be useful.
Thanks for the plugin.
-Walter
http://SugarMtnFarm.com/blog
December 12th, 2006, 7:07 am
I’m getting duplicate emails. It’s like they failed the challenge, it emailed me. Then they tried again and passed the challenge and it emailed me again.
December 12th, 2006, 8:30 am
Thanks for a great plugin!
December 21st, 2006, 6:47 pm
nice plugin !!;)
December 22nd, 2006, 8:46 am
I looked through the PHP code and was wondering what would need to be changed so that this plugin could work for any users of the site (non registered and users that are logged in)?
December 29th, 2006, 7:49 pm
Hi Lord Chaos!
Nice plugin. I have one problem, and that is that after I changed my theme from Connections Reloaded to Vertige (www.briangardner.com/themes/vertigo-wordpress-theme.htm)
i cant get the question to show before the comment text area. How is it possible to change that? Should I send you the php-code for the comments.php page or can I make a direct call somehow, to make your plugin showup.
December 30th, 2006, 9:08 am
What’s with the no hotlinking error when I try to download it? I copied the URL, flipped over to my ssh window and tried fetching it with wget, but it gives me this no hotlinking error which dumps an index.html into my directory instead.
So… I suppose I could download it locally to my machine and then sftp it up to my site, but why make us jump through those hoops?
January 2nd, 2007, 7:15 am
I switched to the Cutline theme and I can’t get this to work either. Any suggestions?
http://cutline.tubetorial.com/
January 2nd, 2007, 7:19 am
please ignore my previous comment. after a little more hassling, I realized I had to log out to see the challenge properly. Thank you for a truly great plugin.
January 9th, 2007, 2:31 pm
I think the plugin is really creative. But in order to be sure, you could consider changing the default challenge, as the responses are easily guessable by a bot.
January 17th, 2007, 1:25 pm
I love the plugin, but am having some problems changing the position of the challenge to show up above the comment box. I’ve changed it in the admin options, logged out, and refreshed a single post page, to no avail.
Do you have any idea on how to massage themes and the comments.php page to make this appear where it appears for lots of other folks using the plugin? Thanks!
January 17th, 2007, 3:21 pm
Thank you all very much for the feedbacks, bug reports, and suggestions. Yes I have been neglecting (and may continue to do so for a little while) these plugins due to my taking on another big project at work. I promise to return to them as soon as the current project has slowed down a bit.
January 26th, 2007, 1:25 am
regrettably, i have a pretty serious shortcoming to report. i had this plugin in place, a visitor wrote a nice long comment, then accidentally typed an incorrect answer to the challenge. upon returning to the page from the ‘you got it wrong’ notification - all his comment text was gone. i just tried it myself here, and experienced the same thing. this is a ‘deal killer’ unfortunately - i tend to write long comments myself, and the thought of losing everything I just wrote because i ‘fat-fingered’ an answer is just too frustrating to consider, so i’ve disabled the plugin on my site.
i’m not sure whether there’s any way around the problem frankly. darn shame, i really like the plugin.
oh. another problem i just noticed. i was about to submit this very comment, and here’s my comment question:
8+2×5=?
well, that can have two correct answers!
(8+2)x5=50 or
8+(2×5)=18
ack! which do i answer??
==============
so i copied what i wrote above just in case, and answered “50″. it said i failed the challenge, but when i came back to the page, all my text was still there.
i think i need another cup of coffee. i think my brain isn’t working right.
January 31st, 2007, 6:05 am
Paul,
8+2×5 has only one solution! It’s always multiplication before addition.
Anyway, I’ve installed the plugin, but it doesn’t appear in the comment form. Is there a special code to activate it?
Regards
Chris
January 31st, 2007, 2:52 pm
Hi. From the responses there seemed to be situations where the challenge box will not appear. As explained in Known Issues, this may be caused by conflict with other co-existing plugins that use javascript to manipulate elements in the page. Try disabling these plugins and see if the challenge box would appear.
January 31st, 2007, 11:31 pm
*** This is a whisper message for ΛορδΧηαος! ***
February 6th, 2007, 5:26 pm
Hi,
is this plugin compatible with Wordpress 2.1 ??
Thank you !
February 7th, 2007, 10:22 am
Hi,
I am using the “LG blue 3c” theme (http://www.themeporter.com/2007/01/01/lg-blue-3c-wordpress-theme/) on Wordpress 2.1.
I have activated the challenge.php plugin and can see the options for the Challenge Plugin under Options.
However the challenge itself doesn’t appear in the Comments area. If someone fills out a comment with the plugin enabled they can’t submit the comment because the challenge (which you can’t see) hasn’t been filled out. The strange thing is the post count still increments.
I have no other plugins enabled. Is there an issue with Wordpress 2.1 or the “LG blue 3c” theme?
February 11th, 2007, 1:35 am
Chris,
No. It depends on the operator rules. There are different systems. You happen to know one convention.
-Walter
Sugar Mountain Farm
in the mountains of Vermont
http://SugarMtnFarm.com/blog/
http://NoNAIS.org
February 16th, 2007, 4:41 am
Most spam, Akismet developers tell is, is targeted at posts which are more than a month old, so it would be good if you could configure Challenge so it only challenges comments being made on posts older than a month (or whatever length of time the admin chooses).
February 18th, 2007, 6:52 am
Christiaan has an excellent idea. It would be great to be able to give challenge A (which could be nothing) for posts from this day or week and then challenge B for posts older than that. Heck, throw in a third level challenge C for posts older than a month or a year or what ever (all settable) that is harder to drive the spammers nuts. I’ve occasionally had what was obviously humans spamming on very old posts.
March 20th, 2007, 12:17 am
Hi, great plugin but it does not work on wp 2.1 or later. I’ve installed challenge on wp 1.5 and everything’s ok, but on new versions of wordpress whatever answer you put in the box you can’t post a comment because it does not recognize the right answer.
How about a new version of challenge 2.1 compatible?
Thx
March 21st, 2007, 4:14 pm
Hi,
I’ve been using Challenge for a while – unfortunately it doesn’t work!!
I have a nonsense question and a random string of characters as an answer – no-one should be able to guess it.
Unfortunately I’m still getting spam!
I’m wondering if Danzel’s reported issues are making guessing an answer that works trivial. I will look at his changes.
Cheers!
March 22nd, 2007, 2:10 pm
Duncan, that would have nothing to do with spammer bots correctly guessing at your nonsense question (which is nearly impossible). They probably got in by other means (for example by “spinging” via trackback mechanism). Try for a while restricting commenting to only registered users on your site, and see if you still get spams…then you’ll know.
March 22nd, 2007, 2:12 pm
With regards to WP2.1…alas I still need to find the time to upgrade my own site to WP2.1 before I can do anything.
March 23rd, 2007, 9:21 am
Looking forward to seeing how I can combine this with Brian’s Threaded Comments! I love this solution and wrote a similar plugin for Contact Form Spam.
April 21st, 2007, 2:55 am
Here goes…
April 21st, 2007, 3:03 am
*** This is a whisper message for ΛορδΧηαος! ***
April 23rd, 2007, 12:05 am
hi there, trackbacks does not work! just would like to say thanks for your great plugin, appears on my “must-have” list
best,
michael
April 24th, 2007, 6:05 pm
Hello. I have translated this plugin to the Spanish language: Challenge v1.1 (spanish).
Bye!
April 28th, 2007, 6:49 am
*** This is a whisper message for ΛορδΧηαος! ***
May 5th, 2007, 12:43 am
Your comment challenge isn’t working well! It just chewed my comment, don’t know why.
May 19th, 2007, 11:28 pm
When is it expected work of your plugin with
“WP-PostRatings”? What prognosis?
May 25th, 2007, 2:04 pm
i go through the sample screen above. and like to try this comment here.. now i mean.
the user might be confused on how to answer that question. think this the strong part. Noob can not comment here.. haha
nice
May 29th, 2007, 5:47 pm
Nice job. Thanks for releasing your plugin.
As many users, I’m waiting for a new release which will be compatible with Gamerz’s plugins. The one I use is WP-Polls, and I would like to use both in same time…
June 2nd, 2007, 9:29 am
I’ve been getting complaints from people saying that after writing a long comment on my blog, and correctly answering the challenge, they see the error screen anyway and their comment is gone when the go back. This only happens sometimes - is there a timeout feature or some other reason why even answering the challenge correctly would produce an error? Thanks.
June 3rd, 2007, 9:41 am
I think some one has taken the code and made a version where the challenge question/answering is done in a pop-up window. You may want to search for it.
June 20th, 2007, 12:58 am
Is this plugin still supported ?
July 16th, 2007, 8:54 pm
*** This is a whisper message for ΛορδΧηαος! ***
July 17th, 2007, 6:29 pm
dsdsds
July 31st, 2007, 5:08 am
I verified this bug Danzel reported:
Unfortunately, his solution no longer exists on his blog… so I created my own. Replace the line where stristr is located with:
if ((strcmp(strtolower($correct_answer),strtolower($answer)) != 0) ||
($this->_no_session_cookies && (strcmp(strtolower($correct_answer),strtolower($no_session_answer)))!=0))
This will ensure direct comparison and case insensitive (as was originally intended).
July 31st, 2007, 5:20 am
OOPs I just realized that there are 2 lines to replace, and you need to add the curly bracket at the end. Here is the complete code:
if ((strcmp(strtolower($correct_answer),strtolower($answer)) != 0) ||
($this->_no_session_cookies && (strcmp(strtolower($correct_answer),strtolower($no_session_answer)))!=0)) {
On another note, I have created a generic blank field check via javascript. (this will at least prevent people who missed entering the check question from loosing their comment). Unfortunately, you’ll need to modify your template for it to work. You can download the script at:
http://khsbicycles.com/js/chk_fields.js
In your posting template, you’ll need to modify the commentform section replacing the “form” line with something like:
/wp-comments-post.php" method="post" id="commentform" name="commentform"
onSubmit="return HH_check_required(commentform, 'author email answer')">
You may need to change author and email to match whatever else those field are named in your comment form.
September 17th, 2007, 9:25 pm
How did the spam bots get so smart?
I was getting a lot of spam. I couldn’t see how the bots were managing to answer the question. So I made it harder, then I made it impossible (I set my own answer as something like ’ssdf98hsdfosd89fyhsd90f’) and I’m still getting spam comments.
Have the spammer found a by-pass?
October 2nd, 2007, 9:49 pm
Just a test
October 2nd, 2007, 9:51 pm
Another test
November 18th, 2007, 11:31 pm
*** This is a whisper message for ΛορδΧηαος! ***
December 8th, 2007, 10:47 pm
hey, i’ve got challenge on my site but have been geetting a lot of complaints about it’s location and general visibility - is there any way i can change those things? i’d like to make the font bigger and move it to where it can be better seen?
i’ve got it turned off right now - too many complaints. but i want it back on asap because it really works.
where do i get me that neat whisper function? going to look that one up….
December 9th, 2007, 5:31 pm
There is really nothing stopping you from changing the code to suit your own needs (just change the font and where the form is inserted). But I believe there are already options you can set to change where the challenge box appears, and you can also specify your own question (so you can insert HTML tags in your question to alter its appearance). Try admin-login/options/challenge and read the instructions.
December 15th, 2007, 8:24 pm
*** This is a whisper message for ΛορδΧηαος! ***
December 19th, 2007, 4:21 am
Do you know when you’ll be updating this plugin for 2.2+?
This is the best plugin we’ve found to combat comment spam, however many people write us to complain that they can’t post a comment. The error they receive is the error that is shown when they answer the challenge question, even though they are answering the question correctly.
January 10th, 2008, 8:24 pm
*** This is a whisper message for ΛορδΧηαος! ***
January 25th, 2008, 7:33 pm
thank ypou site
March 24th, 2008, 8:42 pm
*** This is a whisper message for ΛορδΧηαος! ***
April 30th, 2008, 11:31 pm
I believe i found a bug. Challenge asked me the sum of 0 and 0. And I answered 0. And it told me i was wrong.
I’m running Challege 1.1
May 14th, 2008, 2:57 pm
Thanks! Customized it to do simple addition only.