/tw_ee_log_pm_deactivate.php Secret
Created
May 2, 2023 14:47
Creates a log entry when a payment method has been deactivate.
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. | |
//Debug function to easily write various vars to the log. | |
if ( ! function_exists('tw_ee_write_log')) { | |
function tw_ee_write_log( $log ) { | |
if ( is_array( $log ) || is_object( $log ) ) { | |
error_log( print_r( $log, true ) ); | |
} else { | |
error_log( $log ); | |
} | |
} | |
} | |
add_action('AHEE__EEM_Payment_Method___create_objects_auto_deactivated_payment_method', 'tw_ee_log_pm_deactivate'); | |
function tw_ee_log_pm_deactivate($payment_method) { | |
//Exception for stack trace | |
$e = new \Exception; | |
tw_ee_write_log( | |
array( | |
'payment_method_deactivated' => $payment_method->name(), | |
'stack_trace' => $e->getTraceAsString() | |
) | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment