ninja_forms_export_form

The Ninja Forms ninja forms export form function.

Description

ninja_forms_export_form( $form_id ); 

Parameters (1)

0. $form_id
The form id.

Usage

  1. if ( !function_exists( 'ninja_forms_export_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 id. 
  5. $form_id = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = ninja_forms_export_form($form_id); 
  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_export_form( $form_id ) { 
  2. if($form_id == '') 
  3. return; 
  4. $plugin_settings = nf_get_settings(); 
  5. $form_title = Ninja_Forms()->form( $form_id )->get_setting( 'form_title' ); 
  6. $form_row = ninja_forms_serialize_form( $form_id ); 
  7. $form_title = preg_replace('/[^a-zA-Z0-9-]/', '', $form_title); 
  8. $form_title = str_replace (" ", "-", $form_title); 
  9.  
  10. if(isset($plugin_settings['date_format'])) { 
  11. $date_format = $plugin_settings['date_format']; 
  12. }else{ 
  13. $date_format = 'm/d/Y'; 
  14.  
  15. //$today = date($date_format); 
  16. $current_time = current_time('timestamp'); 
  17. $today = date($date_format, $current_time); 
  18.  
  19. header("Content-type: application/csv"); 
  20. header('Content-Disposition: attachment; filename="'.$form_title.'"-"'.$today.'".nff"'); 
  21. header("Pragma: no-cache"); 
  22. header("Expires: 0"); 
  23. echo $form_row; 
  24. die();