The permissions UI builds up a list of permissions grouped by module:
foreach (og_get_permissions() as $perm => $value) {
$module = $value['module'];
$permissions_by_module[$module][$perm] = $value;
}
It then does asort() on this. This is probably not what is intended, as it sorts the values. Here the values are arrays, and so (AFAICT) what happens is that the modules in the form are sorted by the number of permissions they each provide. That doesn't seem useful to me.
Perhaps this was meant to be ksort()? That would sort by module machine name.
Comments
Comment #1
joachim commentedComment #2
shushu commentedThanks. The patch works, and order by module machine name.
Thinking about it, we better sort by
$module_info[$module]['name']and not machine name, since in some cases the result won't be the same.Comment #3
joachim commentedI agree that's better, but it's a lot trickier too!
Here's a patch to do that. Given that Drupal 7 officially supports PHP 5.2, we can't use an anonymous function for sorting, so rather than add a function just to be a sort callback, I've gone with prepping the order of the permissions array by making it out of the sorted modules array.
Comment #4
shushu commentedThanks. Works as expected.
Comment #5
amitaibuCommitted, thanks.