1

Alright, so this server I'm working on is running Drupal 6 and I need to send form data to Pardot upon user registration. I followed the answer on This Question, while adjusting http_build_query to fit its Drupal 6 parameters.

I get nothing on the Pardot end of things, and I'm honestly pretty stumped.

My .module file reads as such:

    /**
    * @file
    * A module which posts registration information to Pardot
    */

    function pardot_post_form_alter(&$form, &$form_state, &$form_id) {
        if ($form_id == 'user_register_form') {
            $form['#submit'][] = 'send_to_pardot';
        }
        drupal_set_message('This is happening.');
        $msg = "TEXT";
        dpm($msg);
    }

    function send_to_pardot(&$form, &$form_state){
        $url = 'url';
        $headers = array('Content-Type' => 'application/x-www-form-urlencoded');
        $method = 'POST';

        $data = $form_state;

        $data_to_send = array();

        $data_to_send['mail'] = $data['mail'];
        $data_to_send['profile_firstname'] = $data['profile_firstname'];
        $data_to_send['profile_lastname'] = $data['profile_lastname'];
        $data_to_send['profile_company'] = $data['profile_company'];
        $data_to_send['profile_title'] = $data['profile_title'];
        $data_to_send['profile_phone'] = $data['profile_phone'];

        $retry = 3;
        $timeout = 15;

        try {
            $result = drupal_http_request($url, $headers, $method, http_build_query($data_to_send, '', '&'), $retry, $timeout);
        } catch (Exception $e) {
            drupal_set_message('Error incured while processing your information: ', $e->getMessage());
        }
    }

On the drupal_set_message() and dpm() calls; I'm trying to get any sort of output client-side to let me know if I'm incurring errors, what's going on with my variables, what-have-you. I get nothing. I've tried mail() to send me the contents of the form behind the scenes, but still nothing. I'm new to Drupal and altogether uninitiated in the world of PHP, so I'm not sure where functionality like displaying messages to a user or enabling mail could be disabled or where I might even begin to investigate that.

I've enabled the module in the administration section of Drupal, and I'm pretty sure it's altering the form, as whenever I update the file with an error the form fails to load.

I'm hitting a dead-end here. I could probably figure this out if I could just figure out a way to debug the script.

If anyone with similar experiences or just more experience could shed some light on my issue, it would be greatly appreciated.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.