NF_Convert_Forms_Reset

The Ninja Forms NF Convert Forms Reset class.

Defined (1)

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

/deprecated/includes/admin/upgrades/convert-forms-reset.php  
  1. class NF_Convert_Forms_Reset 
  2. public function __construct() 
  3. add_action('admin_menu', array( $this, 'register_submenu'), 9001); 
  4. add_filter( 'nf_general_settings_advanced', array( $this, 'register_advanced_settings' ) ); 
  5.  
  6. public function register_submenu() 
  7. add_submenu_page( 
  8. NULL, // Parent Slug 
  9. 'Ninja Forms Conversion Reset', // Page Title 
  10. 'Ninja Forms Conversion Reset', // Menu Title 
  11. 'manage_options', // Capability 
  12. 'ninja-forms-conversion-reset', // Menu Slug 
  13. array( $this, 'display') // Function 
  14. ); 
  15.  
  16. public function display() { 
  17. echo "<h1>" . __( 'Reset Forms Conversion', 'ninja-forms' ) . "</h1>"; 
  18.  
  19. $this->process(); 
  20.  
  21. echo '<script>window.location.replace("' . site_url('wp-admin/index.php?page=nf-processing&action=convert_forms&title=Updating+Form+Database') . '");</script>'; 
  22.  
  23. public function process() 
  24. // Remove our "converted" flags from the options table 
  25. delete_option( 'nf_convert_forms_complete' ); 
  26. delete_option( 'nf_converted_forms' ); 
  27.  
  28. // Add flag for conversion being reset 
  29. update_option( 'nf_converted_form_reset', true ); 
  30.  
  31. public function register_advanced_settings( $advanced_settings ) { 
  32.  
  33. $new_advanced_setting = array( 
  34. 'name' => 'reset-conversion',  
  35. 'type' => '',  
  36. 'label' => __( 'Reset Form Conversion', 'ninja-forms' ),  
  37. 'display_function' => array( $this, 'display_advanced_settings' ) 
  38. ); 
  39.  
  40. $advanced_settings[] = $new_advanced_setting; 
  41.  
  42. return $advanced_settings; 
  43.  
  44. public function display_advanced_settings() { 
  45. //TODO move this to a view 
  46. ?> 
  47. <a href="#" class="button-primary nf-reset-form-conversion"><?php _e( 'Reset Form Conversion', 'ninja-forms' ); ?></a> 
  48. <p class="description"> 
  49. <?php _e( 'If your forms are "missing" after updating to 2.9, this button will attempt to reconvert your old forms to show them in 2.9. All current forms will remain in the "All Forms" table.', 'ninja-forms' ); ?> 
  50. </p> 
  51.  
  52. <div id="nf-conversion-reset"> 
  53. <p> 
  54. <?php _e( 'All current forms will remain in the "All Forms" table. In some cases some forms may be duplicated during this process.', 'ninja-forms' ); ?> 
  55. </p> 
  56. </div> 
  57.  
  58. <div id="nf-conversion-reset-buttons"> 
  59. <div id="nf-admin-modal-cancel"> 
  60. <a class="submitdelete deletion modal-close" href="#"><?php _e( 'Cancel', 'ninja-forms' ); ?></a> 
  61. </div> 
  62. <div id="nf-admin-modal-update"> 
  63. <a class="button-primary" href="<?php echo site_url('wp-admin/index.php?page=ninja-forms-conversion-reset'); ?>"><?php _e( 'Continue', 'ninja-forms' ); ?></a> 
  64. </div> 
  65. </div> 
  66. <?php 
  67.  
  68. } // End Ninja_Forms_View_Admin Class