Skip to content

Commit

Permalink
Merge pull request #12 from gravityview/develop
Browse files Browse the repository at this point in the history
Don't check for spam on the GF Preview page
  • Loading branch information
zackkatz committed Feb 16, 2022
2 parents d75d2a0 + 3db39a1 commit 5126098
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
6 changes: 4 additions & 2 deletions gravityforms-zero-spam.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: Gravity Forms Zero Spam
* Plugin URI: https://gravityview.co?utm_source=plugin&utm_campaign=zero-spam&utm_content=pluginuri
* Description: Enhance Gravity Forms to include effective anti-spam measures—without using a CAPTCHA.
* Version: 1.2
* Version: 1.2.1
* Author: GravityView
* Author URI: https://gravityview.co?utm_source=plugin&utm_campaign=zero-spam&utm_content=authoruri
* License: GPL-2.0+
Expand Down Expand Up @@ -100,6 +100,8 @@ public function add_key_field( $form ) {
*/
public function check_key_field( $is_spam = false, $form = array(), $entry = array() ) {

$should_check_key_field = ! GFCommon::is_preview();

/**
* Modify whether to process this entry submission for spam.
*
Expand All @@ -109,7 +111,7 @@ public function check_key_field( $is_spam = false, $form = array(), $entry = arr
* @param array $form The form currently being processed.
* @param array $entry The entry currently being processed.
*/
$should_check_key_field = gf_apply_filters( 'gf_zero_spam_check_key_field', rgar( $form, 'id' ), true, $form, $entry );
$should_check_key_field = gf_apply_filters( 'gf_zero_spam_check_key_field', rgar( $form, 'id' ), $should_check_key_field, $form, $entry );

if( false === $should_check_key_field ) {
return $is_spam;
Expand Down
17 changes: 10 additions & 7 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Contributors: gravityview
Tags: gravityforms, gravity forms, anti-spam, antispam, spam, spam-blocker, spambot, spammer, add-ons, honeypot
Requires at least: 3.0.1
Tested up to: 5.8.2
Tested up to: 5.9
Stable tag: trunk
Requires PHP: 5.2.6
License: GPLv2 or later
Expand Down Expand Up @@ -73,13 +73,11 @@ New form submissions will not be checked using Zero Spam.

= I only want on sepecific forms. How do I disable Zero Spam by default? =

To disable by default, add this code to your site ([here's how](https://docs.gravityview.co/article/210-where-to-put-code-samples):
To disable by default, add this code to your site ([here's how](https://docs.gravityview.co/article/210-where-to-put-code-samples)):

```
add_filter( 'gf_zero_spam_check_key_field', '__return_false' );
```
`add_filter( 'gf_zero_spam_check_key_field', '__return_false' );`

Once you have added that code:
Once you have added that code to your site:

1. Go to the form
2. Click on Settings
Expand All @@ -99,7 +97,12 @@ First, **de-activate and re-activate the plugin**. Then let us know on the suppo

== Changelog ==

= 1.2 on December 10, 2021 =
= 1.2.1 on February 16, 2022 =

* Improved: Don't check for spam on the Gravity Forms Preview page
* Tested with WordPress 5.9

= 1.2 & 1.2.0.1 on December 10, 2021 =

* New! Added a per-form setting "Prevent spam using Gravity Forms Zero Spam" that enables or disables Gravity Forms Zero Spam from processing! [Check out the FAQ to learn how to use this setting](https://wordpress.org/plugins/gravity-forms-zero-spam/#faq-header). Note: this feature requires Gravity Forms 2.5 or newer.

Expand Down

0 comments on commit 5126098

Please sign in to comment.