diff --git src/wp-includes/user.php src/wp-includes/user.php
index 41eccf7..6d473ef 100644
|
|
function validate_username( $username ) { |
1346 | 1346 | * @since 2.0.0 |
1347 | 1347 | * @since 3.6.0 The `aim`, `jabber`, and `yim` fields were removed as default user contact |
1348 | 1348 | * methods for new installs. See wp_get_user_contact_methods(). |
1349 | | * @since 4.7.0 The `import_id` field was added to suggest the User ID. |
1350 | 1349 | * |
1351 | 1350 | * @global wpdb $wpdb WordPress database abstraction object. |
1352 | 1351 | * |
… |
… |
function validate_username( $username ) { |
1381 | 1380 | * @type string|bool $show_admin_bar_front Whether to display the Admin Bar for the user on the |
1382 | 1381 | * site's front end. Default true. |
1383 | 1382 | * @type string $role User's role. |
1384 | | * @type int $import_id Suggested Uer ID, use it if not already present. |
1385 | 1383 | * } |
1386 | 1384 | * @return int|WP_Error The newly created user's ID or a WP_Error object if the user could not |
1387 | 1385 | * be created. |
… |
… |
function wp_insert_user( $userdata ) { |
1598 | 1596 | |
1599 | 1597 | $user_nicename_check = $wpdb->get_var( $wpdb->prepare("SELECT ID FROM $wpdb->users WHERE user_nicename = %s AND user_login != %s LIMIT 1" , $user_nicename, $user_login)); |
1600 | 1598 | |
1601 | | $import_id = empty( $userdata['import_id'] ) ? 0 : $userdata['import_id']; |
1602 | | |
1603 | 1599 | if ( $user_nicename_check ) { |
1604 | 1600 | $suffix = 2; |
1605 | 1601 | while ($user_nicename_check) { |
… |
… |
function wp_insert_user( $userdata ) { |
1622 | 1618 | $wpdb->update( $wpdb->users, $data, compact( 'ID' ) ); |
1623 | 1619 | $user_id = (int) $ID; |
1624 | 1620 | } else { |
1625 | | // If there is a suggested ID, use it if not already present. |
1626 | | if ( ! empty( $import_id ) ) { |
1627 | | $import_id = (int) $import_id; |
1628 | | if ( ! $wpdb->get_var( $wpdb->prepare("SELECT ID FROM $wpdb->users WHERE ID = %d", $import_id) ) ) { |
1629 | | $data['ID'] = $import_id; |
1630 | | } |
1631 | | } |
1632 | 1621 | $wpdb->insert( $wpdb->users, $data + compact( 'user_login' ) ); |
1633 | 1622 | $user_id = (int) $wpdb->insert_id; |
1634 | 1623 | } |