Skip to content

Commit

Permalink
Fix bug with changing shortcode args.
Browse files Browse the repository at this point in the history
  • Loading branch information
kagg-design committed Jan 25, 2025
1 parent 5868e5d commit 6202f01
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
13 changes: 9 additions & 4 deletions src/php/AutoVerify/AutoVerify.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ public function verify(): void {

$action = $registered_form['args']['action'] ?? '';
$name = $registered_form['args']['name'] ?? '';

$result = hcaptcha_verify_post( $name, $action );

if ( null !== $result ) {
Expand Down Expand Up @@ -297,9 +296,15 @@ protected function update_transient( array $forms_data ): void {
$args = $data['args'];
$auto = $args['auto'];

$key = isset( $registered_forms[ $action ] )
? array_search( $inputs, array_column( $registered_forms[ $action ], 'inputs' ), true )
: false;
$key = false;
$action_forms = $registered_forms[ $action ] ?? [];

foreach ( $action_forms as $index => $action_form ) {
if ( $inputs === $action_form['inputs'] ) {
$key = $index;
break;
}
}

$registered = false !== $key;

Expand Down
4 changes: 2 additions & 2 deletions src/php/GravityForms/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -373,8 +373,8 @@ private function should_verify(): bool {
return true;
}

if ( $this->mode_embed && $this->has_hcaptcha( $form_id ) ) {
// In embed mode, verify only a form having hCaptcha field.
if ( $this->has_hcaptcha( $form_id ) ) {
// Verify only a form having hCaptcha field.
return true;
}

Expand Down

0 comments on commit 6202f01

Please sign in to comment.