Role Weights

leafish_paul - April 10, 2006 - 20:27

Role Weights allows site admins to specify certain weights for user roles. Its not much use on its own, but more of a helper module for other modules requiring this functionality, such as Path Access.

Please read the README.txt file for some more information, and a cautionary note.

Installation

First up, grab the latest official release of Role Weights appropriate for your version of Drupal (see releases below for downloads).

  1. Upload the role_weights directory to your modules directory.
  2. Enable the module under admin -> modules.
  3. Visit admin -> access control -> roles and choose the 'edit' link next to a role to change a role's weight.

Usage

Once installed and role weights set, modules can then make use of:

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

function role_weights_get_highest($roles)
- takes an array of role_id => role_name and returns the 'highest' role id

Views Integration

Role Weights provides some Views support: views are able to access, display or sort by the node author's role weight.

Notes

  • Since version 1.1 (5.x-1.1) the role with the lowest weight is returned from role_weights_get_highest(). Please see this issue.
  • role_weights_get_highest() only returns a role rid, NOT an associative array containing both the role rid and name, as in early versions. Please update themes/modules as necessary for the new release.

Releases

Official releasesDateSizeLinksStatus
5.x-1.22008-Feb-1910.02 KBRecommended for 5.xThis is currently the recommended release for 5.x.
4.7.x-1.02007-Jan-309.18 KBRecommended for 4.7.xThis is currently the recommended release for 4.7.x.


 
 

Drupal is a registered trademark of Dries Buytaert.