Skip to content

Commit 8d52afd

Browse files
author
Gravity Forms
committed
Updates to 2.9.7.2
1 parent 4b5eefb commit 8d52afd

21 files changed

+2808
-2723
lines changed

assets/js/dist/assets.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<?php return array('hash_map' => array('admin-components.min.js' => array('version' => '066871d1b555f41a6e9697608dee9ad4', 'file' => 'admin-components.min.js'), 'libraries.min.js' => array('version' => '4dea2c1ac02022febd3ab26058a82fa4', 'file' => 'libraries.min.js'), 'react-utils.min.js' => array('version' => '317e7f73d059f4c17a97f822575d199c', 'file' => 'react-utils.min.js'), 'scripts-admin.min.js' => array('version' => 'f31619cf3dd8cf8fcd68a027dc02dc48', 'file' => 'scripts-admin.min.js'), 'scripts-theme.min.js' => array('version' => 'df7d94fe9fc1f64aa683997d87531853', 'file' => 'scripts-theme.min.js'), 'utils.min.js' => array('version' => 'a8f8e72876ba5bc3f797026fe4225946', 'file' => 'utils.min.js'), 'vendor-admin.min.js' => array('version' => '5c817f596821cbb9a6254ebae1506a95', 'file' => 'vendor-admin.min.js'), 'vendor-theme.min.js' => array('version' => '639b4ac21c17c9dc304b05db4a3d3293', 'file' => 'vendor-theme.min.js')));
1+
<?php return array('hash_map' => array('admin-components.min.js' => array('version' => '066871d1b555f41a6e9697608dee9ad4', 'file' => 'admin-components.min.js'), 'libraries.min.js' => array('version' => '4dea2c1ac02022febd3ab26058a82fa4', 'file' => 'libraries.min.js'), 'react-utils.min.js' => array('version' => '317e7f73d059f4c17a97f822575d199c', 'file' => 'react-utils.min.js'), 'scripts-admin.min.js' => array('version' => 'f31619cf3dd8cf8fcd68a027dc02dc48', 'file' => 'scripts-admin.min.js'), 'scripts-theme.min.js' => array('version' => '96c75ff0cdaac8ba09d57979885a0fc0', 'file' => 'scripts-theme.min.js'), 'utils.min.js' => array('version' => 'a8f8e72876ba5bc3f797026fe4225946', 'file' => 'utils.min.js'), 'vendor-admin.min.js' => array('version' => '5c817f596821cbb9a6254ebae1506a95', 'file' => 'vendor-admin.min.js'), 'vendor-theme.min.js' => array('version' => '639b4ac21c17c9dc304b05db4a3d3293', 'file' => 'vendor-theme.min.js')));
+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<?php return array('dependencies' => array('gform_gravityforms_utils', 'jquery', 'wp-polyfill'), 'version' => '3221725d61bf5a30ff41');
1+
<?php return array('dependencies' => array('gform_gravityforms_utils', 'jquery', 'wp-polyfill'), 'version' => '432ac1965f9ee22a65a7');

assets/js/dist/scripts-theme.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

change_log.txt

+10
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
### 2.9.7.2
2+
- API: Fixed an issue with the gform/post_render event being fired too early during an AJAX submission, which causes conflicts with certain add-ons.
3+
- Updated the default honeypot action from "Do not create an entry" to "Create an entry and mark it as spam".
4+
- Fixed an issue where the honeypot doesn't work with new Ajax.
5+
- API: Updated GFAPI::submit_form() to support an optional 6th param, $initiated_by, the process that initiated the submission. Supported integers are 1 (aka GFFormDisplay::SUBMISSION_INITIATED_BY_WEBFORM) or 2 (aka GFFormDisplay::SUBMISSION_INITIATED_BY_API). Defaults to GFFormDisplay::SUBMISSION_INITIATED_BY_API.
6+
- API: Updated the result returned by GFAPI::submit_form() to include the is_spam, confirmation_message, and confirmation_type properties when the form fails honeypot validation and it is configured to use the "Do not create an entry" action.
7+
- Fixed a PHP fatal error that occurs during background processing if another plugin includes an older version of WP_Async_Request that doesn't include maybe_wp_die().
8+
- Fixed a PHP fatal error that occurs in wp_date() for some PHP versions and timestamps during background processing if a batch has previously been attempted.
9+
- Fixed a 403 error that occurs when a background processor dispatch method is called during an admin-ajax.php request, such as the one used to process new Ajax enabled form submissions.
10+
111
### 2.9.7.1
212
- Fixed an accessibility issue where the consent field description does not get keyboard focus.
313
- Added a setting to disable the dashboard widget.

form_display.php

+1
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ public static function process_form( $form_id, $initiated_by = self::SUBMISSION_
169169
// Display confirmation but doesn't process the form. Useful for spam filters.
170170
$confirmation = self::handle_confirmation( $form, $lead, $ajax );
171171
$is_valid = false;
172+
self::set_submission_if_null( $form_id, 'abort_with_confirmation', true );
172173
} elseif ( ! $saving_for_later ) {
173174

174175
GFCommon::log_debug( 'GFFormDisplay::process_form(): Submission is valid. Moving forward.' );

form_settings.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ public static function form_settings_ui() {
9797
* Prepare form settings fields.
9898
*
9999
* @since 2.5
100+
* @since 2.9.8 Updated honeypotAction default to spam.
100101
*
101102
* @param array $form Form being edited.
102103
*
@@ -518,7 +519,7 @@ public static function form_settings_fields( $form ) {
518519
array(
519520
'name' => 'honeypotAction',
520521
'type' => 'radio',
521-
'default_value' => 'abort',
522+
'default_value' => 'spam',
522523
'horizontal' => true,
523524
'label' => esc_html__( 'If the honeypot flags a submission as spam:', 'gravityforms' ),
524525
'dependency' => array(
@@ -696,6 +697,7 @@ class="gform-alert__cta gform-button gform-button--white gform-button--size-xs"
696697
* Initialize Plugin Settings fields renderer.
697698
*
698699
* @since 2.5
700+
* @since 2.9.8 Updated honeypotAction default to spam.
699701
*/
700702
public static function initialize_settings_renderer() {
701703

@@ -761,7 +763,7 @@ public static function initialize_settings_renderer() {
761763

762764
// Form Options
763765
$form['enableHoneypot'] = (bool) rgar( $values, 'enableHoneypot' );
764-
$form['honeypotAction'] = GFCommon::whitelist( rgar( $values, 'honeypotAction' ), array( 'abort', 'spam' ) );
766+
$form['honeypotAction'] = GFCommon::whitelist( rgar( $values, 'honeypotAction' ), array( 'spam', 'abort' ) );
765767
$form['enableAnimation'] = (bool) rgar( $values, 'enableAnimation' );
766768
$form['markupVersion'] = rgar( $values, 'markupVersion' ) ? 1 : 2;
767769

gravityforms.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Plugin Name: Gravity Forms
44
Plugin URI: https://gravityforms.com
55
Description: Easily create web forms and manage form entries within the WordPress admin.
6-
Version: 2.9.7.1
6+
Version: 2.9.7.2
77
Requires at least: 6.5
88
Requires PHP: 7.4
99
Author: Gravity Forms
@@ -257,7 +257,7 @@ class GFForms {
257257
*
258258
* @var string $version The version number.
259259
*/
260-
public static $version = '2.9.7.1';
260+
public static $version = '2.9.7.2';
261261

262262
/**
263263
* Handles background upgrade tasks.

includes/addon/class-gf-feed-processor.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
<?php
22

3+
use Gravity_Forms\Gravity_Forms\Async\GF_Background_Process;
4+
35
if ( ! class_exists( 'GFForms' ) ) {
46
die();
57
}
68

7-
if ( ! class_exists( 'GF_Background_Process' ) ) {
8-
require_once GF_PLUGIN_DIR_PATH . 'includes/libraries/gf-background-process.php';
9+
if ( ! class_exists( 'Gravity_Forms\Gravity_Forms\Async\GF_Background_Process' ) ) {
10+
require_once GF_PLUGIN_DIR_PATH . 'includes/async/class-gf-background-process.php';
911
}
1012

1113
/**

includes/ajax/class-gf-ajax-handler.php

+7-6
Original file line numberDiff line numberDiff line change
@@ -103,30 +103,31 @@ public function submit_form() {
103103
$style = rgpost( 'gform_style_settings' );
104104
$submission_method = rgpost( 'gform_submission_method' );
105105

106-
$result = \GFAPI::submit_form( $form_id, array(), $field_values, $target_page, $source_page );
106+
require_once \GFCommon::get_base_path() . '/form_display.php';
107+
108+
$result = \GFAPI::submit_form( $form_id, array(), $field_values, $target_page, $source_page, \GFFormDisplay::SUBMISSION_INITIATED_BY_WEBFORM );
107109

108110
if ( is_wp_error( $result ) ) {
109111
wp_send_json_error( $result->get_error_message() );
110112
}
111113

112114
$form = $result['form'];
113115

114-
// Adding validation markup if form failed validation
115-
if ( ! $result['is_valid'] ) {
116-
$result = $this->add_validation_summary( $form, $result );
117-
}
118-
119116
// Adding confirmation markup if there is a confirmation message to be displayed.
120117
if ( rgar( $result, 'confirmation_type' ) == 'message' && ! empty( rgar( $result, 'confirmation_message' ) ) ) {
121118
// Get confirmation markup from get_form(). This is necessary to ensure that confirmation markup is properly formatted.
122119
$result['confirmation_markup'] = \GFFormDisplay::get_form( $form_id, false, false, false, $field_values, false, 0, $theme, $style );
123120
} elseif ( ! $result['is_valid'] ) {
121+
$result = $this->add_validation_summary( $form, $result );
122+
124123
// Refresh the form markup if single page or multipage forms have validation errors.
125124
$result['form_markup'] = \GFFormDisplay::get_form( $form_id, false, false, false, $field_values, false, 0, $theme, $style );
126125
} elseif ( $target_page > 0 ) {
127126
// Getting the target page number taking page conditional logic into account.
128127
$page_number = \GFFormDisplay::get_target_page( $form, $source_page, $field_values );
129128

129+
$result = $this->add_validation_summary( $form, $result );
130+
130131
// Getting the field markup for the target page if the form is a multipage form.
131132
$result['page_markup'] = \GFFormDisplay::get_page( $form_id, $page_number, $field_values, $theme, $style, $submission_method );
132133
}

includes/api.php

+15-21
Original file line numberDiff line numberDiff line change
@@ -1664,22 +1664,18 @@ public static function update_note( $note, $note_id = '' ) {
16641664
* 'resume_token' => string '045f941cc4c04d479556bab1db6d3495'
16651665
*
16661666
* @since Unknown
1667-
* @access public
1668-
*
1669-
* @uses GFAPI::get_form()
1670-
* @uses GFCommon::get_base_path()
1671-
* @uses GFFormDisplay::process_form()
1672-
* @uses GFFormDisplay::replace_save_variables()
1667+
* @since 2.9.9 Added the optional $initiated_by param.
16731668
*
1674-
* @param int $form_id The Form ID
1675-
* @param array $input_values An array of values. Not $_POST, that will be automatically merged with the $input_values.
1676-
* @param array $field_values Optional.
1677-
* @param int $target_page Optional.
1678-
* @param int $source_page Optional.
1669+
* @param int $form_id The Form ID
1670+
* @param array $input_values An array of values. Not $_POST, that will be automatically merged with the $input_values.
1671+
* @param array $field_values Optional. An array of dynamic population parameter keys with their corresponding values used to populate the fields.
1672+
* @param int $target_page Optional. For multi-page forms to indicate which page is to be loaded if the current page passes validation. Default is 0, indicating the last or only page is being submitted.
1673+
* @param int $source_page Optional. For multi-page forms to indicate which page of the form was just submitted. Default is 1.
1674+
* @param null|int $initiated_by Optional. The process that initiated the submission. Supported integers are 1 (aka GFFormDisplay::SUBMISSION_INITIATED_BY_WEBFORM) or 2 (aka GFFormDisplay::SUBMISSION_INITIATED_BY_API). Defaults to GFFormDisplay::SUBMISSION_INITIATED_BY_API.
16791675
*
16801676
* @return array|WP_Error An array containing the result of the submission.
16811677
*/
1682-
public static function submit_form( $form_id, $input_values, $field_values = array(), $target_page = 0, $source_page = 1 ) {
1678+
public static function submit_form( $form_id, $input_values, $field_values = array(), $target_page = 0, $source_page = 1, $initiated_by = null ) {
16831679

16841680
if ( gf_upgrade()->get_submissions_block() ) {
16851681
return new WP_Error( 'submissions_blocked', __( 'Submissions are currently blocked due to an upgrade in progress', 'gravityforms' ) );
@@ -1699,7 +1695,8 @@ public static function submit_form( $form_id, $input_values, $field_values = arr
16991695

17001696
try {
17011697
require_once GFCommon::get_base_path() . '/form_display.php';
1702-
GFFormDisplay::process_form( $form_id, GFFormDisplay::SUBMISSION_INITIATED_BY_API );
1698+
$initiated_by = GFCommon::whitelist( $initiated_by, array( GFFormDisplay::SUBMISSION_INITIATED_BY_API, GFFormDisplay::SUBMISSION_INITIATED_BY_WEBFORM ) );
1699+
GFFormDisplay::process_form( $form_id, $initiated_by );
17031700
} catch ( Exception $ex ) {
17041701
remove_filter( 'gform_suppress_confirmation_redirect', '__return_true' );
17051702
remove_filter( 'gform_pre_validation', array( 'GFAPI', 'submit_form_filter_gform_pre_validation' ), 50 );
@@ -1721,17 +1718,12 @@ public static function submit_form( $form_id, $input_values, $field_values = arr
17211718

17221719
$result = array();
17231720

1724-
$result['is_valid'] = $submission_details['is_valid'];
1725-
1726-
if ( $result['is_valid'] == false ) {
1727-
$result['validation_messages'] = self::get_field_validation_errors( $submission_details['form'] );
1728-
}
1729-
1721+
$result['is_valid'] = $submission_details['is_valid'];
17301722
$result['form'] = $submission_details['form'];
17311723
$result['page_number'] = $submission_details['page_number'];
17321724
$result['source_page_number'] = $submission_details['source_page_number'];
17331725

1734-
if ( $submission_details['is_valid'] ) {
1726+
if ( $result['is_valid'] || rgar( $submission_details, 'abort_with_confirmation' ) ) {
17351727
$confirmation_message = $submission_details['confirmation_message'];
17361728

17371729
if ( is_array( $confirmation_message ) ) {
@@ -1748,7 +1740,9 @@ public static function submit_form( $form_id, $input_values, $field_values = arr
17481740
}
17491741

17501742
$result['entry_id'] = rgars( $submission_details, 'lead/id' );
1751-
$result['is_spam'] = rgars( $submission_details, 'is_spam' );
1743+
$result['is_spam'] = rgar( $submission_details, 'is_spam' );
1744+
} else {
1745+
$result['validation_messages'] = self::get_field_validation_errors( $submission_details['form'] );
17521746
}
17531747

17541748
if ( isset( $submission_details['resume_token'] ) ) {

includes/async/class-gf-background-process-service-provider.php

-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
use Gravity_Forms\Gravity_Forms\GF_Service_Provider;
1212
use Gravity_Forms\Gravity_Forms\Telemetry\GF_Telemetry_Processor;
1313
use GFForms;
14-
use GF_Background_Process;
1514
use GF_Background_Upgrader;
1615
use GF_Feed_Processor;
1716

0 commit comments

Comments
 (0)