• Resolved pedz

    (@pedz)


    Hi
    I would like to send an email alert to all members when we add a cycling event.
    I have tried the following in the default WP theme Twenty Seventeen functions.php

    add_action('eme_insert_event_action','eme_mail_event');
    function eme_mail_event ($event) {
       $contact = eme_get_contact ($event);
       $contact_email = $contact->user_email;
       $contact_name = $contact->display_name;
       $subject_format="This is the new event called ' #_EVENTNAME '";
       $body_format="This is the new event called ' #_EVENTNAME '";
    
       $subject=eme_replace_placeholders($subject_format, $event, "text");
       $body=eme_replace_placeholders($body_format, $event, "text");
       $blogusers = get_users();
       foreach ( $blogusers as $user ) {
          eme_send_mail($subject,$body, $user->email, $user->display_name, $contact_email, $contact_name);
       }
    }
    

    But when I create a new event I do not get an email.
    I have verified mail does work on the plugin and WP.

    What have I missed?
    Thanks

Viewing 1 replies (of 1 total)
  • Plugin Author Franky

    (@liedekef)

    This was also asked on the EME forum, but to be complete: $user->email should be $user->user_email

Viewing 1 replies (of 1 total)
  • The topic ‘email all users on new event action hook’ is closed to new replies.