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.

Please can you give me some example code for post submission hook usage

  1. lukebream
    Member

    Hi

    Im building a form to edit post meta data. I'm presuming the setup will be as follows.

    1) Pass the postID to a hidden field via the URL on which the form is located

    2. Prepopulate the form fields with the existing post-meta fields. (I have this setup already so no questions about this)

    3. On form submit use the post submission hook to call a "example-processing.php" file where I handle the relevant database entriees to add the details tto the wp_postmeta table

    //////////////

    So if the above is correct I have the following questions:

    1. Can you provide a brief code example for how to use the post submission hook in these circumstances

    2. Can you provide a brief code example for how to reference the data inside my "example-processing.php" file. I have no problem with the subsequent database entries once I have the variables declared in this file.

    Thanks as always for your help

    Luke

    Posted 12 years ago on Thursday May 12, 2011 | Permalink
  2. lukebream
    Member

    Hi
    I just wanted to say I have solved this issue and have everything working correctly.

    For others who have a similar issue the code I used is as follows:

    //Process the edit-submitted-post gravity form entries..
    add_action("gform_post_submission_3", "form_update_post_meta", 10, 2);
    function form_update_post_meta($entry,$form){
    $targetPost = $_GET['postID'];
    global $wpdb;
    $screen1title = $entry["3"];
    $wpdb->query("UPDATE $wpdb->postmeta SET meta_value= '$screen1title' WHERE post_id=$targetPost AND meta_key='slide_1_title'");
    }
    Posted 12 years ago on Friday May 13, 2011 | Permalink

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