custom post to expire automatically at date and time field from Gravity form ?
-
Hi All,
Here the situation,
On my website user can create some custom post type (Events) automatically via Gravity Form.
The Fields include a Date to and Time To.I would like the post to expire automatically on the day and date that the user has enter in Gravity Form.
I’ve found the plugin Post Expirator, which allow to do this manually, but I want his to be dynamic from the field value of Gravity Form.
So Far I’ve found this script:
// update the "1" to the ID of your form add_filter("gform_pre_submission_1", "populate_timedelete"); function populate_timedelete($form){ $dropdown_value = rgpost('input_23'); // update the "4" to the ID of your drop down field $exp_field_id = 43; // update the "6" to the ID of your expiration custom field $exp_time = time(); // set the default expiration if($dropdown_value == '3') { // update this to the "value" property of the first drop down option $exp_time = time()+(60*5); } $_POST["input_$exp_field_id"] = $exp_time; }
But It does’/t seem to work . . . .
Does anybody would have any solution for this ??
Thanks a lot !!!
- The topic ‘custom post to expire automatically at date and time field from Gravity form ?’ is closed to new replies.