Changed the action hook for Stripe Checkout

This commit is contained in:
Ruben Ramirez 2025-04-04 02:25:13 -05:00
parent 20fdf3e3b4
commit 4ab2b76550

View file

@ -7,21 +7,29 @@
*
*/
function log_to_file($message, $data = false){
// Only proceed if a message is provided
if ($message) {
$log_File = CUSTOM_DEBUG_LOG;
// Check if the custom log file constant is defined
if (defined('CUSTOM_DEBUG_LOG') && CUSTOM_DEBUG_LOG) {
$log_File = CUSTOM_DEBUG_LOG;
$date = new DateTime();
$date = $date->format("Y/m/d h:i:s");
$date = new DateTime();
$date = $date->format("Y/m/d h:i:s");
// Convert arrays and objects to JSON format
if (is_array($data) || is_object($data)) {
$data = json_encode($data, JSON_PRETTY_PRINT);
$message = $message . "\r\n" . $data;
} else if ($data) {
$message = $message . " " . $data;
// Convert arrays and objects to JSON format
if (is_array($data) || is_object($data)) {
$data = json_encode($data, JSON_PRETTY_PRINT);
$message = $message . "\r\n" . $data;
} else if ($data) {
$message = $message . " " . $data;
}
// Log the message to the specified file
error_log("[$date] " . $message ."\r\n", 3, $log_File);
}
error_log("[$date] " . $message ."\r\n",3,$log_File);
// If CUSTOM_DEBUG_LOG is not defined, do nothing (fail silently)
// Alternatively, could log to default PHP error log:
// else { error_log("Quiztech Debug: " . $message); }
}
}
@ -463,4 +471,4 @@ function quiztech_ajax_save_question() {
}
add_action( 'wp_ajax_quiztech_save_question', 'quiztech_ajax_save_question' );
add_action( 'init', 'quiztech_handle_credit_purchase_submission' ); // Hook into init
add_action( 'template_redirect', 'quiztech_handle_credit_purchase_submission' ); // Hook into template_redirect