You are here

function _googleanalytics_user_roles in Google Analytics 5

D6 backport orders core standard roles on top and translate core roles.

1 call to _googleanalytics_user_roles()
googleanalytics_admin_settings_form in ./googleanalytics.module
Implementation of hook_admin_settings() for configuring the module

File

./googleanalytics.module, line 700

Code

function _googleanalytics_user_roles() {

  // System roles take the first two positions.
  $roles = array(
    DRUPAL_ANONYMOUS_RID => NULL,
    DRUPAL_AUTHENTICATED_RID => NULL,
  );
  $result = db_query('SELECT * FROM {role} ORDER BY name');
  while ($role = db_fetch_object($result)) {
    switch ($role->rid) {

      // We only translate the built in role names
      case DRUPAL_ANONYMOUS_RID:
        $roles[$role->rid] = t($role->name);
        break;
      case DRUPAL_AUTHENTICATED_RID:
        $roles[$role->rid] = t($role->name);
        break;
      default:
        $roles[$role->rid] = $role->name;
    }
  }

  // Filter to remove unmatched system roles.
  return array_filter($roles);
}