WP hooks navigation: Home/browse • Actions index • Filters index
To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).
The best way to understand what a hook does is to look at where it occurs in the source code.
do_action( "hook_name" )apply_filters( "hook_name", "what_to_filter" ).Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.
| Line | Code |
|---|---|
| 128 | |
| 129 | // Generate something random for a password... md5'ing current time with a rand salt |
| 130 | $key = preg_replace('/[^a-z0-9]/i', '', $_GET['key']); |
| 131 | if ( empty($key) ) |
| 132 | die( __('Sorry, that key does not appear to be valid.') ); |
| 133 | $user = $wpdb->get_row("SELECT * FROM $wpdb->users WHERE user_activation_key = '$key'"); |
| 134 | if ( !$user ) |
| 135 | die( __('Sorry, that key does not appear to be valid.') ); |
| 136 | |
| 137 | do_action('password_reset'); |
| 138 | |
| 139 | $new_pass = substr( md5( uniqid( microtime() ) ), 0, 7); |
| 140 | $wpdb->query("UPDATE $wpdb->users SET user_pass = MD5('$new_pass'), user_activation_key = '' WHERE user_login = '$user->user_login'"); |
| 141 | wp_cache_delete($user->ID, 'users'); |
| 142 | wp_cache_delete($user->user_login, 'userlogins'); |
| 143 | $message = sprintf(__('Username: %s'), $user->user_login) . "\r\n"; |
| 144 | $message .= sprintf(__('Password: %s'), $new_pass) . "\r\n"; |
| 145 | $message .= get_settings('siteurl') . "/wp-login.php\r\n"; |
| 146 | |