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.

Can Gravity Forms Post?

  1. Can Gravity forms post using any of these methods? HTTP POST, HTTP GET or XML?

    Posted 7 years ago on Tuesday May 15, 2012 | Permalink
  2. David Peralty
    Administrator

    Can you give me more information on what you are trying to accomplish? You can push data to pages using these methods, but it requires customization.

    Posted 7 years ago on Tuesday May 15, 2012 | Permalink
  3. David,

    We are using a service called leads360 and they allow us to import information into our database by using one of these methods. I believe the way that it works is when someone fills out a contact form, it would go to a URL like this https://secure.leads360.com/Import.aspx?Provider=someprovidername&Client=someclient&CampaignId=25&URL=http://www.domainname.com/index.xxx, where the parameters would be the fields of the form.

    I know that gravity forms already does this by passing field data via query string, but I didn't know if it used HTTP POST, HTTP GET or XML to do this.

    Posted 7 years ago on Tuesday May 15, 2012 | Permalink
  4. David Peralty
    Administrator

    I think this is what you are looking for:
    http://www.gravityhelp.com/documentation/page/Gform_after_submission

    Check out the second example on that page.

    Posted 7 years ago on Tuesday May 15, 2012 | Permalink
  5. I'm frustrated.

    I followed the instructions on the link above but cannot get the hook to fire.

    for example this does not work:

    //handle submission
     $confirmation = self::handle_submission($form, $lead, $ajax);
     add_action("gform_after_submission_4", "post_to_third_party", 10, 2);
     function post_to_third_party($entry, $form){ die; }

    And when I mean "does not work, I mean it doesn't die where I expect it to. :)

    Am I calling the hook in the wrong place? I'm stumped.

    Posted 7 years ago on Wednesday May 23, 2012 | Permalink
  6. Just to be clear, I have double-checked that the form_id is 4 for the form that I'm working with.

    Posted 7 years ago on Wednesday May 23, 2012 | Permalink
  7. Ok, so I got it working and here's the thing.

    Gravity Forms assumes in the post linked above that you understand where the code they give you should go. I didn't. After a lot of Googling I figured out that your hook and function should go in your theme's functions.php file. Mine is at /var/www/<website>/htdocs/wp-content/themes/<mytheme>/functions.php yours will be in a similar path.

    This may be obvious to the seasoned Wordpress developer, but it wasn't to me because I'm not a Wordpress developer. My understanding is that you should keep your modifications here so that you don't modify core functionality of the plugin and so that you can easily locate any changes you make. Good idea.

    The other thing that I found is that "gform_after_submission" did not work for me. I couldn't make that code fire whether I was making it die, or trying to write to a logfile. I changed the hook to "gform_post_submission" and it worked right away.

    Ten minutes later I was moving my code to production.

    Posted 7 years ago on Thursday May 24, 2012 | Permalink
  8. David Peralty
    Administrator

    Glad to hear you figured it out. Here's a link for others looking at this thread in the future:
    http://www.gravityhelp.com/documentation/page/Where_Do_I_Put_This_Code%3F

    Posted 7 years ago on Thursday May 24, 2012 | Permalink
  9. Thanks David.

    But what about the "gform_after_submission" vs "gform_post_submission" issue? Has "gform_after_submission" been deprecated in favor of "gform_post_submission"?

    Posted 7 years ago on Thursday May 24, 2012 | Permalink
  10. David Peralty
    Administrator

    No, it hasn't been deprecated. I'm going to check into it with the developers on why you received a different result using one hook over the other.

    Posted 7 years ago on Thursday May 24, 2012 | Permalink
  11. Is there any update on this David?

    Posted 7 years ago on Friday June 22, 2012 | Permalink
  12. David Peralty
    Administrator

    They weren't able to replicate your issue.

    The after_submission is the hook that the developers are working on and post_submission is what they hope to deprecate at some point (in the long future, once they've figured out how to transition people).

    I will revisit the issue with them and see if we can get any more details on it.

    Posted 7 years ago on Friday June 22, 2012 | Permalink
  13. David Peralty
    Administrator

    Can you send your form XML and functions.php file to peralty@rocketgenius.com please?

    Posted 7 years ago on Friday June 22, 2012 | Permalink
  14. alingliga
    Member

    I'm trying to link leads360 with GravityForms but I don't really know how to do this.

    $body = array(
            'first_name' => $entry['1.3'],
            'last_name' => $entry['1.6'],
            'message' => $entry['3']
            );

    What data should be put in place of 'first_name', etc?

    Posted 7 years ago on Friday January 11, 2013 | Permalink
  15. first_name, last_name and message are the parameters required by wherever you are sending your WP_Http request. The actual names will come from leads360. It's your job to send them the data in the format they require.

    Posted 7 years ago on Friday January 11, 2013 | Permalink
  16. alingliga
    Member

    Thank you Chris Hajer for your support, it is working now.

    One more question: Why I get a HTTP Error 500 on the website if I add one more after submission hook for a different form?

    Posted 7 years ago on Tuesday January 29, 2013 | Permalink
  17. David Peralty
    Administrator

    It would depend on what and how you are doing it. Are you naming your functions the same or different? I would have to see exactly what you have before I could answer that question. All my best!

    Posted 7 years ago on Tuesday January 29, 2013 | Permalink
  18. alingliga
    Member

    I think the function's name is the problem.

    The first function starts with:
    'add_action('gform_after_submission_3', 'post_to_third_party', 10, 2);
    function post_to_third_party($entry, $form) {'

    and the second one:
    'add_action('gform_after_submission_2', 'post_to_third_party', 10, 2);
    function post_to_third_party($entry, $form) {'

    Posted 7 years ago on Tuesday January 29, 2013 | Permalink
  19. Rename the "post_to_third_party" function to something else, then change the action line to call the new function. You can't have two functions with the same name.

    Or, if the function is reusable, don't add the function in a second time; just call the one function from two separate add_action lines, once for each form. If the function is the same in both places, that will work fine. If the function is different in both places, you have to rename one of the instances.

    This could be your second code block:

    [php]
    'add_action('gform_after_submission_2', 'post_to_third_party_two', 10, 2);
    function post_to_third_party_two($entry, $form) {'
    Posted 7 years ago on Tuesday January 29, 2013 | Permalink
  20. alingliga
    Member

    I have tried exactly that name before asking and it didn't work BUT now it is working.
    Thank you

    Posted 7 years ago on Wednesday January 30, 2013 | Permalink
  21. You're welcome.

    Posted 7 years ago on Wednesday January 30, 2013 | Permalink

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