Recent Topics

1 Jan 19, 2009 02:27    

Once a user has failed my anti-spam plugin (within the BeforeCommentFormInsert() function), I would like to place the notice of failure on the comment form (with the Name, Comment text, etc. fields already filled in with the user's data). Right now, I'm using the

$this-msg( $msg = "you failed", $category = "error" )

method, which prints $msg and puts a javascript link ("back to comment editing") on a page.

Is there a more graceful/integrated method of this process?

2 Jan 19, 2009 06:17

I don't want to be rude here, but "graceful" in the same sentence as "captcha" makes no sense at all to me. Captchas, by definition, are rude. They assume I can support and see images, and they NEVER respect the fact that I passed the stupid test a few minutes ago.

Having said that, I'm afraid you've identified THE method for handling this situation. I truly hope you find and share a method to automagically return to the comment page with the data re-filled and the 'you failed' message because I will *totally* steal it from you and update my turingtest plugin.

BTW you might want to look at turingtest to see how one can "test once pass forever" a visitor. I hate captchas and will only tolerate them when I absolutely must, but would hate them a heck of a lot less if I had any reason to believe that doing a captcha for {{whatever domain}} meant I would not have to do it again.

3 Jan 19, 2009 09:14

OT : you only need the following code ;)

$this-msg( "you failed", "error" )

¥

4 Jan 19, 2009 15:11

@EdB,

I love your Turing Test plugin: it's simple and straight forward. The reCAPTCHA project does include an audio version of the image for the visually-impared, which addresses the accessibility issue you brought up. I'll look at your other concern of acknowledging your completion of one a few minutes ago. While I agree that captcha's in general are an annoyance, I like the purpose behind reCAPTCHA, which "helps to digitize books, newspapers and old time radio shows"[1]. Getting two jobs done at once is a good compromise in my book.

@¥åßßå,

Like I said, that's the code I'm currently using. I'll keep messing with it to see what I can do.

Thanks.

[1] http://recaptcha.net/learnmore.html

5 Jan 19, 2009 15:22

Your difficulty in returning them to the original comment page is that you need to use $_POST and that's a smidge tough with a header redirect.

You *could* replace the evo fugly default white page with a form that sent them back to the original comment though

<?php
// semi-pseudo code
if( error )
{
  $ItemCache = get_Cache( 'ItemCache' );
  $Item = $ItemCache->get_by_ID( $params['Comment']->item_ID;
  echo '<form action="'.$Item->get_permanent->url().'#bComment_form_id_'.$Item->ID.'" method="post">'."\n";
  foreach( $_POST as $var => $val )
  {
    // santise these if it works huh ? ;)
    echo '<input name="'.$var.'" value="'.$val.'" />'."\n";
  }
  echo '<input type="submit" value="try again muppet" />
</form>';
  exit();
}
?>

free typed so expect at least one of your servers cpus to fry when you test it :D

¥

6 Jan 20, 2009 01:14

Actually I should apologize. "Original captchas" never fail to amaze me with their complexity and impossibility. I've noticed though that recaptchas seem to be a bit easier to see. And the little "give me a new one" thing is hella convenient.

To pre-pass all you need to do is see if the visitor has a b2evo cookie. For me I let the installation admin decide if anyone gets a pass on it, though every b2evo blog I've commented on seems to leave the default "if they did it once they pass" setting in place. I'll dig up the code for you if you want and PM it to you so we don't clutter this thread too much.


Form is loading...