Make WordPress Core

Opened 6 years ago

Closed 6 years ago

#10030 closed enhancement (fixed)

redundancy in nicknames dropdown

Reported by: hallsofmontezuma Owned by: nacin
Milestone: 3.0 Priority: low
Severity: minor Version: 3.0
Component: UI Keywords: has-patch
Focuses: Cc:


extended from http://core.trac.wordpress.org/ticket/8508

Check for duplicates before adding to the dropdown. For instance, if you have-

Username: John First Name: John Last Name: Smith Nickname: John

You'll have-

Display Name Publicly as

John John John Smith John Smith Smith John

Attachments (3)

remove_dups.diff (4.1 KB) - added by blepoxp 6 years ago.
modifies user-edit.php and user-profile.js
10030.diff (3.8 KB) - added by nacin 6 years ago.
10030.2.diff (3.9 KB) - added by nacin 6 years ago.

Download all attachments as: .zip

Change History (14)

#1 @hallsofmontezuma
6 years ago

  • Milestone changed from Unassigned to Future Release
  • Version set to 2.8

#2 @Denis-de-Bernardy
6 years ago

  • Type changed from defect (bug) to enhancement

6 years ago

modifies user-edit.php and user-profile.js

#3 @blepoxp
6 years ago

  • Keywords has-patch added
  • Milestone changed from Future Release to 3.0
  • Version changed from 2.8 to 3.0

Modified user-edit.php to remove duplicate values in the array and added another conditional in user-profile.js. Did not touch user-profile.dev.js as I'm not certain what it is used for - looks like debugging.

#4 @blepoxp
6 years ago

  • Keywords needs-testing added

This works in FF, Safari, Chrome on mac. Prob needs testing in IE if we support that.

#5 @nacin
6 years ago

  • Keywords needs-patch added; has-patch needs-testing removed
  • Owner set to nacin
  • Status changed from new to accepted

blepoxp: Could you patch the .dev.js script instead?

To have your install use the dev scripts, define('SCRIPT_DEBUG', true); in wp-config.php.

#6 follow-up: @blepoxp
6 years ago

Can anyone else confirm that wp-admin/js/user-profile.js and wp-admin/js/user-profile.dev.js are out of sync?
I was going to update the .dev version for my patch because I incorrectly patched the compact version previously but the unpacked .js looks different than the .dev.js

Can anyone else confirm?

#7 in reply to: ↑ 6 @nacin
6 years ago

Replying to blepoxp:

Can anyone else confirm that wp-admin/js/user-profile.js and wp-admin/js/user-profile.dev.js are out of sync?

I can confirm they are in sync. We use the YUI compressor, which has a "munge" option for JavaScript to obfuscate and shorten local variables and such. In this case, the file was indeed munged, but they are otherwise identical and function the same.

If you try to pack in whitespace, you may be able to get it close to the structure of the .dev file, and then work in what you patched.

#8 @nacin
6 years ago

My jQuery is a bit rusty, but the attached patch didn't pose any bugs while kicking the tires, and consistently weeded out any duplicates.

#9 @nacin
6 years ago

  • Keywords has-patch added; needs-patch removed

6 years ago

6 years ago

#10 @nacin
6 years ago

Second patch has a small improvement -- an option remains selected, even after its value changes.

This currently works for nickname (though I broke that in the first patch), as nickname is always a field and is only updated (which is no longer the case in these patches). The last/first/firstlast/lastfirst option nodes were always removed then re-added. Patch simply reselects the original option after all is over.

#11 @nacin
6 years ago

  • Resolution set to fixed
  • Status changed from accepted to closed

(In [13539]) Dynamically remove duplicates from the 'display name' profile.php option. fixes #10030

Note: See TracTickets for help on using tickets.