Docly

cs_post_submit

Estimated reading: 1 minute

Description

This filter allows you to take actions after a successful submission to the Campaign Suite API.

Use

				
					add_filter('cs_post_submit', 'post_submit', 10, 1);				
			

Parameters

  • $response ( object ) < / div>

    This is the complete CampaignSuite\CampaignSuite\Render_response() class object. This object contains information about the response returned by the CS API.

Example

The example below writes a $_SESSION[‘orig_campaign’] value to the Salesforce Contact object.

				
					function post_submit($response)
{
  if (isset($_SESSION['orig_campaign'])) {
        $sf_client = instance('Client_Salesforce');
        $sf_client->update(
            'Contact',
            $_SESSION['orig_campaign']['contact_id'],
            [
                'soco__Originating_Campaign__c' => $_SESSION['orig_campaign']['campaign_id']
            ]
        );
        unset($_SESSION['orig_campaign']);
    }
    return $response;
}