Created
June 28, 2021 20:32
-
-
Save davecurrierseo/c656eca51207afaea4cab6b1baf86620 to your computer and use it in GitHub Desktop.
Gravity-Forms
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'gform_zapier_field_value', 'change_field_value_consent', 10, 4 ); | |
function change_field_value_consent( $value, $form_id, $field_id, $entry ) { | |
// apply to form ID 74 and consent field 2 in that form | |
if ( $form_id == '74' && $field_id == '2' ) { | |
// the checkbox is part .1 of the field | |
if ( rgar ( $entry, '2.1' ) == 1 ) { | |
$value['2.1'] = 'true'; | |
} | |
else { | |
$value['2.1'] = 'false'; | |
} | |
} | |
// return the value either way | |
return $value; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment