phxt
Forum Replies Created
-
Forum: Plugins
In reply to: [Forms: 3rd-Party Integration] Send data only if checkbox is setAh, thank you. Works perfectly now.
Forum: Plugins
In reply to: [Forms: 3rd-Party Integration] Send data only if checkbox is setThe response email I get when the “Subscribe” box is checked is:
*** Service ***
Array
(
[name] => Mail Subscribe
[url] => https://xxx.com/signup.ashx
[forms] => Array
(
[0] => cf7_172
)[success] =>
[failure] =>
[timeout] => 10
[hook] => true
[mapping] => Array
(
[0] => Array
(
[lbl] => The email address
[src] => your-email
[3rd] => email
)[1] => Array
(
[val] => 1
[lbl] => List
[src] => 012461072
[3rd] => addressbookid
)[2] => Array
(
[val] => 1
[lbl] => User ID
[src] => 012120946
[3rd] => userid
))
[separator] => ,
)*** Post (Form) ***
https://xxx.com/contact-us/
Array
(
[_wpcf7] => 172
[_wpcf7_version] => 4.0.1
[_wpcf7_locale] => en_US
[_wpcf7_unit_tag] => wpcf7-f172-o1
[_wpnonce] => 29127125db
[your-name] => Test
[your-email] => [email protected]
[menu-633] => Hotel
[tel-836] => 0123456789
[your-subject] => Test
[your-message] => Test
[subscribe] => subscribe
[_wpcf7_is_ajax_call] => 1
)*** Post (to Service) ***
Array
(
[timeout] => 10
[body] => Array
(
[email] => [email protected]
[addressbookid] => 012461072
[userid] => 012120946
)[response_bypass] => Array
(
[body] => OKAY
[response] => Array
(
[code] => 200
))
)
*** Response ***
Array
(
[body] => OKAY
[response] => Array
(
[code] => 200
))
Forum: Plugins
In reply to: [Forms: 3rd-Party Integration] Send data only if checkbox is setWhat I’ve got is:
add_filter('Forms3rdPartyIntegration_service_filter_args', 'forms3rdparty_conditional_send', 10, 3); function forms3rdparty_conditional_send($post_args, $service, $form) { if( !isset($post_args['body']['subscribe']) ) { $post_args['response_bypass'] = array('body' => 'OKAY', 'response' => array('code' => 200)); } return $post_args; }
but this just stops the form from sending data to the 3rd party altogether, whether or not the “Subscribe” box is checked.
Works perfectly – thank you for the quick response!