ninja_forms_calc_after_import_form

The Ninja Forms ninja forms calc after import form function.

Description

ninja_forms_calc_after_import_form( $form ); 

Parameters (1)

0. $form
The form.

Usage

  1. if ( !function_exists( 'ninja_forms_calc_after_import_form' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'ninja-forms/deprecated/includes/admin/pages/ninja-forms-impexp/tabs/impexp-forms/impexp-forms.php'; 
  3.  
  4. // The form. 
  5. $form = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = ninja_forms_calc_after_import_form($form); 
  9.  

Defined (1)

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

/deprecated/includes/admin/pages/ninja-forms-impexp/tabs/impexp-forms/impexp-forms.php  
  1. function ninja_forms_calc_after_import_form( $form ) { 
  2. global $wpdb; 
  3.  
  4. if( is_array( $form['field'] ) AND !empty( $form['field'] ) ) { 
  5. $field_rows = ninja_forms_get_fields_by_form_id( $form['id'] ); 
  6. if( is_array( $field_rows ) AND !empty( $field_rows ) ) { 
  7. for ($y=0; $y < count( $field_rows ); $y++) { 
  8. if ( isset ( $field_rows[$y]['data']['calc'] ) AND is_array( $field_rows[$y]['data']['calc'] ) ) { 
  9. for ( $i=0; $i < count( $field_rows[$y]['data']['calc']); $i++ ) { 
  10. foreach( $form['field'] as $inserted_field ) { 
  11. if ( isset ( $field_rows[$y]['data']['calc'][$i]['field'] ) AND $inserted_field['old_id'] == $field_rows[$y]['data']['calc'][$i]['field'] ) { 
  12. $field_rows[$y]['data']['calc'][$i]['field'] = $inserted_field['id']; 
  13.  
  14. if ( isset ( $field_rows[$y]['data']['calc_eq'] ) AND $field_rows[$y]['data']['calc_eq'] != '' ) { 
  15. $calc_eq = $field_rows[$y]['data']['calc_eq']; 
  16. foreach( $form['field'] as $inserted_field ) { 
  17. $calc_eq = str_replace( 'field_'.$inserted_field['old_id'], 'field_'.$inserted_field['id'], $calc_eq ); 
  18. $field_rows[$y]['data']['calc_eq'] = $calc_eq; 
  19. }  
  20.  
  21. $field_rows[$y]['data'] = serialize( $field_rows[$y]['data'] ); 
  22. $args = array( 
  23. 'update_array' => array( 
  24. 'data' => $field_rows[$y]['data'],  
  25. ),  
  26. 'where' => array( 
  27. 'id' => $field_rows[$y]['id'],  
  28. ),  
  29. ); 
  30.  
  31. if ( isset ( $form['data']['success_msg'] ) AND $form['data']['success_msg'] != '' ) { 
  32. $success_msg = $form['data']['success_msg']; 
  33. foreach( $form['field'] as $inserted_field ) { 
  34. $success_msg = str_replace( '[ninja_forms_field id='.$inserted_field['old_id'].']', '[ninja_forms_field id='.$inserted_field['id'].']', $success_msg ); 
  35. $form['data']['success_msg'] = $success_msg; 
  36.  
  37. if ( isset ( $form['data']['user_subject'] ) AND $form['data']['user_subject'] != '' ) { 
  38. $user_subject = $form['data']['user_subject']; 
  39. foreach( $form['field'] as $inserted_field ) { 
  40. $user_subject = str_replace( '[ninja_forms_field id='.$inserted_field['old_id'].']', '[ninja_forms_field id='.$inserted_field['id'].']', $user_subject ); 
  41. $form['data']['user_subject'] = $user_subject; 
  42. }  
  43.  
  44. if ( isset ( $form['data']['user_email_msg'] ) AND $form['data']['user_email_msg'] != '' ) { 
  45. $user_email_msg = $form['data']['user_email_msg']; 
  46. foreach( $form['field'] as $inserted_field ) { 
  47. $user_email_msg = str_replace( '[ninja_forms_field id='.$inserted_field['old_id'].']', '[ninja_forms_field id='.$inserted_field['id'].']', $user_email_msg ); 
  48. $form['data']['user_email_msg'] = $user_email_msg; 
  49.  
  50. if ( isset ( $form['data']['admin_subject'] ) AND $form['data']['admin_subject'] != '' ) { 
  51. $admin_subject = $form['data']['admin_subject']; 
  52. foreach( $form['field'] as $inserted_field ) { 
  53. $admin_subject = str_replace( '[ninja_forms_field id='.$inserted_field['old_id'].']', '[ninja_forms_field id='.$inserted_field['id'].']', $admin_subject ); 
  54. $form['data']['admin_subject'] = $admin_subject; 
  55. }  
  56.  
  57. if ( isset ( $form['data']['admin_email_msg'] ) AND $form['data']['admin_email_msg'] != '' ) { 
  58. $admin_email_msg = $form['data']['admin_email_msg']; 
  59. foreach( $form['field'] as $inserted_field ) { 
  60. $admin_email_msg = str_replace( '[ninja_forms_field id='.$inserted_field['old_id'].']', '[ninja_forms_field id='.$inserted_field['id'].']', $admin_email_msg ); 
  61. $form['data']['admin_email_msg'] = $admin_email_msg; 
  62.  
  63. if ( isset ( $form['data']['mp_confirm_msg'] ) AND $form['data']['mp_confirm_msg'] != '' ) { 
  64. $mp_confirm_msg = $form['data']['mp_confirm_msg']; 
  65. foreach( $form['field'] as $inserted_field ) { 
  66. $mp_confirm_msg = str_replace( '[ninja_forms_field id='.$inserted_field['old_id'].']', '[ninja_forms_field id='.$inserted_field['id'].']', $mp_confirm_msg ); 
  67. $form['data']['mp_confirm_msg'] = $mp_confirm_msg; 
  68.  
  69. if ( isset ( $form['data']['save_msg'] ) AND $form['data']['save_msg'] != '' ) { 
  70. $save_msg = $form['data']['save_msg']; 
  71. foreach( $form['field'] as $inserted_field ) { 
  72. $save_msg = str_replace( '[ninja_forms_field id='.$inserted_field['old_id'].']', '[ninja_forms_field id='.$inserted_field['id'].']', $save_msg ); 
  73. $form['data']['save_msg'] = $save_msg; 
  74.  
  75. if ( isset ( $form['data']['save_email_msg'] ) AND $form['data']['save_email_msg'] != '' ) { 
  76. $save_email_msg = $form['data']['save_email_msg']; 
  77. foreach( $form['field'] as $inserted_field ) { 
  78. $save_email_msg = str_replace( '[ninja_forms_field id='.$inserted_field['old_id'].']', '[ninja_forms_field id='.$inserted_field['id'].']', $save_email_msg ); 
  79. $form['data']['save_email_msg'] = $save_email_msg; 
  80.  
  81. $args = array( 
  82. 'update_array' => array( 
  83. 'data' => serialize( $form['data'] ),  
  84. ),  
  85. 'where' => array( 
  86. 'id' => $form['id'],  
  87. ),  
  88. );