ninja_forms_ajax_import_form

The Ninja Forms ninja forms ajax import form function.

Description

ninja_forms_ajax_import_form(); 

Usage

  1. if ( !function_exists( 'ninja_forms_ajax_import_form' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'ninja-forms/lib/NF_Upgrade.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = ninja_forms_ajax_import_form(); 
  7.  

Defined (1)

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

/lib/NF_Upgrade.php  
  1. function ninja_forms_ajax_import_form() { 
  2. if( ! current_user_can( apply_filters( 'ninja_forms_admin_upgrade_import_form_capabilities', 'manage_options' ) ) ) return; 
  3.  
  4. $import = stripslashes( $_POST[ 'import' ] ); 
  5.  
  6. $form_id = ( isset( $_POST[ 'formID' ] ) ) ? absint( $_POST[ 'formID' ] ) : ''; 
  7.  
  8. Ninja_Forms()->form()->import_form( $import, $form_id, TRUE ); 
  9.  
  10. if( isset( $_POST[ 'flagged' ] ) && $_POST[ 'flagged' ] ) { 
  11. $form = Ninja_Forms()->form( $form_id )->get(); 
  12. $form->update_setting( 'lock', TRUE ); 
  13. $form->save(); 
  14.  
  15.  
  16. echo json_encode( array( 'export' => $_POST[ 'import' ], 'import' => $import ) ); 
  17. wp_die();