function user_get_roles_for_fapi

7.x user.module user_get_roles_for_fapi($bool_exclude_anonymous = TRUE, $bool_exclude_authenticated = TRUE)

Return an array, appropriate for Form API

File

modules/user/user.module, line 2859

Code

function user_get_roles_for_fapi($bool_exclude_anonymous = TRUE, $bool_exclude_authenticated = TRUE) {
  $rtn = array();

  $exclude_line = "";
  if ($bool_exclude_anonymous) {
    $exclude_line .= " AND rid != 1 ";
  }

  if ($bool_exclude_authenticated) {
    $exclude_line .= " AND rid != 2 ";
  }

  $res = db_query("SELECT * FROM roles
                     WHERE rid > 0
                     $exclude_line
                     ORDER BY rid");
  while ($cur = db_fetch_object($res)) {
    $rtn [$cur->rid] = $cur->name;
  }


  return $rtn;
}