I added the following code to my functions.php file and I am now receiving emails from the frontend form. But I receive an email whenever a new event is added to the database – frontend or backend. I only want to receive the notifications when the frontend form is submitted.
add_action(’eme_insert_event_action’,’eme_mail_event’);
function eme_mail_event ($event) {
$contact = eme_get_contact ($event);
$contact_email = “[email protected]”;
$subject_format=”An New Event Has Been Submitted ‘ #_EVENTNAME ‘”;
$body_format=”An New Event Has Been Submitted <br /><br /> #_EVENTNAME in #_TOWN, #_STATE <br /> #_EVENTDETAILS <br /><br />
#_STARTDATE at #_STARTTIME to #_ENDDATE at #_ENDTIME <br /><br /> Contact: #_CONTACTEMAIL<br /> <br /> Please log into the admin to approve the event.”;
$subject=eme_replace_placeholders($subject_format, $event, “text”);
$body=eme_replace_placeholders($body_format, $event, “text”);
eme_send_mail($subject,$body,$contact_email);
}