[rt-users] Sort order of Users

Schultz, Eric ESchultz at corp.untd.com
Tue Aug 22 13:46:01 EDT 2006


I just made the while loop in share/html/Admin/Groups/Members.html first
add people to a hash, then used a foreach with sort to get them in the
proper order.  My code is based on 3.4.1, and here is the diff:

@@ -77,9 +77,15 @@
 % my $UserMembers = $Group->MembersObj;
 % $UserMembers->LimitToUsers();
 <UL>
+
+% my %Members;
 % while (my $member = $UserMembers->Next()) {
-<LI><INPUT TYPE=CHECKBOX Name="DeleteMember-<%$member->MemberId%>">
-<%$member->MemberObj->Object->Name%>
(<%$member->MemberObj->Object->RealName%>)
+%     $Members{ $member->MemberObj->Object->Name } = $member;
+% }
+
+% foreach my $member (sort keys %Members) {
+<LI><INPUT TYPE=CHECKBOX
Name="DeleteMember-<%$Members{$member}->MemberId%>">
+<%$Members{$member}->MemberObj->Object->Name%>
(<%$Members{$member}->MemberObj->Object->RealName%>)
 % }
 </ul>
 <&|/l&>Groups</&>

I also made similar changes to other files where the sort order was
based on when the user was added (probably some Id from the database)
rather than something more practical like alphabetical ordering.

Eric Schultz
United Online

> -----Original Message-----
> From: rt-users-bounces at lists.bestpractical.com 
> [mailto:rt-users-bounces at lists.bestpractical.com] On Behalf 
> Of Kenneth Crocker
> Sent: Tuesday, August 22, 2006 10:05 AM
> To: RT-Users at lists.bestpractical.com
> Subject: [rt-users] Sort order of Users
> 
> To all,
> 
> 
> 	I noticed when I add users to my privileged list, they 
> end up on the 
> end, regardless of what the alphabetical sequence would be. Is there 
> anyway to re-sequence them?
> 
> Kenn
> LBNL
> 
> _______________________________________________
> http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users
> 
> Community help: http://wiki.bestpractical.com
> Commercial support: sales at bestpractical.com
> 
> 
> Discover RT's hidden secrets with RT Essentials from O'Reilly Media. 
> Buy a copy at http://rtbook.bestpractical.com
> 



More information about the rt-users mailing list