Support » Plugin: Contact Form 7 » Feature Request: Allow the reCAPTCHA score threshold to be customized

  • KZeni

    (@kzeni)


    I see that modules/recaptcha.php has the following code:

    
    $score = isset( $response_body['score'] ) ? $response_body['score'] : 0;
    $threshold = 0.5;
    $is_human = $threshold < $score;
    

    It’s entirely possible that some sites (new ones where there isn’t a good reference of behavior, short forms where there isn’t much content to go off of, or ones where the nature of the form submission seems spam-ish) might be given a score of less than 0.5 by reCAPTCHA.

    I think it should be up to the site owner/maintainer to allow more/less spam through based on what reCAPTCHA returns as the score rather than having it be hard-coded into the plugin like it is now. $is_human has wpcf7_recaptcha_verify_response filters applied to it, but that’s after the fact of when it’d ideally be customizable.

    – Proposed solution –
    Make it so the $threshold value has a filter that can be applied to it to adjust it as needed. Alternatively, I could see this being a slider in the settings for reCAPTCHA integration which goes from 0 to 1 at a 0.1 increment so it’s surfaced in the site’s settings & much friendlier to work with.

    Thanks for the great plugin!
    Kurt

Viewing 2 replies - 1 through 2 (of 2 total)
  • nikkofir

    (@nikkofir)

    Yes, this would be an important feature to add!

    We also need the ability to correct messages incorrectly labelled as spam – currently they are marked as spam, and not sent – but if you mark them as “not spam” they are still never sent to the recipient – not good at all…

    Tim

    KZeni

    (@kzeni)

    I have gone ahead and made the edits to actually allow for what I proposed.

    The updated modules/recaptcha.php file can be seen here: https://gist.github.com/KZeni/5c98823b39729b5d0a09c24ed0b752e2
    Here’s a comparison of what changed between the current 5.1.1 CF7 version of the file and what I’m proposing: https://gist.github.com/KZeni/5c98823b39729b5d0a09c24ed0b752e2/revisions

    You can see that there’s now a range input that goes between 0 and 1 with a stepping of 0.1 in the CF7 reCAPTCHA settings. Reset keys still works as expected, but you can now save changes to the settings (if you happen to adjust the threshold) without needing to reset the keys first.

    The threshold setting is then what’s used instead of the hard-coded 0.5 value, and it does default to 0.5 if it hasn’t otherwise been set.

    I’ve submitted this to the official site’s contact form to see if this could be officially adopted in a future update of the plugin.

    @nikkofir, I know this doesn’t address being able to re-send the email on-demand, but that does seem like a separate feature & probably should be handled/requested separately as part of the Flamingo plugin’s support (I’m assuming you’re using Flamingo for managing the inbound messages & setting them as not spam after the fact), because that’d be handled post-send, and that’s not something Contact Form 7 manages, currently. I’ve gone ahead and posted a topic regarding this for you here if you want to keep an eye on that topic: https://wordpress.org/support/topic/feature-request-add-option-to-re-send-emails/

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.