Reputation: 2015
In contact form 7 plugin of WordPress, Is it possible to send custom message to mail based on checkbox value. In my form I have, subscribe to newsletter checkbox. When user checks the checkbox, subscribe to newsletter is coming as 'Yes' in mail. Now I want to send subscribe to newsletter as 'No' when user doesn't check the checkbox.
Is it possible. I tried and am still searching for the answer in google but to no avail.Any help/suggestion is welcome. Thanks in advance.
Upvotes: 0
Views: 3843
Reputation: 2015
Finally got the solution.
add_action("wpcf7_posted_data", "wpcf7_modify_this");
function wpcf7_modify_this($posted_data) {
/* if checkbox isn't checked send Nej to mail */
if ($posted_data['checkbox-829'][0] == "")
$posted_data['checkbox-829'][0] = "Nej";
return $posted_data;
}
I got this solution from answer of DACrosby here.
Upvotes: 1