ninja_forms_uninstall

The Ninja Forms ninja forms uninstall function.

Description

ninja_forms_uninstall(); 

Usage

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

Defined (2)

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

/deprecated/ninja-forms.php  
  1. function ninja_forms_uninstall() { 
  2. global $wpdb; 
  3.  
  4. $settings = Ninja_Forms()->get_plugin_settings(); 
  5.  
  6. // Bail if we haven't checked the "delete on uninstall" box. 
  7. if (isset ($settings['delete_on_uninstall']) && 1 == $settings['delete_on_uninstall']) { 
  8.  
  9. // Remove our options. 
  10. delete_option('ninja_forms_settings'); 
  11. delete_option('nf_version_upgraded_from'); 
  12. delete_option('nf_upgrade_notice'); 
  13.  
  14. delete_option(nf_database_migrations); 
  15.  
  16. delete_option('nf_convert_notifications_forms'); 
  17. delete_option('nf_convert_notifications_complete'); 
  18.  
  19. delete_option('nf_convert_subs_step'); 
  20.  
  21. delete_option('nf_email_fav_updated'); 
  22. delete_option('nf_update_email_settings_complete'); 
  23.  
  24. delete_option('nf_converted_subs'); 
  25. delete_option('nf_convert_subs_num'); 
  26. delete_option('nf_convert_subs_step'); 
  27.  
  28. delete_option('nf_converted_forms'); 
  29. delete_option('nf_converted_form_reset'); 
  30. delete_option('nf_convert_forms_complete'); 
  31.  
  32.  
  33. // Remove upgrade last step options 
  34. require_once( NF_PLUGIN_DIR . 'includes/admin/upgrades/class-upgrade.php'); 
  35. require_once( NF_PLUGIN_DIR . 'includes/admin/upgrades/upgrade-functions.php' ); 
  36. require_once( NF_PLUGIN_DIR . 'includes/admin/upgrades/upgrades.php' ); 
  37. require_once( NF_PLUGIN_DIR . 'includes/admin/upgrades/convert-forms-reset.php' ); 
  38. require_once( NF_PLUGIN_DIR . 'includes/admin/upgrades/upgrade-handler-page.php'); 
  39. require_once( NF_PLUGIN_DIR . 'includes/admin/upgrades/class-upgrade-handler.php'); 
  40. $upgrades = NF_UpgradeHandler()->upgrades; 
  41.  
  42. if ($upgrades AND is_array($upgrades)) { 
  43. foreach ($upgrades as $upgrade) { 
  44. delete_option('nf_upgrade_' . $upgrade->name . '_last_step'); 
  45.  
  46. // Remove all of our submissions 
  47. $items = get_posts(array('post_type' => nf_sub, 'post_status' => 'any', 'numberposts' => -1, 'fields' => 'ids')); 
  48.  
  49. if ($items) { 
  50. foreach ($items as $item) { 
  51. wp_delete_post($item, true); 
  52.  
  53. // Remove all of our custom tables 
  54.  
  55. $wpdb->query('DROP TABLE ' . NF_OBJECTS_TABLE_NAME); 
  56. $wpdb->query('DROP TABLE ' . NF_OBJECT_META_TABLE_NAME); 
  57. $wpdb->query('DROP TABLE ' . NF_OBJECT_RELATIONSHIPS_TABLE_NAME); 
  58.  
  59. $wpdb->query('DROP TABLE ' . NINJA_FORMS_TABLE_NAME); 
  60. $wpdb->query('DROP TABLE ' . NINJA_FORMS_FIELDS_TABLE_NAME); 
  61. $wpdb->query('DROP TABLE ' . NINJA_FORMS_FAV_FIELDS_TABLE_NAME); 
  62. $wpdb->query('DROP TABLE ' . NINJA_FORMS_SUBS_TABLE_NAME); 
  63.  
  64. // Remove our daily cron job 
  65. $timestamp = wp_next_scheduled('ninja_forms_daily_action'); 
  66. wp_unschedule_event($timestamp, 'ninja_forms_daily_action'); 
/ninja-forms.php  
  1. function ninja_forms_uninstall() { 
  2.  
  3. if( Ninja_Forms()->get_setting( 'delete_on_uninstall ') ) { 
  4. require_once plugin_dir_path(__FILE__) . '/includes/Database/Migrations.php'; 
  5. $migrations = new NF_Database_Migrations(); 
  6. $migrations->nuke(TRUE, TRUE);