diff --git wp-includes/user.php wp-includes/user.php
index cd4b01d..5214e09 100644
|
|
function wp_insert_user($userdata) { |
1543 | 1543 | * @return int The updated user's ID. |
1544 | 1544 | */ |
1545 | 1545 | function wp_update_user($userdata) { |
1546 | | $ID = (int) $userdata['ID']; |
1547 | | |
1548 | | // First, get all of the original fields |
1549 | | $user = get_userdata($ID); |
| 1546 | if ( empty( $userdata['ID'] ) ) { |
| 1547 | $user = array(); |
| 1548 | } else { |
| 1549 | $ID = (int) $userdata['ID']; |
1550 | 1550 | |
1551 | | // Escape data pulled from DB. |
1552 | | $user = add_magic_quotes(get_object_vars($user)); |
| 1551 | // Escape data pulled from DB. |
| 1552 | $user = add_magic_quotes(get_object_vars($user)); |
| 1553 | wp_cache_delete($user[ 'user_email' ], 'useremail'); |
| 1554 | } |
1553 | 1555 | |
1554 | 1556 | // If password is changing, hash it now. |
1555 | 1557 | if ( ! empty($userdata['user_pass']) ) { |
… |
… |
function wp_update_user($userdata) { |
1557 | 1559 | $userdata['user_pass'] = wp_hash_password($userdata['user_pass']); |
1558 | 1560 | } |
1559 | 1561 | |
1560 | | wp_cache_delete($user[ 'user_email' ], 'useremail'); |
1561 | | |
1562 | 1562 | // Merge old and new fields with new fields overwriting old ones. |
1563 | 1563 | $userdata = array_merge($user, $userdata); |
1564 | 1564 | $user_id = wp_insert_user($userdata); |
1565 | 1565 | |
1566 | 1566 | // Update the cookies if the password changed. |
1567 | 1567 | $current_user = wp_get_current_user(); |
1568 | | if ( $current_user->id == $ID ) { |
| 1568 | if ( $current_user->id == $user_id ) { |
1569 | 1569 | if ( isset($plaintext_pass) ) { |
1570 | 1570 | wp_clear_auth_cookie(); |
1571 | | wp_set_auth_cookie($ID); |
| 1571 | wp_set_auth_cookie($user_id); |
1572 | 1572 | } |
1573 | 1573 | } |
1574 | 1574 | |