2.
global $user;
$accessdenied = !(in_array('VNSoton', $user->roles) || in_array('alumni', $user->roles));
if ($accessdenied) {
print('
You are not allowed to see the member list.
Please '.l('login', 'user', NULL).' if you are a VNSoton/alumni member.
');
return;
}
if (in_array('alumni', $user->roles)) {
print('
If you want to change your information displayed below, please '.l('edit your profile', 'user/'.$user->uid.'/edit/Personal+Information', NULL).'.
');
}
$rid = 7; // alumni
$header = array(
array('data' => t('Username'), 'field' => 'u.name', 'sort' => 'asc'),
array('data' => t('Fullname'), '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'));
$dateformat = 'm/d/Y';
while ($account = db_fetch_object($result)) {
$account = user_load(array('uid' => $account->uid));
$birthdate = $account->profile_birthdate;
if ($birthdate) {
$replace = array('d' => sprintf('%02d', $birthdate['day']),
'j' => $birthdate['day'],
'm' => sprintf('%02d', $birthdate['month']),
'M' => map_month($birthdate['month']),
'Y' => $birthdate['year']);
}
$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')
$account->profile_fullname,
(($birthdate) ? strtr($dateformat, $replace) : ''),
$account->profile_address,
(($account->profile_yim) ? '

' : ''),
$account->profile_phone,
$account->profile_soton_come,
$account->profile_soton_leaving
);
}
$theader = array(
t('Username'), t('Full name'), t('DOB'), t('Address'), t('YIM'), t('Phone'), t('From'), t('To')
);
$output = theme('table', $theader, $rows);
$output .= theme('pager', NULL, 50, 0);
print ($output);
?>