diff --git a/wp-includes/user.php b/wp-includes/user.php
index 2bb4e0543..9f77672ab 100644
a
|
b
|
function wp_insert_user( $userdata ) { |
1637 | 1637 | $compacted = compact( 'user_pass', 'user_email', 'user_url', 'user_nicename', 'display_name', 'user_registered' ); |
1638 | 1638 | $data = wp_unslash( $compacted ); |
1639 | 1639 | |
| 1640 | if ( ! $update ) { |
| 1641 | $data = $data + compact( 'user_login' ); |
| 1642 | } |
| 1643 | |
| 1644 | /** |
| 1645 | * Filters user's data before the record is created or updated. |
| 1646 | * |
| 1647 | * It only includes data in Users table wp_user, not including any user metadata. |
| 1648 | * |
| 1649 | * @since 4.7.x |
| 1650 | * |
| 1651 | * @param array $data { |
| 1652 | * Values and keys for the user. |
| 1653 | * |
| 1654 | * @type string $user_login The user's login. Only included if $update == false |
| 1655 | * @type string $user_pass The user's password. |
| 1656 | * @type string $user_email The user's email. |
| 1657 | * @type string $user_url The user's url. |
| 1658 | * @type string $user_nicename The user's nice name. Defaults to a URL-safe version of user's login |
| 1659 | * @type string $display_name The user's display name. |
| 1660 | * @type string $user_registered MySQL timestamp describing the moment when the user registered. Defaults to |
| 1661 | * the current UTC timestamp. |
| 1662 | * } |
| 1663 | * @param bool $update Whether the user is being updated rather than created. |
| 1664 | * @param int|null $id ID of the user to be updated, or NULL if the user is being created |
| 1665 | */ |
| 1666 | $data = apply_filters( 'wp_pre_insert_user_data', $data, $update, $update ? (int) $ID : null ); |
| 1667 | |
1640 | 1668 | if ( $update ) { |
1641 | 1669 | if ( $user_email !== $old_user_data->user_email ) { |
1642 | 1670 | $data['user_activation_key'] = ''; |
… |
… |
function wp_insert_user( $userdata ) { |
1644 | 1672 | $wpdb->update( $wpdb->users, $data, compact( 'ID' ) ); |
1645 | 1673 | $user_id = (int) $ID; |
1646 | 1674 | } else { |
1647 | | $wpdb->insert( $wpdb->users, $data + compact( 'user_login' ) ); |
| 1675 | $wpdb->insert( $wpdb->users, $data ); |
1648 | 1676 | $user_id = (int) $wpdb->insert_id; |
1649 | 1677 | } |
1650 | 1678 | |