Can Gravity forms post using any of these methods? HTTP POST, HTTP GET or XML?
Can Gravity forms post using any of these methods? HTTP POST, HTTP GET or XML?
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.
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.
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.
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.
Just to be clear, I have double-checked that the form_id is 4 for the form that I'm working with.
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.
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
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"?
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.
Is there any update on this David?
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.
Can you send your form XML and functions.php file to peralty@rocketgenius.com please?
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?
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.
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?
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!
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) {'
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) {'
I have tried exactly that name before asking and it didn't work BUT now it is working.
Thank you
You're welcome.