WordPress.org

Make WordPress Core

Ticket #37818: 37818.patch

File 37818.patch, 2.0 KB (added by grapplerulrich, 3 years ago)
  • src/wp-includes/user.php

    diff --git src/wp-includes/user.php src/wp-includes/user.php
    index 41eccf7..6d473ef 100644
    function validate_username( $username ) { 
    13461346 * @since 2.0.0
    13471347 * @since 3.6.0 The `aim`, `jabber`, and `yim` fields were removed as default user contact
    13481348 *              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.
    13501349 *
    13511350 * @global wpdb $wpdb WordPress database abstraction object.
    13521351 *
    function validate_username( $username ) { 
    13811380 *     @type string|bool $show_admin_bar_front Whether to display the Admin Bar for the user on the
    13821381 *                                             site's front end. Default true.
    13831382 *     @type string      $role                 User's role.
    1384  *     @type int         $import_id            Suggested Uer ID, use it if not already present.
    13851383 * }
    13861384 * @return int|WP_Error The newly created user's ID or a WP_Error object if the user could not
    13871385 *                      be created.
    function wp_insert_user( $userdata ) { 
    15981596
    15991597        $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));
    16001598
    1601         $import_id = empty( $userdata['import_id'] ) ? 0 : $userdata['import_id'];
    1602 
    16031599        if ( $user_nicename_check ) {
    16041600                $suffix = 2;
    16051601                while ($user_nicename_check) {
    function wp_insert_user( $userdata ) { 
    16221618                $wpdb->update( $wpdb->users, $data, compact( 'ID' ) );
    16231619                $user_id = (int) $ID;
    16241620        } 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                 }
    16321621                $wpdb->insert( $wpdb->users, $data + compact( 'user_login' ) );
    16331622                $user_id = (int) $wpdb->insert_id;
    16341623        }