• Resolved Fred17

    (@f14m07)


    Hi Franky
    I use a hook that sends a mailing to a group when a new event is scheduled. This hook is added to the function.php file of the child theme. It is based on the “eme_insert_event_action”. I found out that even if the event has the status “draft” the mailing is sent. Is there a way to avoid sending this mailing for draft events?

    Have a nice day
    Frédéric.

Viewing 4 replies - 1 through 4 (of 4 total)
  • 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 3 years 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.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Schedule a private event’ is closed to new replies.