Hi, I am trying to write a function to allow users to change there password from the front end of my site. Since I last worked with the login system it looks like wordpress has changed from md5 encryption. Anyone have any idea what encryption is being used? or better yet the function that creates these passwords? (not wp_generate_password) Thanks!
Use this <?php require_once( 'wp-load.php' ); require_once( 'wp-includes/wp-db.php'); require_once( 'wp-includes/registration.php'); function change_password($userdata) { $ID = (int) $userdata['ID']; $user = get_userdata($ID); $user = add_magic_quotes(get_object_vars($user)); if ( ! empty($userdata['user_pass']) ) { $plaintext_pass = $userdata['user_pass']; $userdata['user_pass'] = wp_hash_password($userdata['user_pass']); } wp_cache_delete($user[ 'user_email' ], 'useremail'); $userdata = array_merge($user, $userdata); $user_id = wp_insert_user($userdata); $current_user = wp_get_current_user(); if ( $current_user->id == $ID ) { if ( isset($plaintext_pass) ) { wp_clear_auth_cookie(); wp_set_auth_cookie($ID); } } return 'Password changed'; } //set the parameters for the user you want to change the password (ID and new password) $user['ID'] = 1; $user['user_pass'] = '123456'; echo change_password($user); ?> I assumed that above script will be placed in the root of your wordpress folder .. if you want to place the script in another area.. please be sure that the paths in require_once function get updated as well. I hope this one helps.