zaus / forms-3rdparty-integration

Wordpress Plugin - Forms 3rdparty Integration - a plugin to help integrate 3rdparty services with common WP Forms plugins like Contact Form 7 and Gravity Forms
http://wordpress.org/plugins/forms-3rdparty-integration/
47 stars 14 forks source link

Help with integration GF and LimeDB CRM #1

Closed bajricsanel closed 10 years ago

bajricsanel commented 10 years ago

Hello

First - great plugin. But...I am not so great, I am affraid ;(. PLease, can you help me with integration GF and LimeDB CRM using this plugin.

I really don't know what to do here. LimeDB support is horror! They sent me some kind documentation and some links but I dont get it, becouse I am not so familiar with SOAP and similar functionas.

Any help appreciate!

zaus commented 10 years ago

I think we can start by altering the headers and the post body to send it as XML instead. Looking into it.

zaus commented 10 years ago

First step is to try the branch https://github.com/zaus/forms-3rdparty-integration/tree/soap-headers.

Then add the following hook to your functions.php file (or wherever):

// bypass hook
add_filter('Forms3rdPartyIntegration_service_filter_args', array(&$this, 'limedb_send_soap'), 10, 3);

// the actual hook -- will send a soap request
function limedb_send_soap($args, $service, $form) {
    // if you only want this to occur for a specific service and/or form, filter here and return $args

    $result = array('request' => $args); // preserve the original request for debugging

    try {
        $client = new SoapClient($service['url']);

        // might need further customization to the post body rather than just passing the mapped form post
        $response = $client->ConsumeLead($args['body']);

        // using special hook bypass value
        $result['response_bypass'] =
            // turn response back into expected remote_post format
            array('body' => $response, 'response' => array('code'=>200));

    } catch (Exception $e) {
        $result['response_bypass'] = array(
            'response' => array(
                'code' => 500
                , 'message' => $e->getMessage()
                )
            );
    }

    return $result;
}
zaus commented 10 years ago

And if it wasn't clear from the previous comment, you should hopefully only need to change the line:

$response = $client->ConsumeLead($args['body']);
bajricsanel commented 10 years ago

Hello

I am really sorry but now i am totally confused. And lost.

Dana subota, 14. prosinca 2013., korisnik zausnotifications@github.com je napisao:

And if it wasn't clear from the previous comment, you should hopefully only need to change the line:

$response = $client->ConsumeLead($args['body']);

— Reply to this email directly or view it on GitHub.

zaus commented 10 years ago

The branch is now live, btw.

You'll need to: 1) update the plugin 2) write a hook to take advantage of the new ability to transform the post body and bypass the original form-post 3) the hook will instead generate a SOAP request, which you'll need to format per the LimeDB specs 4) since you're now performing the "post" in the hook, the hook will return the special array (response_bypass) that tells my plugin to skip sending the form post as usual

zaus commented 10 years ago

We can follow up on LimeDB specifics via email.

zaus commented 9 years ago

To make this easier there's the Forms 3rdparty Xpost plugin mentioned here https://github.com/zaus/forms-3rdparty-integration#how-do-i-send-xmlsubmit-to-soap