caldera_forms_db_v2_update

Update Caldera Forms DB system to v2.

Description

caldera_forms_db_v2_update(); 

Usage

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

Defined (1)

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

/includes/updater.php  
  1. function caldera_forms_db_v2_update() { 
  2. $forms = get_option( '_caldera_forms', array() ); 
  3. if( ! empty( $forms ) ) { 
  4. $where = '`option_name` = "' . implode( '" OR `option_name` = "', array_keys( $forms ) ) . '"'; 
  5.  
  6. global $wpdb; 
  7. $sql = sprintf( "UPDATE `%s` SET `autoload`='no' WHERE %s", $wpdb->options, $where ); 
  8. $wpdb->get_results( $sql ); 
  9.  
  10. $new_registry = array(); 
  11. if( ! empty( $forms ) ) { 
  12. foreach( $forms as $id => $form ) { 
  13. $new_registry[ $id ] = $id; 
  14.  
  15.  
  16.  
  17. add_option( '_caldera_forms_forms', $new_registry, false ); 
  18.  
  19.  
  20.