WordPress.org

Make WordPress Core

Ticket #6148: 6148.patch

File 6148.patch, 5.5 KB (added by arealnobrainer, 2 years ago)

Patch for extra user field other_name

  • src/wp-admin/user-edit.php

    diff --git a/src/wp-admin/user-edit.php b/src/wp-admin/user-edit.php
    index 5bc91c9820..80cef618e5 100644
    a b if ( is_multisite() && is_network_admin() && ! IS_PROFILE_PAGE && current_user_c 
    388388</tr>
    389389
    390390<tr class="user-last-name-wrap">
    391         <th><label for="other_name"><?php _e('Additional Names') ?></label></th>
    392         <td><input type="text" name="other_name" id="other_name" value="<?php echo esc_attr($profileuser->other_name) ?>" class="regular-text" /></td>
    393 </tr>
    394 
    395 
    396 <tr class="user-last-name-wrap">
    397391        <th><label for="last_name"><?php _e('Last Name') ?></label></th>
    398392        <td><input type="text" name="last_name" id="last_name" value="<?php echo esc_attr($profileuser->last_name) ?>" class="regular-text" /></td>
    399393</tr>
    if ( is_multisite() && is_network_admin() && ! IS_PROFILE_PAGE && current_user_c 
    414408
    415409                        if ( !empty($profileuser->first_name) )
    416410                                $public_display['display_firstname'] = $profileuser->first_name;
    417                        
    418                         if ( !empty($profileuser->other_name) )
    419                                 $public_display['display_othername'] = $profileuser->other_name;
    420                        
     411
    421412                        if ( !empty($profileuser->last_name) )
    422413                                $public_display['display_lastname'] = $profileuser->last_name;
    423414
    424415                        if ( !empty($profileuser->first_name) && !empty($profileuser->last_name) ) {
    425416                                $public_display['display_firstlast'] = $profileuser->first_name . ' ' . $profileuser->last_name;
    426417                                $public_display['display_lastfirst'] = $profileuser->last_name . ' ' . $profileuser->first_name;
    427                                 $public_display['display_lastfirstother'] = $profileuser->last_name . ' ' . $profileuser->first_name . ' ' . $profileuser->other_name;
    428                                 $public_display['display_firstotherlast'] = $profileuser->first_name . ' ' . $profileuser->other_name . ' ' . $profileuser->last_name;
    429418                        }
    430419
    431420                        if ( !in_array( $profileuser->display_name, $public_display ) ) // Only add this if it isn't duplicated elsewhere
  • src/wp-admin/user-new.php

    diff --git a/src/wp-admin/user-new.php b/src/wp-admin/user-new.php
    index 269df53fa5..1ea39ba950 100644
    a b $creating = isset( $_POST['createuser'] ); 
    392392
    393393$new_user_login = $creating && isset( $_POST['user_login'] ) ? wp_unslash( $_POST['user_login'] ) : '';
    394394$new_user_firstname = $creating && isset( $_POST['first_name'] ) ? wp_unslash( $_POST['first_name'] ) : '';
    395 $new_user_othername = $creating && isset( $_POST['other_name'] ) ? wp_unslash( $_POST['other_name'] ) : '';
    396395$new_user_lastname = $creating && isset( $_POST['last_name'] ) ? wp_unslash( $_POST['last_name'] ) : '';
    397396$new_user_email = $creating && isset( $_POST['email'] ) ? wp_unslash( $_POST['email'] ) : '';
    398397$new_user_uri = $creating && isset( $_POST['url'] ) ? wp_unslash( $_POST['url'] ) : '';
    $new_user_ignore_pass = $creating && isset( $_POST['noconfirmation'] ) ? wp_unsl 
    415414                <th scope="row"><label for="first_name"><?php _e('First Name') ?> </label></th>
    416415                <td><input name="first_name" type="text" id="first_name" value="<?php echo esc_attr($new_user_firstname); ?>" /></td>
    417416        </tr>
    418     <tr class="form-field">
    419         <th scope="row"><label for="other_name"><?php _e('Additional Names') ?> </label></th>
    420         <td><input name="other_name" type="text" id="other_name" value="<?php echo esc_attr($new_user_othername); ?>" /></td>
    421     </tr>
    422417        <tr class="form-field">
    423418                <th scope="row"><label for="last_name"><?php _e('Last Name') ?> </label></th>
    424419                <td><input name="last_name" type="text" id="last_name" value="<?php echo esc_attr($new_user_lastname); ?>" /></td>
  • tests/qunit/fixtures/wp-api-generated.js

    diff --git a/tests/qunit/fixtures/wp-api-generated.js b/tests/qunit/fixtures/wp-api-generated.js
    index 7cfafc6551..69e2375563 100644
    a b mockedApiResponse.Schema = { 
    25392539                            "description": "First name for the user.",
    25402540                            "type": "string"
    25412541                        },
    2542                         "other_name": {
    2543                             "required": false,
    2544                             "description": "Additional names for the user.",
    2545                             "type": "string"
    2546                         },
    25472542                        "last_name": {
    25482543                            "required": false,
    25492544                            "description": "Last name for the user.",
    mockedApiResponse.Schema = { 
    26712666                            "description": "First name for the user.",
    26722667                            "type": "string"
    26732668                        },
    2674                         "other_name": {
    2675                             "required": false,
    2676                             "description": "Additional names for the user.",
    2677                             "type": "string"
    2678                         },
    26792669                        "last_name": {
    26802670                            "required": false,
    26812671                            "description": "Last name for the user.",
    mockedApiResponse.Schema = { 
    28132803                            "description": "First name for the user.",
    28142804                            "type": "string"
    28152805                        },
    2816                         "other_name": {
    2817                             "required": false,
    2818                             "description": "Additional names for the user.",
    2819                             "type": "string"
    2820                         },
    28212806                        "last_name": {
    28222807                            "required": false,
    28232808                            "description": "Last name for the user.",