nf_29_update_form_settings_check

Check our option to see if we've updated all of our form settings.

Description

nf_29_update_form_settings_check( $form_id ); 

If we haven't, then update the form currently being viewed.

Parameters (1)

0. $form_id
The form id.

Usage

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

Defined (1)

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

/deprecated/includes/display/upgrade-functions.php  
  1. function nf_29_update_form_settings_check( $form_id ) { 
  2. // Bail if we are in the admin 
  3. if ( is_admin() ) 
  4. return false; 
  5.  
  6. // Bail if this form was created in 2.9 or higher. 
  7. if ( 'form' == nf_get_object_type( $form_id ) ) 
  8. return false; 
  9.  
  10. // Get a list of forms that we've already converted. 
  11. $completed_forms = get_option( 'nf_converted_forms', array() ); 
  12.  
  13. if ( ! is_array( $completed_forms ) ) 
  14. $completed_forms = array(); 
  15.  
  16. // Bail if we've already converted the db for this form. 
  17. if ( in_array( $form_id, $completed_forms ) ) 
  18. return false; 
  19.  
  20.  
  21. $completed_forms[] = $form_id; 
  22. update_option( 'nf_converted_forms', $completed_forms );