Created
January 24, 2015 19:05
-
-
Save logoscreative/fd1eaa1e4521a5293164 to your computer and use it in GitHub Desktop.
Hook Gravity Forms Submission Into Events Calendar Pro
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 Events Form Work Redux */ | |
add_filter("gform_post_data", "mb_set_post_date", 10, 3); | |
function mb_set_post_date($post_data, $form, $entry){ | |
if($form["id"] != 48) | |
return $post_data; | |
$startdate = $entry["69"]; | |
$starttime = $entry["5"]; | |
$enddate = $entry["70"]; | |
$endtime = $entry["7"]; | |
$post_data["post_custom_fields"]["_EventStartDate"] = $startdate . ' ' . $starttime; | |
$post_data["post_custom_fields"]["_EventEndDate"] = $enddate . ' ' . $endtime; | |
if ( $entry["73"] ) { | |
$post_data["post_custom_fields"]["_EventVenueID"] = $entry["73"]; | |
} | |
if ( $entry["77"] ) { | |
$post_data["post_custom_fields"]["_EventOrganizerID"] = $entry["77"]; | |
} | |
return $post_data; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment