Plugin Author
Franky
(@liedekef)
The hook is indeed called for those too. You should check the event status:
$event[‘event_status’]
Values:
EME_EVENT_STATUS_TRASH
EME_EVENT_STATUS_PUBLIC
EME_EVENT_STATUS_PRIVATE
EME_EVENT_STATUS_DRAFT
Thread Starter
Fred17
(@f14m07)
I added this code :
if ($event['event_status'] == EME_EVENT_STATUS_PRIVATE) {
exit;
}else{
//sinon envoyer le mailing
foreach ( $person_ids as $person_id ) {
$person=eme_get_person($person_id);
$person_name=eme_format_full_name($person['firstname'],$person['lastname']);
eme_send_mail($subject,$body, $person['email'], $person_name, $contact_email, $contact_name);
}
but the mails are still sent
Thread Starter
Fred17
(@f14m07)
Oh I used PRIVATE and not DRAFT so it’s ok now with this code :
//si evenement pas un brouillon envoyer le mailing
if ($event['event_status'] != EME_EVENT_STATUS_DRAFT) {
foreach ( $person_ids as $person_id ) {
$person=eme_get_person($person_id);
$person_name=eme_format_full_name($person['firstname'],$person['lastname']);
eme_send_mail($subject,$body, $person['email'], $person_name, $contact_email, $contact_name);
}
Thanks a lot, always so efficient
-
This reply was modified 4 years, 3 months ago by
Fred17.
Plugin Author
Franky
(@liedekef)
Nice. Also, eme_queue_mail might be a better function call (if you use mail queueing):
eme_queue_mail($subject,$body, $person['email'], $person_name, $contact_email, $contact_name);
causes the mail to be queued and not sent immediately.