You are here

function autoassignrole_get_auto_roles in Auto Assign Role 6

Same name and namespace in other branches
  1. 6.2 autoassignrole.module \autoassignrole_get_auto_roles()

Get all assignable roles that AAR will apply automatically.

Return value

array An array of roles

2 calls to autoassignrole_get_auto_roles()
autoassignrole_get_active_path_roles in ./autoassignrole.module
Get all roles that will be assigned based on the active path
autoassignrole_get_roles in ./autoassignrole.module
An API like call to return the roles a user has available or will be assigned

File

./autoassignrole.module, line 534
The main autoassignrole.module file

Code

function autoassignrole_get_auto_roles() {
  $aar_roles = array();

  // Select all auto roles
  $sql = "SELECT value FROM {autoassignrole} WHERE arid = 'auto_roles'";
  $result = db_fetch_object(db_query($sql));
  $aar_roles = unserialize($result->value);

  // unset anything that isn't active
  foreach ($aar_roles as $key => $value) {
    if ($value == 0) {
      unset($aar_roles[$key]);
    }
  }
  return _autoassignrole_clean_roles($aar_roles);
}