Make WordPress Core

Ticket #40342: 40342.patch

File 40342.patch, 2.0 KB (added by menakas, 8 years ago)

Added javascript to change Greeting name when display name dropdown is changed.

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

     
    483483}
    484484
    485485/**
     486    *  * Use javascript to change the user name in the toolbar
     487    *   *
     488    *   */
     489function profile_add_js(){
     490?>
     491    <script type="text/javascript">
     492        jQuery(document).ready(function($){
     493            var displayName = $( '#display_name' ).val();
     494            var greetingName = $( '#wp-admin-bar-my-account' ).children( 'a' ).first();
     495                   
     496            $('#display_name' ).on( 'change', function() {
     497                var newDisplayName = $.trim( $( this ).val() ) || displayName;
     498                greetingName[0].innerHTML = greetingName[0].innerHTML.replace(displayName,newDisplayName);
     499                displayName=newDisplayName;
     500            });
     501        });
     502    </script>
     503<?php
     504}
     505
     506/**
    486507 * @since 3.5.0
    487508 * @access private
    488509 */
  • src/wp-admin/user-edit.php

     
    4242else
    4343        $parent_file = 'profile.php';
    4444
     45add_action('admin_head', 'profile_add_js');
     46
    4547$profile_help = '<p>' . __('Your profile contains information about you (your &#8220;account&#8221;) as well as some personal options related to using WordPress.') . '</p>' .
    4648        '<p>' . __('You can change your password, turn on keyboard shortcuts, change the color scheme of your WordPress administration screens, and turn off the WYSIWYG (Visual) editor, among other things. You can hide the Toolbar (formerly called the Admin Bar) from the front end of your site, however it cannot be disabled on the admin screens.') . '</p>' .
    4749        '<p>' . __( 'You can select the language you wish to use while using the WordPress administration screen without affecting the language site visitors see.' ) . '</p>' .