Zmiana hasła
request );
$full_path=add_query_arg( $wp->query_vars, home_url( $wp->request ) );
if (isset($_POST[’submit_update’])) {
$currentpassword = $_POST[’currentpassword’];
$newpassword = $_POST[’newpassword’];
$confirmpassword = $_POST[’confirmpassword’];
$empty_new_pw = empty($newpassword) || empty($confirmpassword);
require_once ABSPATH . 'wp-includes/class-phpass.php’;
$wp_hasher = new PasswordHash( 8, true );
$user = wp_get_current_user();
$password_changed_ok = false;
$invalid_password = false;
$passwords_dont_match = ($newpassword != $confirmpassword);
//$newpasswordhash = wp_hash_password($currentpassword);
if ($passwords_dont_match || $empty_new_pw) {
// empty on purpose
} else if ( wp_check_password( $currentpassword, $user->user_pass, $user->ID ) ) {
wp_set_password($newpassword, $user->ID);
$userid=$user->ID;
// $user = wp_signon(array(’user_login’ => $user->user_login, 'user_password’ => $newpassword));
$userdata[’ID’] = $userid; //user ID
$userdata[’user_pass’] = $newpassword;
wp_update_user( $userdata );
$password_changed_ok = true;
} else {
$invalid_password = true;
}
}
?>