Skip to content

Commit 350ba71

Browse files
author
hCaptcha GHA
committed
Remove hCaptcha internal fields from Avada from submission.
1 parent 4b9e6a9 commit 350ba71

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

readme.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -629,6 +629,7 @@ Instructions for popular native integrations are below:
629629

630630
= 4.11.0 =
631631
* Fixed processing wpDiscuz comment form with wpDiscuz custom ajax.
632+
* Fixed adding hCaptcha internal fields to Avada from submission.
632633

633634
= 4.10.0 =
634635
* Added support for wp_login_form() function and LoginOut block.

src/php/Avada/Form.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ public function __construct() {
3535
*/
3636
public function init_hooks(): void {
3737
add_action( 'fusion_form_after_open', [ $this, 'form_after_open' ], 10, 2 );
38+
add_filter( 'fusion_builder_form_submission_data', [ $this, 'submission_data' ] );
3839
add_action( 'fusion_element_button_content', [ $this, 'add_hcaptcha' ], 10, 2 );
3940
add_filter( 'fusion_form_demo_mode', [ $this, 'verify' ] );
4041
}
@@ -52,6 +53,21 @@ public function form_after_open( array $args, array $params ): void {
5253
$this->form_id = isset( $params['id'] ) ? (int) $params['id'] : 0;
5354
}
5455

56+
/**
57+
* Filter submission data.
58+
*
59+
* @param array|mixed $data Submission data.
60+
*
61+
* @return array
62+
*/
63+
public function submission_data( $data ): array {
64+
$data = (array) $data;
65+
66+
unset( $data['data']['hcaptcha-widget-id'], $data['data']['h-captcha-response'], $data['data']['g-recaptcha-response'] );
67+
68+
return $data;
69+
}
70+
5571
/**
5672
* Filters the Avada Form button and adds hcaptcha.
5773
*

0 commit comments

Comments
 (0)