Plugin Author
zaus
(@zaus)
Have you tried the suggestion under “How do I show a custom message on the confirmation screen?” on https://wordpress.org/plugins/forms-3rdparty-integration/faq/?
I’m having the same issue – i’ve seen many threads started on this.
when i post to a service, i can see the response in the debug email, yet I want the response to be what the end user sees. I’ve seen ways to make a custom confirmation message, yet i want the response to be the actual body output of the service response
Also – i’m online now and can actively work with you to figure out a hook for this
posisbly something to do with gform_confirmation
possibly a way to return $response from the service?
Plugin Author
zaus
(@zaus)
As I said, have you tried what I wrote in the faq?
How do I show a custom message on the confirmation screen?
The failure message is shown by default if the 3rdparty post did not succeed. You can add custom messaging to the plugin’s (GF, CF7, Ninja) email or success screen response with something like:
class MyPlugin {
public function MyPlugin() {
add_filter('Forms3rdPartyIntegration_service', array(&$this, 'adjust_response'), 10, 2);
}
public function adjust_response($body, $refs) {
// use 'attach' to inject to regular email
// use 'message' to inject to page
$refs['attach'] = 'custom message in email';
$refs['message'] = 'custom message on page'; // <---- this
}
}
new MyPlugin(); // attach hook
You have access to the response $body in the hook.
Maybe I need to word it differently –
Can the body of the response become the body the browser becomes?
For example, I have a form that starts a free trial of an application, when you fill out the form it automatically logs you in (user goes from submitting form on sitea, to being logged in on siteb). If I post directly as action=”xyz.com/activate/” it performs this action properly, yet i lose the benefits of gravity.
What if the $body of the response saved to an object buffer?
then the object buffer could create a temporary html file
once html file is created by the object buffer, <?php header(tempobjectbufferdump.html) ?> within the custom confirmation? header or __top there has to be some way to achieve this
Plugin Author
zaus
(@zaus)
Ohhh…I get it, sorry; like a redirect.
I’m not entirely sure, as php doesn’t really have a way to clear the output buffer unless you’ve already started it (http://php.net/manual/en/function.ob-end-clean.php), but depending on when wp actually writes the page compared to when the hooks run, you might be able to just echo the service response and tell php to exit. You might need to save the response to a temp variable and do the writing/exit in a later hook to give GF a chance to finish its processing.
But that might not even work for your purposes if you need the associated cookies and stuff.