Skip to content

Commit

Permalink
Do not clear the old values in "Display name publicly as" drop-down o…
Browse files Browse the repository at this point in the history
…n the user profile screen, append new values there when the user changes any of20747 the name fields, fixes #20747

git-svn-id: http://core.svn.wordpress.org/trunk@20964 1a063a9b-81f0-0310-95a4-ce76da25c4cd
  • Loading branch information
azaozz committed May 30, 2012
1 parent 1d9c8f9 commit 9855ecc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
11 changes: 6 additions & 5 deletions wp-admin/js/user-profile.dev.js
Expand Up @@ -41,7 +41,7 @@

if ( select.length ) {
$('#first_name, #last_name, #nickname').bind( 'blur.user_profile', function() {
var current = select.find('option:selected').attr('id'), dub = [],
var dub = [],
inputs = {
display_nickname : $('#nickname').val() || '',
display_username : $('#user_login').val() || '',
Expand All @@ -54,7 +54,10 @@
inputs['display_lastfirst'] = inputs.display_lastname + ' ' + inputs.display_firstname;
}

$('option', select).remove();
$.each( $('option', select), function( i, el ){
dub.push( el.value );
});

$.each(inputs, function( id, value ) {
if ( ! value )
return;
Expand All @@ -64,9 +67,7 @@
if ( inputs[id].length && $.inArray( val, dub ) == -1 ) {
dub.push(val);
$('<option />', {
'id': id,
'text': val,
'selected': (id == current)
'text': val
}).appendTo( select );
}
});
Expand Down
2 changes: 1 addition & 1 deletion wp-admin/user-edit.php
Expand Up @@ -319,7 +319,7 @@ function use_ssl_preference($user) {

foreach ( $public_display as $id => $item ) {
?>
<option id="<?php echo $id; ?>"<?php selected( $profileuser->display_name, $item ); ?>><?php echo $item; ?></option>
<option <?php selected( $profileuser->display_name, $item ); ?>><?php echo $item; ?></option>
<?php
}
?>
Expand Down

0 comments on commit 9855ecc

Please sign in to comment.