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.

Passing data between forms

  1. snails007
    Member

    I'm not sure if this is possible...

    I currently have a 'submit project' form where a user posts a project as a custom post type ('project').
    In my single-project.php page it then displays the single project that has been posted. I have then embedded a 'submit bid' form (custom post type of 'bid') in this page beneath the project.
    Once a bid is submitted I then display all of the bids beneath the project.

    I then want the author of the project to be able to select one of the bids as 'chosen'.
    For this I have then set up a third form ('choose bid') that is embedded within the loop that displays the bids. So the 'choose bid' form is displayed once on every bid and has a radio button to select the bid.
    Once chosen and submitted, I then populate this 'choose bid' form with all of the data from both the original 'project' and the chosen 'bid' so that this information is all stored in the database as a new post type called 'project-won'.
    So this new 'project-won' post is complete with the project info (author, content, title) and the winning bid info (bid amount, bid proposal, bid author).

    So after all of that, my question is:
    Is there any way to somehow link back to the original 'project' form and possibly change the status to a draft or manipulate the form in any other way.

    I think it's a long shot but thought I'd ask :)

    Posted 12 years ago on Friday May 4, 2012 | Permalink
  2. snails007
    Member

    This did the trick for anyone else looking for this...

    add_action("gform_after_submission", "set_post_content", 10, 2);
    function set_post_content($form){
    
    	//only for form id
        if($form["id"] == 3)
           return $form;
    
        //getting post
        $post = get_post($proj_id);
    
        //changing post content
        $post->post_status  = "pending";
    
        //updating post
        wp_update_post($post);
    }
    Posted 12 years ago on Friday May 4, 2012 | Permalink
  3. David Peralty

    Wow, that's some serious customization. Great stuff. I'd love to see it all running when its done.

    Posted 12 years ago on Friday May 4, 2012 | Permalink