Data Conversion

As of Ninja Forms v2.9.36, an upgrade process is included for converting form and setting data to the new setting screens and database structure.

Form Settings

Filter Hook: ninja_forms_upgrade_settings

<?php
add_filter( 'ninja_forms_upgrade_settings', 'upgrade_my_form_settings' );
function upgrade_my_form_settings( $form_data ){
$old_setting = $form_data[ 'old_setting' ];
// Modify $old_setting
$form_data[ 'new_setting' ] = $old_setting;
return $form_data;
}

Action Settings

Filter Hook: ninja_forms_upgrade_action_{action_name}

<?php
add_filter( 'ninja_forms_upgrade_action_my_addon', 'upgrade_my_addon_settings' );
function upgrade_my_addon_settings( $action_settings ){
$old_setting = $action_setting[ 'old_setting' ];
// Modify $old_setting
$action_settings[ 'new_setting' ] = $old_setting;
return $action_settings;
}

Converting Form Settings to Actions

<?php
add_filter( 'ninja_forms_upgrade_settings', 'convert_form_settings_to_action' );
function convert_form_settings_to_action( $form_data ){
if( isset( $data[ 'settings' ][ 'my_processing_flag' ] ) && 1 == $data[ 'settings' ][ 'my_processing_flag' ] ){
$new_action = array(
'type' => 'action_type',
'label' => __( 'My Action', 'ninja-forms-paypal-express' ),
'new_setting' => $data[ 'settings' ][ 'old_plugin_setting' ]
);
$form_data[ 'actions' ][] = $new_action;
}
return $form_data;
}