• Hi there.
    I’m using wpcf7_before_send_mail hook to make a post with form fields. I also use CAPCTHA (default) at form.
    I noticed that if I use wpcf7_before_send_mail hook and provide wrong CAPTCHA post is created anyway.
    Couldn’t find any documents with all CF7 hooks available. Maybe there are some wpcf7_AFTER_send_mail? How do I make some actions using “before send” hook only if CAPTCHA is accepted?

    http://wordpress.org/extend/plugins/contact-form-7/

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Takayuki Miyoshi

    (@takayukister)

    What CAPTCHA do you use and how do you use it?

    Thread Starter Ilya

    (@shvakovski)

    Hi, Takayuki. First of all, thanks for the great plugin.
    I use CAPTCHA from CF7 admin (it asked to install Really Simple Captcha). At my form I output it like:
    <p>Numbers<br />[captchac captcha-556][captchar captcha-556] </p>
    And my code in functions.php:

    function my_wpcf7_save($cfdata) {
      $formdata = $cfdata->posted_data;
      $newpost = array(...);
      $newpostid = wp_insert_post($newpost);
      }
    add_action('wpcf7_before_send_mail', 'my_wpcf7_save',1);

    If I enter wrong numbers I’m given an error but post is created. So I have as many posts created, as many times person/spambot tries to submit form.

    Plugin Author Takayuki Miyoshi

    (@takayukister)

    If CAPTCHA validation get failed wpcf7_before_send_mail hook does not run. So it shouldn’t create posts. Weird.

    Thread Starter Ilya

    (@shvakovski)

    Can you try to replay this kind of error? Make some form, try to apply hook and see?
    I mean is there my bug anywhere making it work this way?

    Thread Starter Ilya

    (@shvakovski)

    Is there any after validate hook to use? It’s not critical to use wp_insert_post before or after mailing I suppose.

    Plugin Author Takayuki Miyoshi

    (@takayukister)

    I just tested your customization on the latest version of WordPress. Couldn’t reproduced the problem.

    Do you have other plugins installed? I guess there is another plugin firing wpcf7_before_send_mail hook.

    Thread Starter Ilya

    (@shvakovski)

    Thanks. Will check.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘[Plugin: Contact Form 7] wpcf7_before_send_mail and CAPTCHA’ is closed to new replies.