function referral_block_content in User Referral 6
Same name and namespace in other branches
- 5 referral.module \referral_block_content()
- 7 referral.module \referral_block_content()
1 call to referral_block_content()
File
- ./
referral.module, line 291
Code
function referral_block_content() {
$header = array();
$sql = 'SELECT r.referral_uid, u.name, COUNT(*) AS num_referrals
FROM {referral} r INNER JOIN {users} u ON u.uid = r.referral_uid
INNER JOIN {users} u2 ON u2.uid = r.uid
WHERE u2.status = 1
GROUP BY r.referral_uid
ORDER BY num_referrals DESC
LIMIT %d';
$result = db_query($sql, REFERRAL_BLOCK_COUNT);
while ($data = db_fetch_object($result)) {
$rows[] = array(
array(
'data' => l($data->name, "user/{$data->referral_uid}"),
),
array(
'data' => $data->num_referrals,
),
);
}
if (!$rows) {
$rows[] = array(
array(
'data' => t('No data.'),
),
);
}
return theme('table', $header, $rows);
}