Ticket #20747: 20747.patch

File 20747.patch, 1.2 KB (added by azaozz, 12 months ago)
  • wp-admin/js/user-profile.dev.js

     
    4141 
    4242                if ( select.length ) { 
    4343                        $('#first_name, #last_name, #nickname').bind( 'blur.user_profile', function() { 
    44                                 var current = select.find('option:selected').attr('id'), dub = [], 
     44                                var current = select.find('option:selected').val(), dub = [], 
    4545                                        inputs = { 
    4646                                                display_nickname  : $('#nickname').val() || '', 
    4747                                                display_username  : $('#user_login').val() || '', 
     
    5454                                        inputs['display_lastfirst'] = inputs.display_lastname + ' ' + inputs.display_firstname; 
    5555                                } 
    5656 
    57                                 $('option', select).remove(); 
     57                                $.each( $('option', select), function( i, el ){ 
     58                                        dub.push( el.value ); 
     59                                }); 
     60 
    5861                                $.each(inputs, function( id, value ) { 
    5962                                        if ( ! value ) 
    6063                                                return; 
     
    6467                                        if ( inputs[id].length && $.inArray( val, dub ) == -1 ) { 
    6568                                                dub.push(val); 
    6669                                                $('<option />', { 
    67                                                         'id': id, 
    6870                                                        'text': val, 
    69                                                         'selected': (id == current) 
     71                                                        'selected': (val == current) 
    7072                                                }).appendTo( select ); 
    7173                                        } 
    7274                                });