User list: Avoid dupes and better sorting. Fix #2420

@jancborchardt I just noticed that #2420 is for 4.5.8 - this is only for 5.x