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
116      $key = preg_replace('/[^a-z0-9]/i', '', $key);
117
118      if ( empty( $key ) )
119           return new WP_Error('invalid_key', __('Invalid key'));
120
121      $user = $wpdb->get_row("SELECT * FROM $wpdb->users WHERE user_activation_key = '$key'");
122      if ( empty( $user ) )
123           return new WP_Error('invalid_key', __('Invalid key'));
124
125      do_action('password_reset', $user);
126
127      // Generate something random for a password...
128      $new_pass = wp_generate_password();
129      wp_set_password($new_pass, $user->ID);
130      $message  = sprintf(__('Username: %s'), $user->user_login) . "\r\n";
131      $message .= sprintf(__('Password: %s'), $new_pass) . "\r\n";
132      $message .= get_option('siteurl') . "/wp-login.php\r\n";
133
134      if (  !wp_mail($user->user_email, sprintf(__('[%s] Your new password'), get_option('blogname')), $message) )