function referral_admin_view_roles in User Referral 6
Same name and namespace in other branches
- 5 referral.module \referral_admin_view_roles()
- 7 referral.module \referral_admin_view_roles()
1 string reference to 'referral_admin_view_roles'
File
- ./
referral.module, line 445
Code
function referral_admin_view_roles() {
$uid = (int) arg(4);
$header = array(
array(
'data' => t('User'),
'field' => 'u.name',
),
array(
'data' => t('Roles'),
),
array(
'data' => t('Time'),
'field' => 'r.created',
'sort' => 'desc',
),
array(
'data' => t('IP Address'),
'field' => 'r.host',
),
array(
'data' => t('Referrer'),
'field' => 'r.http_referer',
),
);
$sql = 'SELECT u.uid, u.name, r.created, r.host, r.http_referer
FROM {referral} r INNER JOIN {users} u USING(uid)
WHERE r.referral_uid = %d
AND r.flag = 0
AND r.uid IN
( SELECT u.uid FROM {users} u WHERE status = 1 )' . tablesort_sql($header);
$result = pager_query($sql, REFERRAL_PAGE_COUNT, 0, NULL, $uid);
while ($data = db_fetch_object($result)) {
$referer = check_plain(_referral_column_width($data->http_referer));
$rows[] = array(
array(
'data' => l($data->name, "user/{$data->uid}"),
),
array(
'data' => implode(',', _referral_get_user_roles($data->uid)),
),
array(
'data' => format_date($data->created, 'custom', REFERRAL_DATE_FORMAT),
),
array(
'data' => l($data->host, "http://whois.domaintools.com/{$data->host}"),
),
array(
'data' => l($referer, $data->http_referer),
),
);
}
if (!$rows) {
$rows[] = array(
array(
'data' => t('No data.'),
'colspan' => '5',
),
);
}
$pager = theme('pager', NULL, REFERRAL_PAGE_COUNT, 0);
if (!empty($pager)) {
$rows[] = array(
array(
'data' => $pager,
'colspan' => '5',
),
);
}
$user = user_load(array(
'uid' => $uid,
));
$output = t('Unflagged referral users with roles for: @user', array(
'@user' => l($user->name, "user/{$user->uid}"),
));
$output .= theme('table', $header, $rows);
return $output;
}