Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

i have implemented the frontend form, which enables UNREGISTERED users to post on my site.

Everything in working perfectly, the only problem I have is with the implementation of the captcha.

All of the captcha solutions I found needs to put some outer file in the form action. But my form has this syntax:

<form action=""> 

I do not know what to do? If I put the file in the action field, I cannot add the post anymore. How would I put the verification code for the captcha in the same file as the form is? Or any better solution?

EDIT: How can I modify the form, that it would do the same thing (add post) as it does it now, but that I could include some file in the form action:

<form action="some.php">
share|improve this question
    
This is not WordPress related. Search for it in Stack Exchange. –  brasofilo Feb 2 '13 at 22:03
    
I'm running this code on wordpress but I agree, after all it is more PHP oriented, you're right. –  M P Feb 3 '13 at 0:55

2 Answers 2

Try Really Simple Captcha WodPress plugin. Here is a "how to" for implementing Really Simple Captcha for custom plugins: http://www.lost-in-code.com/platforms/wordpress/wordpress-plugins/wordpress-using-really-simple-captcha/

share|improve this answer
    
hm, I cannot get it working! Damn... maybe because I have this wp_nounce fields? Here is my fiddle: jsfiddle.net/aqMA7 –  M P Feb 2 '13 at 16:04
    
I use Really Simple Captcha for pretty much all my forms, it's surprisingly easy to implement. –  Howdy_McGee Apr 11 at 20:06

Use jQuery and first send the form content, here the captcha, to your file where the captcha is checked. Then send the form data to your posting routine.

$( '#frontend-post-form-submit' ).click(
  function(event) {
    var data = { ... insert the captcha from the form here ... };
    $.post(
      'some_file.php',
      data,
      function( result ) {
        // stop if the captcha isn't correct
        if ( false === result.result ) {
          event.preventDefault();
        }

        return result.result;
       }
     );
  }
);

If your submit button have the id frontend-post-form-submit and the captcha isn't correct, the jQuery will stop sending the form (event.preventDefault). Else the form will be submitted normally.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.