Advertisement
chrishajer

Log validation errors even when not shown on screen

Jan 9th, 2014
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.55 KB | None | 0 0
  1. // originally https://gist.github.com/richardvav/7961308
  2. // Usage: add to your theme's functions.php file
  3. // log field validation errors
  4. add_filter('gform_validation', 'log_validation_failure');
  5. function log_validation_failure($validation_result){
  6.     $form = $validation_result["form"];
  7.     foreach($form["fields"] as &$field){
  8.         if( $field["failed_validation"] )
  9.             GFCommon::log_error("form #{$form["id"]}: validate() - failed: {$field["label"]}({$field["id"]} - {$field["type"]}) - message: {$field["validation_message"]}");
  10.     }
  11.     return $validation_result;
  12. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement