• I am following the various samples I can find, and I have built my own hook into Forms3rdPartyIntegration_service, but I am unsure how to use this action to get the response into a variable I can use in the on_sent_ok of CF7.

    I am trying to integrate with Hatchbuck, which returns a bit of JavaScript on form submit (window.location.href=’a custom 1 time url’).

    I need to parse the URL / ID from the response in my filter and then write it out in the on_sent_ok.

    Any ideas?

    class MyPlugin {
    public function MyPlugin() {
    // note that you’ll want to hook to the right service; this hooks to all
    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; // Even if this was the body, how would i get this into on_sent_ok???
    }
    }

    new MyPlugin(); // engage!

    https://www.ads-software.com/plugins/forms-3rdparty-integration/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter ProVega

    (@provega)

    A quick update, I changed the function to be an add_action and I am able to write out the message as a string. What I can’t do is execute / evaluate the message property in the AJAX callback in on_sent_ok. I know this is more of a CF7 question, but perhaps someone knows of a better way to override the on_sent_ok?

    Plugin Author zaus

    (@zaus)

    I’ve had problems before trying to inject stuff programmatically (ie via hooks) to onsentok, I don’t think there’s a way to do it (could be wrong, maybe he added one since I last looked). If you’re just looking to redirect, you might be able to insert html (ie script tags) into the $refs[‘message’] instead, I don’t remember if it sanitizes.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Forms3rdPartyIntegration_service CF7 Ajax’ is closed to new replies.