PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Can this be done?

  1. I need a form that accepts a few input fields and then on submit, injects those field values into an existing WordPress page, including the page title, tag line and any custom fields within the page body. Can this be done without requiring third party custom development?

    Thanks

    Posted 10 years ago on Friday May 10, 2013 | Permalink
  2. No customization required. These are features of Gravity Forms.

    To include a custom field in your Page, you will need to use the content template for the post body, or you can modify your Page template to include them there.

    All you asked about can be accomplish with Gravity Forms.

    Posted 10 years ago on Monday May 13, 2013 | Permalink
  3. Samantha
    Member

    Hello,

    I just discovered this brilliant feature for post body. Is there an easy way to also have a content template for the excerpt as well? Thank you.

    Posted 10 years ago on Friday May 31, 2013 | Permalink
  4. The content template is not available for the post excerpt. You would have to create your own excerpt after the form is submitted, then store that custom excerpt using the gform_after_submission hook, or gform_post_data filte.

    http://www.gravityhelp.com/documentation/page/Gform_after_submission
    http://www.gravityhelp.com/documentation/page/Gform_post_data

    Posted 10 years ago on Monday June 3, 2013 | Permalink
  5. Samantha
    Member

    Thank you.
    I would like to format the Date from mm/dd/yyyy to June 3, 2013. How do I change the code from here:

    01	<?php
    02	add_filter("gform_post_data", "set_post_date", 10, 3);
    03	function set_post_date($post_data, $form, $entry){
    04	  //only do this when the form id is 23
    05	  if($form["id"] != 23)
    06	    return $post_data;
    07
    08	  //set post date to field on form if date provided; get from entry data
    09	  //using a date field in mm/dd/yyyy format and a time field in 24 hour format
    10	  $date_value = $entry["6"]; //pull the date value from the form data posted, field 6 on my form
    11	  $time = $entry["7"]; //pull the time value from the form data posted, field 7 on my form
    12	  //only change post date/time when a date has been chosen
    13	  if (!empty($date_value))
    14	  {
    15	    if (empty($time))
    16	    {
    17	      //set default time
    18	      $time_value = "00:00:00";
    19	    }
    20	    else
    21	    {
    22	      empty($time[0]) ? $time_hours = "00" : $time_hours = $time[0]; //pull hours out of array
    23	      empty($time[1]) ? $time_minutes = "00" : $time_minutes = $time[1]; //pull minutes out of array
    24	      $time_value = $time_hours . ":" . $time_minutes . ":00"; //add on seconds
    25	    }
    26	    //convert post date to the appropriate format so it will be inserted into the database
    27	    $post_date = date("Y-m-d H:i:s",strtotime($date_value . " " . $time_value));
    28	    $post_data["post_date"] = $post_date; //set the post_date
    29	  }
    30	  return $post_data; //return the changed data to use when the post is created
    31	}
    32	?>
    Posted 10 years ago on Monday June 3, 2013 | Permalink
  6. Samantha
    Member

    P.S. I removed the time. It is published to Pending Review. However, the post date is not replace default date. Please advise. Thank you.

    Code:

    add_filter("gform_post_data", "set_post_date", 10, 3);
    function set_post_date($post_data, $form, $entry){
      //only do this when the form id is 2
      if($form["id"] != 2)
        return $post_data;
    
      //set post date to field on form if date provided; get from entry data
      //using a date field in mm/dd/yyyy format and a time field in 24 hour format
      $date_value = $entry["9"]; //pull the date value from the form data posted, field 9 on my form
      //$time = $entry["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))
      {
            //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
    }
    Posted 10 years ago on Monday June 3, 2013 | Permalink
  7. We don't offer any support in our pre-purchase forum. If you're a Gravity Forms license holder, please use our regular support forums and post a new topic there. We'll be happy to help you if we can.

    http://www.gravityhelp.com/forums/forum/gravity-forms#postform

    Posted 10 years ago on Tuesday June 4, 2013 | Permalink

This topic has been resolved and has been closed to new replies.