Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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).
Comment | File | Size | Author |
---|---|---|---|
#8 | role_weights_210457-4.patch | 2.39 KB | pfaocle |
#7 | role_weights_210457-3.patch | 2.16 KB | pfaocle |
#5 | role_weights_210457-2.patch | 2.69 KB | pfaocle |
role_weights_access_page.patch | 1.08 KB | Owen Barton | |
Comments
Comment #1
pfaocleAwesome, 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.
Comment #2
pfaoclePatch works a treat - will commit this to 5.x unless I hear any complaints re: no settings page?
Thanks again.
Comment #3
pfaocleJust 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.
Comment #4
pfaocleMerging #114037: Order admin_user_roles by weight? here, as per comment #3. Merged patch soon.
Comment #5
pfaocleNot sure I like the weight actually being shown on the admin_user_roles form, but this merged patch should do what we want.
Comment #6
pfaocleComment #7
pfaocleBetter 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:
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!
Comment #8
pfaocleMinor 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.
Comment #9
pfaocleCommitted to 5.x-1.x-dev and HEAD.