I would like to have the date field determine the publish date of the new post. Is this possible?
I would like to have the date field determine the publish date of the new post. Is this possible?
Currently this isn't possible. We will add it to our feature ideas list and could potentially add it as a feature in a future release.
Thanks Carl. This would be a boon for a site I am working on. User submitted posts with a scheduled publish date. Wordpress can then show upcoming posts in order of the date entered by the user (event date). Perfect for upcoming events.
Is this possible yet? I really need to be able to do this.
Can this be done with http://www.gravityhelp.com/documentation/page/Entry_Object? Using "$entry["date_created"];"? If so, can I get some example code? I'm not 100% sure how to do this.
Bump... Anyone?
Bump. Can someone please help.
I've been trying to get support everyday since Monday. This is pathetic. I wouldn't have paid for this service if I would have known it would be this hard to do such easy things...
Can someone please help.
bump...
Hi, bluetidepro,
We are sorry about the delay in responding as we have been working on Priority Support requests. We normally respond sooner than this. If you want to set what the publish date will be on the post you can do something similar to below. This code sets the post date/time based on fields on the form. In my example I have set a future date so the post winds up being "Scheduled" with the date/time chosen on the form as the "Scheduled for" date. Let me know if you have questions about the code.
add_filter("gform_post_data", "set_post_date", 10, 2);
function set_post_date($post_data, $form){
//only do this when the form id is 23
if($form["id"] != 23)
return $post_data;
//set post date to field on form if date provided; get from POSTed data
//using a date field in mm/dd/yyyy format and a time field in 24 hour format
$date_value = rgpost("input_6"); //pull the date value from the form data posted, field 6 on my form
$time = rgpost("input_7"); //pull the time value from the form data posted, field 7 on my form
//only change post date/time when a date has been chosen
if (!empty($date_value))
{
if (empty($time))
{
//set default time
$time_value = "00:00:00";
}
else
{
empty($time[0]) ? $time_hours = "00" : $time_hours = $time[0]; //pull hours out of array
empty($time[1]) ? $time_minutes = "00" : $time_minutes = $time[1]; //pull minutes out of array
$time_value = $time_hours . ":" . $time_minutes . ":00"; //add on seconds
}
//convert post date to the appropriate format so it will be inserted into the database
$post_date = date("Y-m-d H:i:s",strtotime($date_value . " " . $time_value));
$post_data["post_date"] = $post_date; //set the post_date
}
return $post_data; //return the changed data to use when the post is created
}