Index: role_weights.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/role_weights/role_weights.module,v retrieving revision 1.12.2.1 diff -u -p -r1.12.2.1 role_weights.module --- role_weights.module 8 Nov 2007 21:18:28 -0000 1.12.2.1 +++ role_weights.module 15 Jan 2008 22:46:07 -0000 @@ -70,6 +70,19 @@ function role_weights_form_alter($form_i $form['delete']['#weight'] = 10; $form['#submit']['role_weights_admin_role_submit'] = array(); } + else if ($form_id == 'user_admin_perm') { + // For each role, fetch the weight, and add as a #weight on the row names and checkboxes + foreach ($form['checkboxes'] as $key => $value) { + if (is_numeric($key)) { + $weight = role_weights_get_weight($key); + $form['checkboxes'][$key]['#weight'] = $weight; + $form['role_names'][$key]['#weight'] = $weight; + } + } + // Resort according to the adjusted weights + uasort($form['checkboxes'], "_element_sort"); + uasort($form['role_names'], "_element_sort"); + } } /**