WordPress Reset - Version 1.2

Version Description

(2010-04-04: = * Updates to fix deprecated notices for WP 3.0 * Updates for 3.0 to disable password nag * Modify new blog email to not include the generated password

Download this release

Release Info

Developer sivel
Plugin Icon WordPress Reset
Version 1.2
Comparing to
See all releases

Code changes from version 1.1 to 1.2

Files changed (2) hide show
  1. readme.txt +12 -3
  2. wordpress-reset.php +17 -4
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: sivel, jdingman
3
  Donate Link: http://sivel.net/donate
4
  Tags: wordpress-reset, wordpress, reset, admin
5
  Requires at least: 2.7
6
- Tested up to: 2.9
7
- Stable tag: 1.1
8
 
9
  Resets the WordPress database back to it's defaults. Deletes all customizations and content. Does not modify files only resets the database.
10
 
@@ -42,9 +42,18 @@ Open the wordpress-reset.php file in an editor and modify the line that reads `v
42
  1. Visit the WordPress Reset Tools page by either clicking the link in the favorites dropdown menu or Tools>WordPress Reset
43
  1. Type 'reset' in the text field and click reset.
44
 
 
 
 
 
45
  == Changelog ==
46
 
47
- = 1.1 (2009-10-01) =
 
 
 
 
 
48
  * WordPress 2.8 Updates, do not show auto generated password nag after reset
49
 
50
  = 1.0 (2009-03-17): =
3
  Donate Link: http://sivel.net/donate
4
  Tags: wordpress-reset, wordpress, reset, admin
5
  Requires at least: 2.7
6
+ Tested up to: 3.0
7
+ Stable tag: 1.2
8
 
9
  Resets the WordPress database back to it's defaults. Deletes all customizations and content. Does not modify files only resets the database.
10
 
42
  1. Visit the WordPress Reset Tools page by either clicking the link in the favorites dropdown menu or Tools>WordPress Reset
43
  1. Type 'reset' in the text field and click reset.
44
 
45
+ == Upgrade Notice ==
46
+
47
+ This release fixes deprecated notices for WordPress 3.0, correctly disables the password nag and removes the randomly generate password from the new blog email.
48
+
49
  == Changelog ==
50
 
51
+ = 1.2 (2010-04-04: =
52
+ * Updates to fix deprecated notices for WP 3.0
53
+ * Updates for 3.0 to disable password nag
54
+ * Modify new blog email to not include the generated password
55
+
56
+ = 1.1 (2009-10-01): =
57
  * WordPress 2.8 Updates, do not show auto generated password nag after reset
58
 
59
  = 1.0 (2009-03-17): =
wordpress-reset.php CHANGED
@@ -4,10 +4,10 @@ Plugin Name: WordPress Reset
4
  Plugin URI: http://sivel.net/wordpress/wordpress-reset/
5
  Description: Resets the WordPress database back to it's defaults. Deletes all customizations and content. Does not modify files only resets the database.
6
  Author: Matt Martz
7
- Version: 1.1
8
  Author URI: http://sivel.net/
9
 
10
- Copyright (c) 2009 Matt Martz (http://sivel.net)
11
  WordPress Reset is released under the GNU General Public License (GPL)
12
  http://www.gnu.org/licenses/gpl-2.0.txt
13
  */
@@ -26,6 +26,7 @@ class WordPressReset {
26
  add_action('admin_head', array(&$this, 'head'));
27
  add_action('init', array(&$this, 'init'));
28
  add_filter('favorite_actions', array(&$this, 'favorites'), 100);
 
29
  }
30
 
31
  // favorite_actions filter hook operations
@@ -64,8 +65,13 @@ class WordPressReset {
64
  $query = $wpdb->prepare("UPDATE $wpdb->users SET user_pass = %s, user_activation_key = '' WHERE ID = %d", $user->user_pass, $user_id);
65
  $wpdb->query($query);
66
 
67
- if ( get_usermeta($user_id, 'default_password_nag') )
68
- update_usermeta($user_id, 'default_password_nag', false);
 
 
 
 
 
69
 
70
  if ( $this->auto_reactivate == true )
71
  update_option('active_plugins', array(plugin_basename(__FILE__)));
@@ -84,6 +90,13 @@ class WordPressReset {
84
  }
85
  }
86
 
 
 
 
 
 
 
 
87
  // admin_head action hook operations
88
  // Enqueue jQuery to the head
89
  function head() {
4
  Plugin URI: http://sivel.net/wordpress/wordpress-reset/
5
  Description: Resets the WordPress database back to it's defaults. Deletes all customizations and content. Does not modify files only resets the database.
6
  Author: Matt Martz
7
+ Version: 1.2
8
  Author URI: http://sivel.net/
9
 
10
+ Copyright (c) 2009-2010 Matt Martz (http://sivel.net)
11
  WordPress Reset is released under the GNU General Public License (GPL)
12
  http://www.gnu.org/licenses/gpl-2.0.txt
13
  */
26
  add_action('admin_head', array(&$this, 'head'));
27
  add_action('init', array(&$this, 'init'));
28
  add_filter('favorite_actions', array(&$this, 'favorites'), 100);
29
+ add_filter('wp_mail', array(&$this, 'hijack_mail'), 1);
30
  }
31
 
32
  // favorite_actions filter hook operations
65
  $query = $wpdb->prepare("UPDATE $wpdb->users SET user_pass = %s, user_activation_key = '' WHERE ID = %d", $user->user_pass, $user_id);
66
  $wpdb->query($query);
67
 
68
+ $get_user_meta = function_exists('get_user_meta') ? 'get_user_meta' : 'get_usermeta';
69
+ $update_user_meta = function_exists('update_user_meta') ? 'update_user_meta' : 'update_usermeta';
70
+
71
+ if ( $get_user_meta($user_id, 'default_password_nag') )
72
+ $update_user_meta($user_id, 'default_password_nag', false);
73
+ if ( $get_user_meta($user_id, $wpdb->prefix . 'default_password_nag') )
74
+ $update_user_meta($user_id, $wpdb->prefix . 'default_password_nag', false);
75
 
76
  if ( $this->auto_reactivate == true )
77
  update_option('active_plugins', array(plugin_basename(__FILE__)));
90
  }
91
  }
92
 
93
+ // Overwrite the password, because we actually reset it after this email goes out
94
+ function hijack_mail($args) {
95
+ if ( stristr($args['message'], 'Your new WordPress blog has been successfully set up at') )
96
+ $args['message'] = preg_replace('/Password:.+/', 'Password: Previously specified password', $args['message']);
97
+ return $args;
98
+ }
99
+
100
  // admin_head action hook operations
101
  // Enqueue jQuery to the head
102
  function head() {