Version Description
- 2018/06/19
- WebFactory took over development
- bug fixes
- rate plugin box
- new logo
- 40k installs, 256k downloads
Download this release
Release Info
Developer | WebFactory |
Plugin | Reset WP |
Version | 1.3 |
Comparing to | |
See all releases |
Code changes from version 1.2 to 1.3
- readme.txt +60 -42
- reset-wp.php +92 -82
- screenshot-1.png +0 -0
- screenshot-2.png +0 -0
- screenshot-3.png +0 -0
readme.txt
CHANGED
@@ -1,71 +1,89 @@
|
|
1 |
-
=== Reset WP ===
|
2 |
-
Contributors:
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
Requires
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
|
|
11 |
|
12 |
== Description ==
|
13 |
|
14 |
-
|
|
|
|
|
15 |
|
16 |
-
*
|
17 |
-
*
|
18 |
-
*
|
19 |
-
*
|
|
|
|
|
|
|
|
|
20 |
|
21 |
Usage :
|
22 |
|
23 |
-
1.
|
24 |
-
2.
|
25 |
-
3. "
|
|
|
|
|
26 |
|
27 |
== Installation ==
|
28 |
|
29 |
-
|
30 |
-
|
31 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
|
33 |
== Screenshots ==
|
34 |
|
35 |
1. Admin page screenshot
|
36 |
-
2. Admin page screenshot for reset confirmation.
|
37 |
-
3. Admin page screenshot for reset confirmation.
|
38 |
|
39 |
-
==
|
40 |
|
41 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
|
43 |
-
1.
|
44 |
-
|
45 |
-
3. "Dashboard"->"Tools"->"Reset WP"
|
46 |
|
47 |
-
|
|
|
48 |
|
49 |
= 1.0 =
|
|
|
50 |
* Initial release.
|
51 |
|
52 |
-
= 1.1 =
|
53 |
-
* Small Fix in $wpdb->prepare query. Compatible with WordPress Version 4.8.1
|
54 |
|
55 |
-
|
56 |
-
* Compatible with WordPress Version 4.9.5
|
57 |
|
58 |
-
|
59 |
|
60 |
-
|
61 |
-
* Initial release.
|
62 |
|
63 |
-
=
|
64 |
-
* Small Fix in $wpdb->prepare query. Compatible with WordPress Version 4.8.1
|
65 |
|
66 |
-
|
67 |
-
* Compatible with WordPress Version 4.9.5
|
68 |
|
69 |
-
|
70 |
|
71 |
-
|
1 |
+
=== Reset WP - Easiest WordPress Reset Plugin ===
|
2 |
+
Contributors: WebFactory, WPreset
|
3 |
+
Tags: reset wp, reset wordpress, wordpress reset, wp reset, reset, restart wordpress, clean wordpress, clean database, restart, reset database, default wordpress, developer
|
4 |
+
Requires at least: 4.0
|
5 |
+
Tested up to: 4.9
|
6 |
+
Requires PHP: 5.2
|
7 |
+
Stable tag: 1.3
|
8 |
+
License: GPLv2 or later
|
9 |
+
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
+
|
11 |
+
Reset WordPress resets the WP database back to the default installation values without deleting or modifying any files.
|
12 |
|
13 |
== Description ==
|
14 |
|
15 |
+
**This plugin has a new home in the WordPress repo - <a href="https://wordpress.org/plugins/wp-reset/">wordpress.org/plugins/wp-reset/</a> - Please download it from there. Thank you!**
|
16 |
+
|
17 |
+
<a href="https://wpreset.com/?utm_source=wordpressorg&utm_medium=content&utm_campaign=reset-wp&utm_term=reset%20wordpress">Reset WordPress</a> resets the WP database back to the default installation values without deleting or modifying any files. It's fast and safe to use and an ideal tool for testing during WP development.
|
18 |
|
19 |
+
* plugin's page is accessed through the Tools menu or via the main home menu
|
20 |
+
* no files are touched; plugins, themes, uploads, content - everything stays as is
|
21 |
+
* database is wiped clean and restored to default installation values
|
22 |
+
* custom tables with the prefixed defined in wp-config are removed as well, other tables are left untouched
|
23 |
+
* takes less than 5 seconds to reset even the largest sites
|
24 |
+
* 2 fail-safe mechanisms are built-in so you can't "reset accidentally"
|
25 |
+
* very handy for plugin and theme developers
|
26 |
+
* more info is available on <a href="https://wpreset.com/?utm_source=wordpressorg&utm_medium=content&utm_campaign=reset-wp&utm_term=wpreset.com">WPreset.com</a>
|
27 |
|
28 |
Usage :
|
29 |
|
30 |
+
1. Plugin is page is in Dashboard -> Tools -> Reset WP
|
31 |
+
2. Enter "reset" in the confirmation box
|
32 |
+
3. Confirm again with "OK"
|
33 |
+
4. Wait till the process is done
|
34 |
+
5. Done. You're back in the dashboard logged in with the same account as before
|
35 |
|
36 |
== Installation ==
|
37 |
|
38 |
+
Follow the standard routine;
|
39 |
+
|
40 |
+
1. Open WordPress admin, go to Plugins, click Add New
|
41 |
+
2. Enter "reset wp" in search and hit Enter
|
42 |
+
3. Plugin will show up as the first on the list, click "Install Now"
|
43 |
+
4. Activate & open plugin's settings page located under the Tools menu
|
44 |
+
|
45 |
+
Or if needed, upload manually;
|
46 |
+
|
47 |
+
1. Download the plugin.
|
48 |
+
2. Unzip it and upload to _/wp-content/plugins/_
|
49 |
+
3. Open WordPress admin - Plugins and click "Activate" next to the plugin
|
50 |
+
4. Activate & open plugin's settings page located under the Tools menu
|
51 |
|
52 |
== Screenshots ==
|
53 |
|
54 |
1. Admin page screenshot
|
|
|
|
|
55 |
|
56 |
+
== Changelog ==
|
57 |
|
58 |
+
= 1.3 =
|
59 |
+
* 2018/06/19
|
60 |
+
* WebFactory took over development
|
61 |
+
* bug fixes
|
62 |
+
* rate plugin box
|
63 |
+
* new logo
|
64 |
+
* 40k installs, 256k downloads
|
65 |
|
66 |
+
= 1.2 =
|
67 |
+
* Compatible with WordPress Version 4.9
|
|
|
68 |
|
69 |
+
= 1.1 =
|
70 |
+
* Small Fix in $wpdb->prepare query. Compatible with WordPress Version 4.8.1
|
71 |
|
72 |
= 1.0 =
|
73 |
+
* 2015/12/01
|
74 |
* Initial release.
|
75 |
|
|
|
|
|
76 |
|
77 |
+
== Frequently Asked Questions ==
|
|
|
78 |
|
79 |
+
= How can I log in after resetting? =
|
80 |
|
81 |
+
Use the same username and password you used while doing the reset. Only one user will be restored after resetting. The one you used at that time.
|
|
|
82 |
|
83 |
+
= Will any files be deleted or modified? =
|
|
|
84 |
|
85 |
+
No. No files are touched.
|
|
|
86 |
|
87 |
+
= Will I have to edit wp-config.php after resetting? =
|
88 |
|
89 |
+
No editing is needed as no files are modified.
|
reset-wp.php
CHANGED
@@ -1,12 +1,12 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
Plugin Name: Reset WP
|
4 |
-
Plugin URI:
|
5 |
-
Description:
|
6 |
-
Version: 1.
|
7 |
-
Author:
|
8 |
-
Author URI:
|
9 |
-
Text Domain:
|
10 |
*/
|
11 |
|
12 |
/*
|
@@ -24,31 +24,37 @@ if ( ! defined( 'ABSPATH' ) ){
|
|
24 |
|
25 |
if ( is_admin() ) {
|
26 |
|
|
|
27 |
define( 'REACTIVATE_THE_RESET_WP', true );
|
28 |
|
29 |
class ResetWP {
|
|
|
30 |
|
31 |
-
function
|
32 |
-
add_action( 'admin_menu', array(
|
33 |
-
add_action( 'admin_init', array(
|
34 |
-
add_filter( 'favorite_actions', array(
|
35 |
-
add_action( 'wp_before_admin_bar_render', array(
|
|
|
36 |
}
|
37 |
|
38 |
// Checks reset_wp post value and performs an installation, adding the users previous password also
|
39 |
function admin_init() {
|
40 |
-
global $current_user;
|
41 |
|
42 |
$reset_wp = ( isset( $_POST['reset_wp'] ) && $_POST['reset_wp'] == 'true' ) ? true : false;
|
43 |
-
$reset_wp_confirm = ( isset( $_POST['reset_wp_confirm'] ) && $_POST['reset_wp_confirm'] == 'reset
|
44 |
$valid_nonce = ( isset( $_POST['_wpnonce'] ) && wp_verify_nonce( $_POST['_wpnonce'], 'reset_wp' ) ) ? true : false;
|
45 |
|
46 |
if ( $reset_wp && $reset_wp_confirm && $valid_nonce ) {
|
47 |
-
require_once( ABSPATH . '/wp-admin/includes/upgrade.php' );
|
48 |
|
49 |
$blogname = get_option( 'blogname' );
|
50 |
$admin_email = get_option( 'admin_email' );
|
51 |
$blog_public = get_option( 'blog_public' );
|
|
|
|
|
|
|
52 |
|
53 |
if ( $current_user->user_login != 'admin' )
|
54 |
$user = get_user_by( 'login', 'admin' );
|
@@ -56,33 +62,28 @@ class ResetWP {
|
|
56 |
if ( empty( $user->user_level ) || $user->user_level < 10 )
|
57 |
$user = $current_user;
|
58 |
|
59 |
-
global $wpdb;
|
60 |
-
|
61 |
$prefix = str_replace( '_', '\_', $wpdb->prefix );
|
62 |
$tables = $wpdb->get_col( "SHOW TABLES LIKE '{$prefix}%'" );
|
63 |
foreach ( $tables as $table ) {
|
64 |
$wpdb->query( "DROP TABLE $table" );
|
65 |
}
|
66 |
|
67 |
-
$result = wp_install( $blogname, $
|
68 |
-
|
69 |
|
70 |
-
|
71 |
-
$query = $wpdb->prepare( "UPDATE $wpdb->users SET user_pass = '".$user->user_pass."', user_activation_key = '' WHERE ID = '".$user_id."' ");
|
72 |
-
*/
|
73 |
-
|
74 |
-
$query = $wpdb->prepare( "UPDATE $wpdb->users SET user_pass = '%s' , user_activation_key = '' WHERE ID = '%d' " , $user->user_pass, $user_id );
|
75 |
-
|
76 |
$wpdb->query( $query );
|
77 |
|
78 |
-
|
79 |
-
|
80 |
|
81 |
-
if (
|
82 |
-
|
|
|
|
|
|
|
|
|
83 |
|
84 |
-
if ( $get_user_meta( $user_id, $wpdb->prefix . 'default_password_nag' ) )
|
85 |
-
$update_user_meta( $user_id, $wpdb->prefix . 'default_password_nag', false );
|
86 |
|
87 |
|
88 |
if ( defined( 'REACTIVATE_THE_RESET_WP' ) && REACTIVATE_THE_RESET_WP === true )
|
@@ -90,23 +91,43 @@ class ResetWP {
|
|
90 |
|
91 |
|
92 |
wp_clear_auth_cookie();
|
93 |
-
|
94 |
wp_set_auth_cookie( $user_id );
|
95 |
|
96 |
wp_redirect( admin_url()."?reset-wp=reset-wp" );
|
97 |
exit();
|
98 |
}
|
99 |
|
100 |
-
if ( array_key_exists( 'reset-wp', $_GET ) && stristr( $_SERVER['HTTP_REFERER'], 'reset-wp' ) )
|
101 |
-
add_action( 'admin_notices', array(
|
|
|
102 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
103 |
|
104 |
// admin_menu action hook operations & Add the settings page
|
105 |
function add_page() {
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
add_action( "admin_footer-{$hook}", array( &$this, 'footer_javascript' ) );
|
110 |
}
|
111 |
|
112 |
function add_favorite( $actions ) {
|
@@ -128,30 +149,32 @@ class ResetWP {
|
|
128 |
|
129 |
// Inform the user that WordPress has been successfully reset
|
130 |
function admin_notices_successfully_reset() {
|
131 |
-
$
|
132 |
-
|
133 |
-
|
|
|
134 |
}
|
135 |
|
136 |
function admin_javascript() {
|
137 |
-
|
|
|
|
|
138 |
}
|
139 |
|
140 |
function footer_javascript() {
|
141 |
?>
|
142 |
<script type="text/javascript">
|
143 |
jQuery('#reset_wp_submit').click(function(){
|
144 |
-
if ( jQuery('#reset_wp_confirm').val() == 'reset
|
145 |
-
var message = '
|
146 |
var reset = confirm(message);
|
147 |
if ( reset ) {
|
148 |
jQuery('#reset_wp_form').submit();
|
149 |
} else {
|
150 |
-
jQuery('#reset_wp').val('false');
|
151 |
return false;
|
152 |
}
|
153 |
} else {
|
154 |
-
alert('Invalid confirmation. Please type \'reset
|
155 |
return false;
|
156 |
}
|
157 |
});
|
@@ -162,52 +185,39 @@ class ResetWP {
|
|
162 |
// add_option_page callback operations
|
163 |
function admin_page() {
|
164 |
global $current_user;
|
|
|
165 |
if ( isset( $_POST['reset_wp_confirm'] ) && $_POST['reset_wp_confirm'] != 'reset-wp' )
|
166 |
echo '<div class="error fade"><p><strong>Invalid confirmation. Please type \'reset-wp\' in the confirmation field.</strong></p></div>';
|
167 |
elseif ( isset( $_POST['_wpnonce'] ) )
|
168 |
echo '<div class="error fade"><p><strong>Invalid wpnonce. Please try again.</strong></p></div>';
|
169 |
|
170 |
?>
|
171 |
-
<div class="wrap"
|
172 |
-
<div id="icon-tools" class="icon32"><br /></div>
|
173 |
<h2>Reset WP</h2>
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
<?php if ( ! isset( $admin->user_login ) || $admin->user_level < 10 ) : $user = $current_user; ?>
|
178 |
-
<p>The 'admin' user does not exist. The user '<strong><?php echo esc_html( $user->user_login ); ?></strong>' will be recreated with its <strong>current password</strong> with user level 10.</p>
|
179 |
-
<?php else : ?>
|
180 |
-
|
181 |
-
<p>The '<strong>admin</strong>' user exists and will be recreated with its <strong>current password</strong>.</p>
|
182 |
-
<?php endif; ?>
|
183 |
-
<p>This plugin <strong>will be automatically reactivated</strong> after the reset operation.</p>
|
184 |
-
|
185 |
-
<hr/>
|
186 |
-
|
187 |
-
<p>To confirm the reset operation, type '<strong>reset-wp</strong>' in the confirmation field below and then click the Reset button</p>
|
188 |
-
<form id="reset_wp_form" action="" method="post" autocomplete="off">
|
189 |
-
<?php wp_nonce_field( 'reset_wp' ); ?>
|
190 |
-
<input id="reset_wp" type="hidden" name="reset_wp" value="true" />
|
191 |
-
<input id="reset_wp_confirm" type="text" name="reset_wp_confirm" value="" maxlength="8" />
|
192 |
-
<input id="reset_wp_submit" style="width: 80px;" type="submit" name="Submit" class="button-primary" value="Reset" />
|
193 |
|
194 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
195 |
</div>
|
196 |
-
<table class="widefat" style="width:40%">
|
197 |
-
<thead>
|
198 |
-
<tr>
|
199 |
-
<th><strong>Note</strong></th>
|
200 |
-
</tr>
|
201 |
-
</thead>
|
202 |
-
<tbody id="the-list">
|
203 |
-
<tr>
|
204 |
-
<td>
|
205 |
-
If you enjoy this plugin,<br/> please give it 5 stars on WordPress:
|
206 |
-
<a title="Reset WP" target="_blank" href="https://wordpress.org/support/view/plugin-reviews/reset-wp">Rate the plugin</a>
|
207 |
-
</td>
|
208 |
-
</tr>
|
209 |
-
</tbody>
|
210 |
-
</table>
|
211 |
<?php
|
212 |
}
|
213 |
}
|
1 |
<?php
|
2 |
/*
|
3 |
Plugin Name: Reset WP
|
4 |
+
Plugin URI: https://wpreset.com
|
5 |
+
Description: Reset the WordPress database to the default installation values including all content and customizations. Only the database is reset. No files are modified or deleted.
|
6 |
+
Version: 1.3
|
7 |
+
Author: WebFactory Ltd
|
8 |
+
Author URI: https://www.webfactoryltd.com/
|
9 |
+
Text Domain: reset-wp
|
10 |
*/
|
11 |
|
12 |
/*
|
24 |
|
25 |
if ( is_admin() ) {
|
26 |
|
27 |
+
// todo: rename constant
|
28 |
define( 'REACTIVATE_THE_RESET_WP', true );
|
29 |
|
30 |
class ResetWP {
|
31 |
+
static $version = 1.3;
|
32 |
|
33 |
+
function __construct() {
|
34 |
+
add_action( 'admin_menu', array( $this, 'add_page' ) );
|
35 |
+
add_action( 'admin_init', array( $this, 'admin_init' ) );
|
36 |
+
add_filter( 'favorite_actions', array( $this, 'add_favorite' ), 100 );
|
37 |
+
add_action( 'wp_before_admin_bar_render', array( $this, 'admin_bar_link' ) );
|
38 |
+
add_filter( 'plugin_action_links_' . plugin_basename(__FILE__), array( $this, 'plugin_action_links') );
|
39 |
}
|
40 |
|
41 |
// Checks reset_wp post value and performs an installation, adding the users previous password also
|
42 |
function admin_init() {
|
43 |
+
global $current_user, $wpdb;
|
44 |
|
45 |
$reset_wp = ( isset( $_POST['reset_wp'] ) && $_POST['reset_wp'] == 'true' ) ? true : false;
|
46 |
+
$reset_wp_confirm = ( isset( $_POST['reset_wp_confirm'] ) && $_POST['reset_wp_confirm'] == 'reset' ) ? true : false;
|
47 |
$valid_nonce = ( isset( $_POST['_wpnonce'] ) && wp_verify_nonce( $_POST['_wpnonce'], 'reset_wp' ) ) ? true : false;
|
48 |
|
49 |
if ( $reset_wp && $reset_wp_confirm && $valid_nonce ) {
|
50 |
+
@require_once( ABSPATH . '/wp-admin/includes/upgrade.php' );
|
51 |
|
52 |
$blogname = get_option( 'blogname' );
|
53 |
$admin_email = get_option( 'admin_email' );
|
54 |
$blog_public = get_option( 'blog_public' );
|
55 |
+
$wplang = get_option( 'wplang' );
|
56 |
+
$siteurl = get_option ( 'siteurl' );
|
57 |
+
$home = get_option ( 'home' );
|
58 |
|
59 |
if ( $current_user->user_login != 'admin' )
|
60 |
$user = get_user_by( 'login', 'admin' );
|
62 |
if ( empty( $user->user_level ) || $user->user_level < 10 )
|
63 |
$user = $current_user;
|
64 |
|
|
|
|
|
65 |
$prefix = str_replace( '_', '\_', $wpdb->prefix );
|
66 |
$tables = $wpdb->get_col( "SHOW TABLES LIKE '{$prefix}%'" );
|
67 |
foreach ( $tables as $table ) {
|
68 |
$wpdb->query( "DROP TABLE $table" );
|
69 |
}
|
70 |
|
71 |
+
$result = wp_install( $blogname, $current_user->user_login, $current_user->user_email, $blog_public, '', '', $wplang);
|
72 |
+
$user_id = $result['user_id'];
|
73 |
|
74 |
+
$query = $wpdb->prepare( "UPDATE {$wpdb->users} SET user_pass = %s, user_activation_key = '' WHERE ID = %d LIMIT 1", array($current_user->user_pass, $user_id));
|
|
|
|
|
|
|
|
|
|
|
75 |
$wpdb->query( $query );
|
76 |
|
77 |
+
update_option('siteurl', $siteurl);
|
78 |
+
update_option('home', $home);
|
79 |
|
80 |
+
if ( get_user_meta( $user_id, 'default_password_nag' ) ) {
|
81 |
+
update_user_meta( $user_id, 'default_password_nag', false );
|
82 |
+
}
|
83 |
+
if ( get_user_meta( $user_id, $wpdb->prefix . 'default_password_nag' ) ) {
|
84 |
+
update_user_meta( $user_id, $wpdb->prefix . 'default_password_nag', false );
|
85 |
+
}
|
86 |
|
|
|
|
|
87 |
|
88 |
|
89 |
if ( defined( 'REACTIVATE_THE_RESET_WP' ) && REACTIVATE_THE_RESET_WP === true )
|
91 |
|
92 |
|
93 |
wp_clear_auth_cookie();
|
|
|
94 |
wp_set_auth_cookie( $user_id );
|
95 |
|
96 |
wp_redirect( admin_url()."?reset-wp=reset-wp" );
|
97 |
exit();
|
98 |
}
|
99 |
|
100 |
+
if ( array_key_exists( 'reset-wp', $_GET ) && stristr( $_SERVER['HTTP_REFERER'], 'reset-wp' ) ) {
|
101 |
+
add_action( 'admin_notices', array( $this, 'admin_notices_successfully_reset' ) );
|
102 |
+
}
|
103 |
}
|
104 |
+
|
105 |
+
// add settings link to plugins page
|
106 |
+
static function plugin_action_links($links) {
|
107 |
+
$settings_link = '<a href="' . admin_url('tools.php?page=reset-wp') . '" title="' . __('Reset WordPress', 'reset-wp') . '">' . __('Reset WordPress', 'reset-wp') . '</a>';
|
108 |
+
|
109 |
+
array_unshift($links, $settings_link);
|
110 |
+
|
111 |
+
return $links;
|
112 |
+
} // plugin_action_links
|
113 |
+
|
114 |
+
|
115 |
+
// test if we're on plugin's page
|
116 |
+
function is_plugin_page() {
|
117 |
+
$current_screen = get_current_screen();
|
118 |
+
|
119 |
+
if ($current_screen->id == 'tools_page_reset-wp') {
|
120 |
+
return true;
|
121 |
+
} else {
|
122 |
+
return false;
|
123 |
+
}
|
124 |
+
} // is_plugin_page
|
125 |
|
126 |
// admin_menu action hook operations & Add the settings page
|
127 |
function add_page() {
|
128 |
+
$hook = add_management_page( 'Reset WP', 'Reset WP', 'administrator', 'reset-wp', array( $this, 'admin_page' ) );
|
129 |
+
add_action( "admin_print_scripts-{$hook}", array( $this, 'admin_javascript' ) );
|
130 |
+
add_action( "admin_footer-{$hook}", array( $this, 'footer_javascript' ) );
|
|
|
131 |
}
|
132 |
|
133 |
function add_favorite( $actions ) {
|
149 |
|
150 |
// Inform the user that WordPress has been successfully reset
|
151 |
function admin_notices_successfully_reset() {
|
152 |
+
global $current_user;
|
153 |
+
|
154 |
+
echo '<div id="message" class="updated"><p><strong>WordPress has been reset successfully.</strong> User "' . $current_user->user_login . '" was recreated with its old password.</p></div>';
|
155 |
+
do_action( 'reset_wp_post', $current_user );
|
156 |
}
|
157 |
|
158 |
function admin_javascript() {
|
159 |
+
if ( $this->is_plugin_page() ) {
|
160 |
+
wp_enqueue_script( 'jquery' );
|
161 |
+
}
|
162 |
}
|
163 |
|
164 |
function footer_javascript() {
|
165 |
?>
|
166 |
<script type="text/javascript">
|
167 |
jQuery('#reset_wp_submit').click(function(){
|
168 |
+
if ( jQuery('#reset_wp_confirm').val() == 'reset' ) {
|
169 |
+
var message = 'Please note - THERE IS NO UNDO!\n\nClicking "OK" will reset your database to the default installation values.\nAll content and customizations will be gone.\nNo files will be modified or deleted.\n\nClick "Cancel" to stop the operation.'
|
170 |
var reset = confirm(message);
|
171 |
if ( reset ) {
|
172 |
jQuery('#reset_wp_form').submit();
|
173 |
} else {
|
|
|
174 |
return false;
|
175 |
}
|
176 |
} else {
|
177 |
+
alert('Invalid confirmation. Please type \'reset\' in the confirmation field.');
|
178 |
return false;
|
179 |
}
|
180 |
});
|
185 |
// add_option_page callback operations
|
186 |
function admin_page() {
|
187 |
global $current_user;
|
188 |
+
|
189 |
if ( isset( $_POST['reset_wp_confirm'] ) && $_POST['reset_wp_confirm'] != 'reset-wp' )
|
190 |
echo '<div class="error fade"><p><strong>Invalid confirmation. Please type \'reset-wp\' in the confirmation field.</strong></p></div>';
|
191 |
elseif ( isset( $_POST['_wpnonce'] ) )
|
192 |
echo '<div class="error fade"><p><strong>Invalid wpnonce. Please try again.</strong></p></div>';
|
193 |
|
194 |
?>
|
195 |
+
<div class="wrap">
|
|
|
196 |
<h2>Reset WP</h2>
|
197 |
+
|
198 |
+
<div class="card">
|
199 |
+
<p><strong>After completing the reset operation, you will be automatically logged in and redirected to the dashboard.</strong></p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
200 |
|
201 |
+
<?php
|
202 |
+
echo '<p>Current user "' . $current_user->user_login . '" will be recreated after resetting with its current password and admin privileges. Reset WP <strong>will be automatically reactivated</strong> after the reset operation.</p>';
|
203 |
+
?>
|
204 |
+
<hr/>
|
205 |
+
|
206 |
+
<p>To confirm the reset operation, type "<strong>reset</strong>" in the confirmation field below and then click the Reset button</p>
|
207 |
+
<form id="reset_wp_form" action="" method="post" autocomplete="off">
|
208 |
+
<?php wp_nonce_field( 'reset_wp' ); ?>
|
209 |
+
<input id="reset_wp" type="hidden" name="reset_wp" value="true">
|
210 |
+
<input id="reset_wp_confirm" style="vertical-align: middle;" type="text" name="reset_wp_confirm" placeholder="Type in 'reset'">
|
211 |
+
<input id="reset_wp_submit" style="vertical-align: middle;" type="submit" name="Submit" class="button-primary" value="Reset">
|
212 |
+
</form>
|
213 |
+
</div>
|
214 |
+
</div>
|
215 |
+
|
216 |
+
<div class="card">
|
217 |
+
<p><b>Please help us keep the plugin going</b></p>
|
218 |
+
<p>If you enjoy this plugin, <b>please rate it on WordPress</b>. It only takes a second and helps us keep the plugin free and maintained.
|
219 |
+
<a title="Reset WP" target="_blank" href="https://wordpress.org/support/plugin/reset-wp/reviews/#new-post">Rate the plugin</a></p>
|
220 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
221 |
<?php
|
222 |
}
|
223 |
}
|
screenshot-1.png
DELETED
Binary file
|
screenshot-2.png
DELETED
Binary file
|
screenshot-3.png
DELETED
Binary file
|