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.

User submitted form

  1. I am creating a website that will allow users to upload 3D models to the site. What I'm wondering is it possible for GF to auto populate a post so it will look like this sample:
    http://www.designerpluseditor.com/blend/scenes/lighting-setup/

    So they would fill out model name, model description, file size, version, two pictures, and the the model would be linked to a predefined download button.

    I've try to contact GF and ask them these questions but have not received any replies, hopefully someone on here can help.
    Thanks

    Posted 15 years ago on Tuesday December 1, 2009 | Permalink
  2. mofx,
    You can populate a post to look like the sample above by using one of GF's hooks and a few lines of PHP. We have users that are doing similar things to what you are trying to accomplish. I will be happy to give you a code snippet to get you started.

    Posted 15 years ago on Tuesday December 1, 2009 | Permalink
  3. There was a very similar request just last week you might want to look at. We came up with a solution using just the standard post fields and the default Gallery shortcode function.

    http://forum.gravityhelp.com/topic/using-form-to-submit-blog-data

    Posted 15 years ago on Tuesday December 1, 2009 | Permalink
  4. Cool thanks guys, I'm sure I will need some help setting it up. But at least I know that GF will do it. Will go purchase it now. Thanks again.

    Posted 15 years ago on Wednesday December 2, 2009 | Permalink
  5. Purchased GF, trying to work through making the from now. Alex if you have any advice that would be sweet, considering I'm kind of code illiterate. I got the standard form laid out, got it somewhat working, pretty much the post title, post description, and category work. That's about it. Any help would be greatly appreciated. Kevin I also tried to add the gallery PHP into my single.php page, and could get it to work, will it work with only one image? Thanks again guys.

    Posted 15 years ago on Wednesday December 2, 2009 | Permalink
  6. The idea is to manually create the post content from different form fields using a hook and PHP code. Following is something to get you started. Copy it to your theme's function.php and replace XXX, YYY and ZZZ with the fields you would like the post content to be populated with.

    add_filter("gform_post_data", "create_post_content", 10, 2);
    function create_post_content($post_data, $form){
       //Replace XXX, YYY and ZZZ with your actual  input name.
      //View the HTML source to find it (i.e name="input_3").
        $post_data["post_content"] = $_POST["input_XXX"] . "<br />" . $_POST["input_YYY"] . "<br />" . $_POST["input_ZZZ"];
        return $post_data;
    }
    Posted 15 years ago on Wednesday December 2, 2009 | Permalink
  7. Alex thanks man, now how would I add the label name to the label input?
    So it would look like

    Model Description:
    Blah Blah Blah.

    Also is there a way to format the stuff your pulling from the form.
    Would love if my pages would look like this when there done.
    http://www.blendswap.com/scenes/5-light-setup/
    I also can't get the images to load into my posts, I tried to do what Kevin said here
    http://forum.gravityhelp.com/topic/using-form-to-submit-blog-data
    but it wouldn't work for me any thoughts? Thanks guys, great product.

    Posted 15 years ago on Friday December 4, 2009 | Permalink
  8. mofx,
    I think it would be helpful if you add a link to your form, so that I can see what kind of information you want to add to the post.
    As far as adding, the labels, you will have to do them manually in the PHP code.
    i.e.

    $post_data["post_content"] = "Model Description:</br>" . $_POST["input_XXX"] . "<br />Another Label: <br />" . $_POST["input_YYY"];
    Posted 15 years ago on Friday December 4, 2009 | Permalink
  9. That probably would make sense where's the form:
    http://www.blendswap.com/upload-models/

    Posted 15 years ago on Friday December 4, 2009 | Permalink
  10. mofx,
    You will have to change the markup to what you need, but I think the following code will get you started. Place it in your theme's funciton.php file:

    add_filter("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);
    }

    The $entry[x] calls are the ones getting your field values. You can read any field from the form this way. To get a field's id, just look at the input name. It will look something like name="input_5". In this case the id is 5.

    Good Luck.

    Posted 15 years ago on Sunday December 6, 2009 | Permalink
  11. Alex Thanks for all your help man we are so close, I'm giddy with excitement. I'm still running into a couple problems, hopefully you can help me with, then I 'll be out of your hair.
    On the image upload. After the form is submitted and I'm in the WP post, the image shows as a broken icon. If I click on the icon and go into edit image in WP, then click over to the advanced settings tab. This is what is being added to the end of the source link |:|1050771242840315|:||:| if I remove this the image shows up just fine. Any Ideas?

    Posted 15 years ago on Sunday December 6, 2009 | Permalink
  12. mofx,
    Are your fields "Post Image" fields, or "File upload" fields? My code snippettttt assumes you are using "File upload" fields.

    Posted 15 years ago on Sunday December 6, 2009 | Permalink
  13. One is post Image and one is file upload.

    Posted 15 years ago on Sunday December 6, 2009 | Permalink