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.

Form Date Field = Publish Date

  1. I have a submission form for an announcement, the user puts all the information in and then selects a date for the announcement to be posted on. The form auto creates a post in pending review format. I want the date the user enters to be the date that will show up in the publish date (or schedule date, since it will be in the future.)

    Can someone please explain how to do this? I have tried this, but I am not completely sure where to put this code and what function to add to it...

    <?php
           add_action("gform_post_submission", "post_submission", 10, 2);
    ?>

    I am new to gravity forms and wordpress. Please help.

    Posted 13 years ago on Friday August 17, 2012 | Permalink
  2. Sure. Take a look at this code. This will be added to your theme's functions.php.

    http://pastebin.com/rAPQzqt0

    On line 5, change the 64 to your form ID (the form which is creating the pending posts.) On line 19, change the "18" to the field where you are capturing the date input from the user. You can hover over the form field in the form builder and get the ID. That's what you need here instead of 18.

    That should set the publish date on the newly created (pending) post to the date that was entered by the visitor. If you have any questions, please post them here.

    Posted 13 years ago on Monday August 20, 2012 | Permalink
  3. Thank you for your help, it works wonderfully.

    Posted 13 years ago on Tuesday August 21, 2012 | Permalink

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