Hello everyone !
I need a little help to write some code, I use a plug in to get email when people download something. this plugin triggers this:
/**
* Triggers at the end of processing the subscription form successfully *
* @param array $form_data
do_action(‘std_end_form_process’, $form_data, $form_details);
the mail is in $form_data[‘std_email’]
I saw there is this filter “newsletter_subscription”, and I tried but with no success to add the mail to the subscribers of newsletter ?
could you help me I think I miss some informations, like the list or where to put the email and couldn’t find it in the documentation…
thanks in advance !!!
in the doc I saw this exemple.. I just want to add $form_data[‘std_email’] to a specific list for instance…
add_filter(“newsletter_subscription”, “my_filter_newsletter_subscription”, 10, 2);
function my_filter_newsletter_replace($subscription, $user) {
// Another filter nulled the subscription
if (!$subscription) {
return $subscription;
}
// Just an example: if the subscriber exists, force the single opt-in
if ($user) {
$subscription->optin = ‘single’;
}
// Never forget the return!
return $subscription;
}
Thanks in advance for any help 🙂 !!
Daniel