Currently, the 'Switch user' list is composed of two sorted sublists, each sorted by last access. This could look like

sysadmin
member
account
webmaster

The placeholder-formatted (italic) items are sorted among themselves (those are the accounts that can switch back), followed by the other items, also sorted among themselves.

I see no value in having two sublists, since the two kinds of items are easy to distinguish. Instead I'd like to really sort the entire list, so that it might look like this...

sysadmin
account
webmaster
member

... if that's what last access gives.

The attached patch implements this for D7. I'll do some additional clean-up of the devel_switch_user_list() function and update the older versions, too, of course, if this is acceptable. (I asked for this in one of my very first posts here on d.o, but I didn't find the right code and tone at the time...)

Implementation note: it would be tempting to use $user->access as key for the $links array, but we can't assure that no two accounts in the list won't ever have the same $user->access.

CommentFileSizeAuthor
devel.sort-switch-users-list.patch1.03 KBsalvis
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

moshe weitzman’s picture

Status: Needs review » Needs work

could we use a key called 'access'. more descriptive than 0. also, needs doxygen for new function. after these, feel free to commit and backport if you wish.

salvis’s picture

Assigned: salvis » Unassigned
Status: Needs work » Fixed

Committed to D7 and D6 with your requested changes. Thanks!

(I left D5 alone because the logic is different and it would require additional effort.)

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.