You are here

function _autoassignrole_intersect in Auto Assign Role 5.2

Same name and namespace in other branches
  1. 5 autoassignrole.module \_autoassignrole_intersect()
1 call to _autoassignrole_intersect()
autoassignrole_form_alter in ./autoassignrole.module

File

./autoassignrole.module, line 227

Code

function _autoassignrole_intersect() {
  $autoassignrole_roles = variable_get("AUTOASSIGNROLE_ROLE_USER", "");
  foreach ($autoassignrole_roles as $key => $value) {
    if ($value == 0) {
      unset($autoassignrole_roles[$key]);
    }
  }
  $result = _autoassignrole_array_intersect_key(user_roles(), $autoassignrole_roles);
  if (variable_get("AUTOASSIGNROLE_ROLE_SORT", "SORT_ASC") == "SORT_ASC") {
    uasort($result, _autoassignrole_array_asc);
  }
  else {
    uasort($result, _autoassignrole_array_desc);
  }
  return $result;
}