Last active
March 31, 2021 13:02
-
-
Save Pebblo/12979a1194031534d3af5b8eefd045e0 to your computer and use it in GitHub Desktop.
Sends an email to the email address set in Dashboard -> Settings -> General when an EE payment method has been automatically de-activated.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php // Please do not include the opening PHP tag if you already have one. | |
add_action('AHEE__EEM_Payment_Method___create_objects_auto_deactivated_payment_method', 'tw_ee_send_email_on_pm_deactivate'); | |
function tw_ee_send_email_on_pm_deactivate($payment_method) { | |
$from_email = $to = get_option('admin_email'); | |
//Exception for stack trace | |
$e = new \Exception; | |
$title = 'Event Espresso payment method deactivated'; | |
$body = sprintf( 'The %1$s payment method has been deacitvated. </br></<br> Stack trace: %2$s </br></br> Sent: %3$s', $payment_method->name(), $e->getTraceAsString(), date( "r" )); | |
$headers = "MIME-Version: 1.0\r\n" . | |
"From: " . $from_email . "\r\n" . | |
"Content-Type: text/html; charset=\"" . get_option('blog_charset') . "\"\r\n"; | |
wp_mail( $to, $title, $body, $headers ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment