function og_page_activity in Organic groups 6
Same name and namespace in other branches
- 5.8 og.module \og_page_activity()
- 5 og.module \og_page_activity()
- 5.2 og.module \og_page_activity()
- 5.3 og.module \og_page_activity()
- 5.7 og.module \og_page_activity()
- 6.2 og.pages.inc \og_page_activity()
File
- ./
og.module, line 1231
Code
function og_page_activity() {
$sql = "SELECT oga.group_nid, node_group_nid.title, node_group_nid.uid, u.name, COUNT(*) as ncount, MAX(n.created) as ncreated, SUM(ncs.comment_count) as ccount, MAX(last_comment_timestamp) AS lct FROM {node} n INNER JOIN {og_ancestry} oga ON n.nid = oga.nid LEFT JOIN {node_comment_statistics} ncs ON n.nid = ncs.nid INNER JOIN {node} node_group_nid ON oga.group_nid = node_group_nid.nid INNER JOIN {users} u ON node_group_nid.uid = u.uid WHERE n.status = 1 GROUP BY oga.group_nid, node_group_nid.title, node_group_nid.uid, u.name";
$header = array(
array(
'data' => t('Title'),
'field' => 'node_group_nid.title',
),
array(
'data' => t('Manager'),
'field' => 'u.name',
),
array(
'data' => t('Posts'),
'field' => 'ncount',
),
array(
'data' => t('Comments'),
'field' => 'ccount',
),
array(
'data' => t('Age'),
'field' => 'node_group_nid.created',
),
array(
'data' => t('Last comment'),
'field' => 'lct',
'sort' => 'asc',
),
);
$result = db_query($sql . tablesort_sql($header));
while ($row = db_fetch_object($result)) {
$rows[] = array(
l($row->title, "node/{$row->group_nid}"),
theme('username', $row),
$row->ncount,
$row->ccount,
format_interval(time() - $row->ncreated),
format_interval(time() - $row->lct),
);
}
if (!isset($rows)) {
$rows[] = array(
array(
'data' => t('No groups available.'),
'colspan' => 6,
),
);
}
return theme('table', $header, $rows);
}