any way to sort potential group members by number of groups they belong to?

any way to sort potential group members by number of groups they belong to?

by sam altomere -
Number of replies: 0

 am trying to change the code for potential members window on the group/members.php (which is a function in the group/lib.php file) to sort by the number of groups that they are a member of already within a course (this shows up in the list of potential members as a number in egg next to the user name. 

At present, the list sorts by lastname ASC, firstname ASC, and I would like it to sort by count of groups user is member of ASC, lastname ASC, firstname ASC.

The problem is that I am not spotting in the code where they build the number count or what variable holds the count for each member in the list. 

Does someone know where the count is constructed in the code (I think that it must be in the lib.php , function groups_get_potential_members code, but I have been looking at it for two days and I cannot find it. Any help would be appreciated.

Average of ratings: -