Last active
August 29, 2015 14:27
-
-
Save Shelob9/bb202bcec2170b64b406 to your computer and use it in GitHub Desktop.
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 | |
/** | |
Plugin Name: Caldera Form Mail Debug Helper | |
Version: 0.1.0 | |
*/ | |
/** | |
* Write data to log | |
*/ | |
function cf_mail_debug_write_log ( $log ) { | |
if ( is_array( $log ) || is_object( $log ) ) { | |
error_log( print_r( $log, true ) ); | |
} else { | |
error_log( $log ); | |
} | |
} | |
/** | |
* Log data sent to mailer. | |
*/ | |
add_action( 'caldera_forms_do_mailer', 'cf_mailer_debug_capture_details', 99, 3 ); | |
function cf_mailer_debug_capture_details( $mail, $data, $form ) { | |
global $transdata; | |
$entry_id = $transdata['entry_id']; | |
$log = array( 'entry_id' => $entry_id, 'save_point' => 'pre_send', 'recipients' => $mail[ 'recipients'] ); | |
cf_mail_debug_write_log( $log ); | |
} | |
/** | |
* Log data from mailer errors. | |
*/ | |
add_action( 'caldera_forms_mailer_failed', 'cf_mailer_debug_capture_failer_details', 10, 3 ); | |
function cf_mailer_debug_capture_failer_details($mail, $data, $form) { | |
global $transdata; | |
$entry_id = $transdata['entry_id']; | |
$log = array( 'entry_id' => $entry_id, 'save_point' => 'pre_send', 'recipients' => $mail[ 'recipients'] ); | |
cf_mail_debug_write_log( $log ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment