Closed (fixed)
Project:
Auto Assign Role
Version:
7.x-1.x-dev
Component:
User interface
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
19 Oct 2011 at 16:02 UTC
Updated:
14 Aug 2014 at 12:20 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
thomasgm commentedI've made this change on the autoassignrole.module
// Sort the roles
if (variable_get('autoassignrole_user_sort', 'SORT_ASC') == 'SORT_ASC') {
asort($roles);
} else if (variable_get('autoassignrole_user_sort', 'SORT_DESC') == 'SORT_DESC') {
arsort($roles);
} else {
drupal_sort_weight($roles, $roles);
}
I've added one more IF and the ELSE
then got to autoassignrole.admin.inc and changed variable
$form['autoassignrole_user_sort'] = array(
'#type' => 'radios',
'#title' => t('Sorting'),
'#default_value' => variable_get('autoassignrole_user_sort', 'SORT_ASC'),
'#description' => t('Default sort order of roles the user will see.'),
'#options' => array(
'SORT_ASC' => t('Ascending'),
'SORT_DESC' => t('Descending'),
'SORT_WEIGHT' => t('Weight of field'),
),
);
This will make the roles being ordered by the weight defined on the Roles admin screen.
Now the question is, how can i do this using hook instead of hack the module?
kind regards
Comment #2
HFlame7 commentedThomas' solution worked, thanks! Hopefully this can get implemented as a feature.
Comment #3
mike.davis commentedThis is a nice little enhancement - I have created a patch file for this change for review.
Please can you make sure that you supply a patch file with changes rather than including code in a thread. The changes can be properly tested and applied correctly.
Comment #5
mike.davis commentedRerolled patch.
Comment #6
mike.davis commentedPatch applied