Role Weights provides some utility functions for accessing user role weights for other modules requiring this functionality (such as Path Access) as well as some additional Tokens for user role weights.

Usage

Once installed, modules can make use of:

function role_weights_get_weight($role_id)
- gets the weight value for a specified role

function role_weights_get_weighted_max($roles, $weight_end)
- takes an array of role_id => role_name and returns the 'lightest' (ie closest to -infinity) role id when $weight_end parameter is 'lightest' or the 'heaviest' (ie closest to +infinity) role id when $weight_end is 'heaviest'

The following tokens are also made available:

  • [user:heaviest-role-class] - user's heaviest role class name (for use in CSS)
  • [user:heaviest-role-id] - user's heaviest role id
  • [user:heaviest-role] - user's heaviest role name
  • [user:lightest-role-class] - user's lightest role class name (for use in CSS)
  • [user:lightest-role-id] - user's lightest role id
  • [user:lightest-role] - user's lightest role name

Check the README.txt file for some more information.

Supporting organisations

Thanks to FilmContact.com for supporting the update to Drupal 6.x and to Ixis for continued support.

Supporting organizations: 

Project Information

Downloads