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
230           return new WP_Error('invalid_key', __('Invalid key'));
231
232      $user = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->users WHERE user_activation_key = %s AND user_login = %s", $key, $login));
233      if ( empty( $user ) )
234           return new WP_Error('invalid_key', __('Invalid key'));
235
236      // Generate something random for a password...
237      $new_pass = wp_generate_password();
238
239      do_action('password_reset', $user, $new_pass);
240
241      wp_set_password($new_pass, $user->ID);
242      update_user_option($user->ID, 'default_password_nag', true, true); //Set up the Password change nag.
243      $message  = sprintf(__('Username: %s'), $user->user_login) . "\r\n";
244      $message .= sprintf(__('Password: %s'), $new_pass) . "\r\n";
245      $message .= site_url('wp-login.php', 'login') . "\r\n";
246
247      if ( is_multisite() )
248           $blogname = $GLOBALS['current_site']->site_name;