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.

Need more information on gform_post_submission and $form

  1. Hi.
    I can't find any documentation on the $form element.
    I would like to see some examples on how to use this within a gform_post_submission hook function..

    is there any further documentation on using gforms in your functions.php file?

    Posted 14 years ago on Friday November 19, 2010 | Permalink
  2. Expanded developer documentation and an all new documentation area will launch once we are done with the extensive changes we are making.

    Here is an example of the gform_post_submission hook to change the post content, adding values from submitted fields, including an image field. This is an example of using the form object with the gform_post_submission hook.

    <?php
    add_action("gform_post_submission", "set_post_content", 10, 2);
    function set_post_content($entry, $form){
    
    //getting post
    $post = get_post($entry["post_id"]);
    
    //changing post content
    $post->post_content = "Blender Version:" . $entry[7] . "<br/> <img src='" . $entry[8] . "'> <br/> <br/> " . $entry[13] . " <br/> <img src='" . $entry[5] . "'>";
    
    //updating post
    wp_update_post($post);
    }
    ?>

    Here is documentation on the form object:

    http://s3.amazonaws.com/gravityforms/documentation/gform_form_object.pdf

    Here is documentation on the gform_post_submission hook:

    http://s3.amazonaws.com/gravityforms/documentation/gform_post_submission.pdf

    Posted 14 years ago on Friday November 19, 2010 | Permalink