Plugin Author
zaus
(@zaus)
Did you see the question right below yours?
https://wordpress.org/support/topic/conditional-logic-feature?replies=6#post-6434793
Please let me know if that answer was confusing.
Hi, thank you for the reply. Yes, I actually did see the post below mine and read through it, but it is still slightly confusing to me.
I understand that the user was looking to use conditional logic to not send the results to the 3rd party if a certain condition was met… using the response_bypass. I just don’t know how to alter that code to make it work for my situation.
I still want to post to the 3rd party, I just want to leave out specific fields.
I’m sorry to take up your time with these simple questions. Thank you again for your time.
Plugin Author
zaus
(@zaus)
Ahhh…sorry, I didn’t read your question right.
Your case would be easier — you just need to remove items from the post array before they get sent, no bypass necessary.
Something like:
add_filter('Forms3rdPartyIntegration_service_filter_post', 'forms3rdparty_conditional_send', 10, 3);
function forms3rdparty_conditional_send($post, $service, $form) {
// inspect transformed submission body for presence/lack/value of the desired value
$field = 'my-conditional-field';
if( isset($post[$field]) && $post[$field] == 'value-to-ignore') {
// remove
unset($post[$field]);
}
// return changed filter arg
return $post;
}
(note the different hook)
Yes, this looks like exactly what I need. Thanks again for your help with this!
Marking it as resolved.