Skip to content

Instantly share code, notes, and snippets.

@Apina
Created August 11, 2014 07:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Apina/ee4cb6913a44813c2c10 to your computer and use it in GitHub Desktop.
Save Apina/ee4cb6913a44813c2c10 to your computer and use it in GitHub Desktop.
EE3 R+P - send email to site admin when new event has been created - very basic, doesn't exclude admin etc.
<?php
// this is a very basic example and should be used as a basis rather than as is.
// It is not supported by Event Espresso nor will it likely be updated.
function myemailthing($_REQUEST) {
//var_dump($_REQUEST);
//wp_die( );
$admin_email = get_option( 'admin_email' );
$user = get_user_by( 'id', $_REQUEST['user']);
$subject = 'New event added';
$message = 'A new event called ' . $_REQUEST['event'] . ' has been created by ' . $user->first_name;
wp_mail( $admin_email, $subject, $message );
}
add_action('action_hook_espresso_insert_event_success','myemailthing');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment