{"id":7419,"date":"2021-05-15T16:35:44","date_gmt":"2021-05-15T16:35:44","guid":{"rendered":"https:\/\/docs.campaignsuite.nl\/docs\/developers\/filters\/cs_post_submit\/"},"modified":"2021-05-15T16:37:22","modified_gmt":"2021-05-15T16:37:22","slug":"cs_post_submit","status":"publish","type":"docs","link":"https:\/\/docs.campaignsuite.nl\/en\/docs\/developers\/filters\/cs_post_submit\/","title":{"rendered":"cs_post_submit"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-post\" data-elementor-id=\"7419\" class=\"elementor elementor-7419\">\n\t\t\t\t\t\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-faeb1ba elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"faeb1ba\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-2d38fb7\" data-id=\"2d38fb7\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-element elementor-element-ffcfb6c elementor-widget elementor-widget-text-editor\" data-id=\"ffcfb6c\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<h4>Description<\/h4><p>This filter allows you to take actions after a successful submission to the Campaign Suite API.<\/p><h4>Use<\/h4>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-176cc18 elementor-widget elementor-widget-docly_code_syntax_highlighter\" data-id=\"176cc18\" data-element_type=\"widget\" data-widget_type=\"docly_code_syntax_highlighter.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t                    <div class=\"docly-source-code prism\" data-lng-type=\"php\">\r\n\t\t\t<pre>\r\n\t\t\t\t<code class=\"language-php\">\r\n\t\t\t\t\tadd_filter(&#039;cs_post_submit&#039;, &#039;post_submit&#039;, 10, 1);\t\t\t\t<\/code>\r\n\t\t\t<\/pre>\r\n            <\/div>\r\n                \t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-bcf4713 elementor-widget elementor-widget-text-editor\" data-id=\"bcf4713\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<h4>Parameters<\/h4><ul><li><div><p><strong> $response (<a href=\"https:\/\/en.wikipedia.org\/wiki\/PHP_Data_Objects\" target=\"_blank\" rel=\"noopener\"> object <\/a>) <\/strong> &lt; \/ div&gt;<\/p><div>This is the complete CampaignSuite\\CampaignSuite\\Render_response() class object. This object contains information about the response returned by the CS API.<\/div><\/div><\/li><\/ul><h4>Example<\/h4><p>The example below writes a $_SESSION[&#8216;orig_campaign&#8217;] value to the Salesforce Contact object.<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-5d56aeb elementor-widget elementor-widget-docly_code_syntax_highlighter\" data-id=\"5d56aeb\" data-element_type=\"widget\" data-widget_type=\"docly_code_syntax_highlighter.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t                    <div class=\"docly-source-code prism\" data-lng-type=\"php\">\r\n\t\t\t<pre>\r\n\t\t\t\t<code class=\"language-php\">\r\n\t\t\t\t\tfunction post_submit($response)\n{\n  if (isset($_SESSION[&#039;orig_campaign&#039;])) {\n        $sf_client = instance(&#039;Client_Salesforce&#039;);\n        $sf_client-&gt;update(\n            &#039;Contact&#039;,\n            $_SESSION[&#039;orig_campaign&#039;][&#039;contact_id&#039;],\n            [\n                &#039;soco__Originating_Campaign__c&#039; =&gt; $_SESSION[&#039;orig_campaign&#039;][&#039;campaign_id&#039;]\n            ]\n        );\n        unset($_SESSION[&#039;orig_campaign&#039;]);\n    }\n    return $response;\n}\t\t\t\t<\/code>\r\n\t\t\t<\/pre>\r\n            <\/div>\r\n                \t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>Description This filter allows you to take actions after a successful submission to the Campaign Suite API. Use add_filter(&#039;cs_post_submit&#039;, &#039;post_submit&#039;, 10, 1); Parameters $response ( object ) &lt; \/ div&gt; This is the complete CampaignSuiteCampaignSuiteRender_response() class object. This object contains information about the response returned by the CS API. Example The example below writes a [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":7407,"menu_order":1,"comment_status":"open","ping_status":"closed","template":"","doc_tag":[],"class_list":["post-7419","docs","type-docs","status-publish","hentry","no-post-thumbnail"],"acf":[],"_links":{"self":[{"href":"https:\/\/docs.campaignsuite.nl\/en\/wp-json\/wp\/v2\/docs\/7419","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/docs.campaignsuite.nl\/en\/wp-json\/wp\/v2\/docs"}],"about":[{"href":"https:\/\/docs.campaignsuite.nl\/en\/wp-json\/wp\/v2\/types\/docs"}],"author":[{"embeddable":true,"href":"https:\/\/docs.campaignsuite.nl\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/docs.campaignsuite.nl\/en\/wp-json\/wp\/v2\/comments?post=7419"}],"version-history":[{"count":3,"href":"https:\/\/docs.campaignsuite.nl\/en\/wp-json\/wp\/v2\/docs\/7419\/revisions"}],"predecessor-version":[{"id":7422,"href":"https:\/\/docs.campaignsuite.nl\/en\/wp-json\/wp\/v2\/docs\/7419\/revisions\/7422"}],"up":[{"embeddable":true,"href":"https:\/\/docs.campaignsuite.nl\/en\/wp-json\/wp\/v2\/docs\/7407"}],"wp:attachment":[{"href":"https:\/\/docs.campaignsuite.nl\/en\/wp-json\/wp\/v2\/media?parent=7419"}],"wp:term":[{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/docs.campaignsuite.nl\/en\/wp-json\/wp\/v2\/doc_tag?post=7419"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}