Thread Starter
BigRJD
(@bigrjd)
I have figured it out, I am using the below code.
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'] = $body; // <---- this
}
}
new MyPlugin(); // attach hook
It would be nice however to be able to create a URL redirect at this point and including in that the paramaters of $body.
Any suggestion on how to proceed?
Plugin Author
zaus
(@zaus)
It depends on which form plugin you’re using. I’ve done something with CF7 for a client, but it involved saving the URL returned in the $body to a class variable and then using that in another hook on Forms3rdPartyIntegration_remote_success to inject it into CF7’s ‘additional_settings’ as a javascript redirect, something like:
private function attach($cf7) {
$addl = $cf7->prop(‘additional_settings’);
$addl .= “\non_sent_ok: \”location = ‘{$this->url}’\””;
$cf7->set_properties(array(‘additional_settings’=>$addl));
}
I haven’t tried it, but you might be able to just insert a javascript redirect directly into $body like $body .= "<script>location = $url</script>".