Here is a patch to order the columns on the /admin/user/access page by role weight. Pretty straightforward - I don't know if there is any point in adding a toggle to switch this on or off (the default alphabetical ordering is not much use if you have a lot of roles). I was actually thought (from the module name at least!) that this is what role weights did...so now it does!

Note there is also the patch for the roles page table over at http://drupal.org/node/114037 (a somewhat tricker case).

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

pfaocle’s picture

Awesome, thank you. I think you're right - shall we assume that if one has enabled this module, then re-ordering the Access Control page is desired, without option? We don't have an admin/settings/role_weights page, so adding one for this does seem a bit daft.

Will check the patch out - thanks again.

pfaocle’s picture

Status: Needs review » Reviewed & tested by the community

Patch works a treat - will commit this to 5.x unless I hear any complaints re: no settings page?

Thanks again.

pfaocle’s picture

Title: Order relevant user/role/access forms by Role Weight » Order user access page to role weight
Status: Fixed » Reviewed & tested by the community

Just a thought, but if we have no explicit setting for this re-ordering on user access or user roles forms, then I'd like the re-ordering to be done across the board - ie we'd need a solution for ordering the user roles form (#114037: Order admin_user_roles by weight?) too.

pfaocle’s picture

Title: Order user access page to role weight » Order relevant user/role/access forms by Role Weight
Status: Reviewed & tested by the community » Needs work

Merging #114037: Order admin_user_roles by weight? here, as per comment #3. Merged patch soon.

pfaocle’s picture

Title: Order user access page to role weight » Order relevant user/role/access forms by Role Weight
Status: Reviewed & tested by the community » Needs work
FileSize
2.69 KB

Not sure I like the weight actually being shown on the admin_user_roles form, but this merged patch should do what we want.

pfaocle’s picture

Status: Needs work » Needs review
pfaocle’s picture

FileSize
2.16 KB

Better patch - no weight is shown on the admin_user_roles form now but its still sorted. Also added a system variable 'role_weights_reorder_forms' which allows for the sorting on admin_user_roles form and the user_admin_perm form to be toggled.

I didn't want to add an entire settings page just for this system variable - I guessed that if the user was able to manage roles and permissions, then adding a setting to the $conf variable to ENABLE sorting of these forms by role weight should suffice?

So, if you test this patch, add:

  # role weights re-order admin forms setting
  $conf = array(
    'role_weights_reorder_forms' => TRUE,
  );

to the $conf array in your settings.php file.

Will be committing this and some other changes very soon for the next 5.x-1.x release - please shout now if you would like a settings page for this!

pfaocle’s picture

FileSize
2.39 KB

Minor change - if no weight is set (NULL) we assume a weight of zero. Without this, when new roles were added on admin_user_roles, no weight is set and so the sorting fails - the new role appeared at the top of the list.

pfaocle’s picture

Status: Needs review » Fixed

Committed to 5.x-1.x-dev and HEAD.

Status: Needs work » Closed (fixed)

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