Created
April 4, 2019 19:13
-
-
Save hirejordansmith/8f68ed61b76acb6b5ed87b3d30501c2b to your computer and use it in GitHub Desktop.
Gravity Forms // gform_pre_submission filter based on field CSS class
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_action( 'gform_pre_submission', 'pre_submission_handler_one' ); | |
function pre_submission_handler_one( $form ) { | |
foreach ( $form['fields'] as $field ) { | |
$cssClass = $field->cssClass; | |
if ( strpos($cssClass, 'test') !== false) { | |
$field_id = $field->id; | |
$date = new DateTime( 'now' ); | |
$_POST["input_$field_id"] = $date->format('U'); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment