Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: password_reset

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

Line Code
127
128      // Generate something random for a password... md5'ing current time with a rand salt
129      $key = $_GET['key'];
130      if ( empty($key) )
131           die( __('Sorry, that key does not appear to be valid.') );
132      $user = $wpdb->get_row("SELECT * FROM $wpdb->users WHERE user_activation_key = '$key'");
133      if ( !$user )
134           die( __('Sorry, that key does not appear to be valid.') );
135
136      do_action('password_reset');
137
138      $new_pass = substr( md5( uniqid( microtime() ) ), 0, 7);
139       $wpdb->query("UPDATE $wpdb->users SET user_pass = MD5('$new_pass'), user_activation_key = '' WHERE user_login = '$user->user_login'");
140      $message  = sprintf(__('Username: %s'), $user->user_login) . "\r\n";
141      $message .= sprintf(__('Password: %s'), $new_pass) . "\r\n";
142      $message .= get_settings('siteurl') . "/wp-login.php\r\n";
143
144      $m = wp_mail($user->user_email, sprintf(__('[%s] Your new password'), get_settings('blogname')), $message);
145