diff --git a/wp-admin/js/user-profile.dev.js b/wp-admin/js/user-profile.dev.js index 3c60a4593d..41991f57e9 100644 --- a/wp-admin/js/user-profile.dev.js +++ b/wp-admin/js/user-profile.dev.js @@ -35,13 +35,19 @@ $('#pass-strength-result').show(); $('.color-palette').click(function(){$(this).siblings('input[name="admin_color"]').prop('checked', true)}); $('#first_name, #last_name, #nickname').blur(function(){ - var select = $('#display_name'), current = select.find('option:selected').attr('id'), dub = [], - inputs = { - display_nickname : $('#nickname').val(), - display_username : $('#user_login').val(), - display_firstname : $('#first_name').val(), - display_lastname : $('#last_name').val() - }; + var select = $('#display_name'), current, dub = [], inputs; + + if ( !select.length ) + return; + + current = select.find('option:selected').attr('id'); + + inputs = { + display_nickname : $('#nickname').val() || '', + display_username : $('#user_login').val() || '', + display_firstname : $('#first_name').val() || '', + display_lastname : $('#last_name').val() || '' + }; if ( inputs.display_firstname && inputs.display_lastname ) { inputs['display_firstlast'] = inputs.display_firstname + ' ' + inputs.display_lastname; @@ -50,6 +56,9 @@ $('option', select).remove(); $.each(inputs, function( id, value ) { + if ( !value ) + return; + var val = value.replace(/<\/?[a-z][^>]*>/gi, ''); if ( inputs[id].length && $.inArray( val, dub ) == -1 ) {