ninja_forms_display_response_message

Outputs the HTML for displaying success messages or error messages set to display at location 'general'.

Description

ninja_forms_display_response_message( $form_id ); 

Parameters (1)

0. $form_id
The form id.

Usage

  1. if ( !function_exists( 'ninja_forms_display_response_message' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'ninja-forms/deprecated/includes/display/form/response-message.php'; 
  3.  
  4. // The form id. 
  5. $form_id = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = ninja_forms_display_response_message($form_id); 
  9.  

Defined (1)

The function is defined in the following location(s).

/deprecated/includes/display/form/response-message.php  
  1. function ninja_forms_display_response_message( $form_id ) { 
  2. global $ninja_forms_processing; 
  3.  
  4. // if ( ! is_object( $ninja_forms_processing ) || $ninja_forms_processing->get_form_ID() != $form_id ) { 
  5. // return false; 
  6. // } 
  7.  
  8. $plugin_settings = nf_get_settings(); 
  9.  
  10. $form_row = ninja_forms_get_form_by_id($form_id); 
  11. if( isset( $form_row['data']['ajax'] ) ) { 
  12. $ajax = $form_row['data']['ajax']; 
  13. }else{ 
  14. $ajax = 0; 
  15.  
  16. if( $ajax == 0 AND ( is_object( $ninja_forms_processing ) AND !$ninja_forms_processing->get_all_errors() AND !$ninja_forms_processing->get_all_success_msgs() ) ) { 
  17. $display = 'display:none;'; 
  18. }else{ 
  19. $display = ''; 
  20.  
  21. if( is_object( $ninja_forms_processing ) ) { 
  22. if( $ninja_forms_processing->get_errors_by_location('general') ) { 
  23. $class = 'ninja-forms-error-msg'; 
  24. }else if( $ninja_forms_processing->get_all_success_msgs() ) { 
  25. $class = 'ninja-forms-success-msg'; 
  26. }else{ 
  27. $class = ''; 
  28. }else{ 
  29. $class = ''; 
  30.  
  31. $class = apply_filters( 'ninja_forms_display_response_message_class', $class, $form_id ); 
  32.  
  33. //if ( $class != '' ) { 
  34. echo '<div id="ninja_forms_form_' . $form_id . '_response_msg" style="' . $display . '" class="ninja-forms-response-msg '.$class.'">'; 
  35.  
  36. if ( isset ( $ninja_forms_processing ) && $ninja_forms_processing->get_form_ID() == $form_id ) { 
  37.  
  38. if( is_object( $ninja_forms_processing ) ) { 
  39. if( $ninja_forms_processing->get_form_ID() == $form_id ) { 
  40. if( $ninja_forms_processing->get_errors_by_location('general') ) { 
  41. foreach($ninja_forms_processing->get_errors_by_location('general') as $error) { 
  42. echo '<div>'; 
  43. echo $error['msg']; 
  44. echo '</div>'; 
  45.  
  46.  
  47. if( $ninja_forms_processing->get_all_success_msgs()) { 
  48. foreach($ninja_forms_processing->get_all_success_msgs() as $success) { 
  49. echo '<div>'; 
  50. echo $success; 
  51. echo '</div>'; 
  52.  
  53.  
  54.  
  55. echo '</div>';  
  56. //} 
  57.  
  58.