post-process.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php if ( ! defined( 'ABSPATH' ) ) exit;
  2. function ninja_forms_post_process(){
  3. global $wpdb, $ninja_forms_processing;
  4. $ajax = $ninja_forms_processing->get_form_setting('ajax');
  5. $form_id = $ninja_forms_processing->get_form_ID();
  6. $json = ninja_forms_json_response();
  7. if(!$ninja_forms_processing->get_all_errors()){
  8. do_action('ninja_forms_post_process');
  9. $json = ninja_forms_json_response();
  10. if( !$ninja_forms_processing->get_all_errors() ){
  11. $ninja_forms_processing->update_form_setting( 'processing_complete', 1 );
  12. if($ajax == 1){
  13. //header('Content-Type', 'application/json');
  14. echo $json;
  15. die();
  16. }else{
  17. if( $ninja_forms_processing->get_form_setting( 'landing_page' ) != '' ){
  18. ninja_forms_set_transient();
  19. $url = str_replace( '&amp;', '&', $ninja_forms_processing->get_form_setting( 'landing_page' ) );
  20. wp_redirect( $url );
  21. die();
  22. }
  23. }
  24. }else{
  25. if($ajax == 1){
  26. //header('Content-Type', 'application/json');
  27. echo $json;
  28. die();
  29. }else{
  30. //echo 'post-processing';
  31. //print_r($ninja_forms_processing->get_all_errors());
  32. }
  33. }
  34. }else{
  35. if($ajax == 1){
  36. //header('Content-Type', 'application/json');
  37. echo $json;
  38. die();
  39. }else{
  40. //echo 'post-processing';
  41. //print_r($ninja_forms_processing->get_all_errors());
  42. }
  43. }
  44. }