Created
April 1, 2012 17:20
-
-
Save norcross/2277175 to your computer and use it in GitHub Desktop.
Convert date entry to UNIX timestamp
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
// Make two admin-only fields (as text fields) | |
// and post to the custom fields from Gravity Forms | |
// instead of the "real" date picker. | |
// NOTE: change the input IDs to match the ones on your form | |
function rkv_datesubmit_fix ($form){ | |
//event start date field id is 3 | |
//event end date field ID is 4 | |
$raw_srt = $_POST['input_3']; | |
$raw_end = $_POST['input_4']; | |
// convert my dates | |
$fix_srt = strtotime($raw_srt); | |
$fix_end = strtotime($raw_end); | |
//admin start date field ID is 35 | |
//admin end date field ID is 36 | |
$_POST['input_35'] = $fix_srt; | |
$_POST['input_36'] = $fix_end; | |
} | |
add_action('gform_pre_submission', 'rkv_datesubmit_fix'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment