Ok, I had a chance to try it and got it to work. Here’s what I did:
– Edited the file wp-content\plugins\myMail\includes\functions.php and added this code to the bottom of the file, just above “?>”:
/*
* requires a checkbox with the the name "newsletter" in your CF7
*/
function wpcf7_my_validate( $result, $tag ) {
$type = $tag['type'];
$name = $tag['name'];
if ( 'newsletter' == $name ) {
$subscribe = isset($_POST[$name]);
if(function_exists('mymail_subscribe') && $subscribe){
$email = $_POST['email'];
$userdata = array(
'firstname' => $_POST['firstname'],
'lastname' => $_POST['lastname'],
'company' => $_POST['company'],
'phone' => $_POST['phone'],
);
$listname = "YOUR LIST NAME HERE";
mymail_subscribe($email, $userdata, $listname);
}
}
return $result;
}
add_filter( 'wpcf7_validate_checkbox', 'wpcf7_my_validate', 10, 2 );
– Then I added the following tag to the CF7 forms:
[checkbox newsletter default:1 "Subscribe newsletter"]
– Checked my CF7 label names to match those of MyMail fields (firstname, email, company, etc) – note that “company” and “phone” are my custom fields
– Tested to see if it works
And it was done.
Hope it works for you, if you need any help let me know.
Cheers