August 17, 2006

List of News Writers

Print More

2.

$rid = 9;
?>

A list of all users with Role ID

t(‘Username’), ‘field’ => ‘u.name’, ‘sort’ => ‘asc’),
array(‘data’ => t(‘Status’), ‘field’ => ‘u.status’),
array(‘data’ => t(‘Member for’), ‘field’ => ‘u.created’),
array(‘data’ => t(‘Last access’), ‘field’ => ‘u.access’)
);
$sql = “SELECT u.uid, u.name, u.status, u.created, u.access FROM {users} u INNER JOIN {users_roles} ur ON u.uid=ur.uid WHERE ur.rid = $rid”;
$sql .= tablesort_sql($header);
$result = pager_query($sql, 50);

$status = array(t(‘blocked’), t(‘active’));
while ($account = db_fetch_object($result)) {
$rows[] = array(theme(‘username’, $account),
$status[$account->status],
format_interval(time() – $account->created),
$account->access ? t(‘%time ago’, array(‘%time’ => format_interval(time() – $account->access))) : t(‘never’));
}

$output = theme(‘table’, $header, $rows);
$output .= theme(‘pager’, NULL, 50, 0);
print ($output);
?>