Skip to content

Instantly share code, notes, and snippets.

@Pebblo
Created February 5, 2024 12:28
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 Pebblo/2ebecaacb210a71897aaadf23db9fdf9 to your computer and use it in GitHub Desktop.
Save Pebblo/2ebecaacb210a71897aaadf23db9fdf9 to your computer and use it in GitHub Desktop.
Example of how to log the request data from an invalid form submission
<?php
if ( ! function_exists('write_log')) {
function write_log ( $log ) {
if ( is_array( $log ) || is_object( $log ) ) {
error_log( print_r( $log, true ) );
} else {
error_log( $log );
}
}
}
add_action('AHEE__EE_Form_Section_Proper__receive_form_submission__end', 'tw_ee_log_invalid_form', 10, 3);
function tw_ee_log_invalid_form( $req_data, $form, $validate) {
if(! $form->is_valid() ) {
write_log( $req_data);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment