ninja_forms_set_transient

Function that sets up our transient variable.

Description

ninja_forms_set_transient(); 

Usage

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

Defined (1)

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

/deprecated/includes/database.php  
  1. function ninja_forms_set_transient() { 
  2. global $ninja_forms_processing; 
  3.  
  4. $form_id = $ninja_forms_processing->get_form_ID(); 
  5.  
  6. // Setup our transient variable. 
  7. $cache = array(); 
  8. $cache['form_id'] = $form_id; 
  9. $cache['field_values'] = $ninja_forms_processing->get_all_fields(); 
  10. $cache['form_settings'] = $ninja_forms_processing->get_all_form_settings(); 
  11. $cache['extra_values'] = $ninja_forms_processing->get_all_extras(); 
  12. $all_fields_settings = array(); 
  13. if ( $ninja_forms_processing->get_all_fields() ) { 
  14. foreach ( $ninja_forms_processing->get_all_fields() as $field_id => $user_value ) { 
  15. $field_settings = $ninja_forms_processing->get_field_settings( $field_id ); 
  16. $all_fields_settings[$field_id] = $field_settings; 
  17.  
  18. $cache['field_settings'] = $all_fields_settings; 
  19.  
  20. // Set errors and success messages as Ninja_Forms()->session variables. 
  21. $success = $ninja_forms_processing->get_all_success_msgs(); 
  22. $errors = $ninja_forms_processing->get_all_errors(); 
  23.  
  24. $cache['success_msgs'] = $success; 
  25. $cache['error_msgs'] = $errors; 
  26.  
  27. Ninja_Forms()->session->set( 'nf_cache', $cache );