comment_admin_overview
- Versions
- 4.6 – 4.7
comment_admin_overview($type = 'new')- 5 – 6
comment_admin_overview($type= 'new', $arg)- 7
comment_admin_overview($form, &$form_state, $arg)
Menu callback; present an administrative comment listing.
Code
modules/comment.module, line 1014
<?php
function comment_admin_overview($type = 'new') {
$header = array(
array('data' => t('Subject'), 'field' => 'subject'),
array('data' => t('Author'), 'field' => 'u.name'),
array('data' => t('Status'), 'field' => 'status'),
array('data' => t('Time'), 'field' => 'c.timestamp', 'sort' => 'desc'),
array('data' => t('Operations'), 'colspan' => '2')
);
$destination = drupal_get_destination();
$status = ($type == 'approval') ? 1 : 0;
$sql = 'SELECT c.subject, c.nid, c.cid, c.comment, c.timestamp, c.status, c.name, c.homepage, u.name AS registered_name, u.uid FROM {comments} c INNER JOIN {users} u ON u.uid = c.uid WHERE c.status = '. db_escape_string($status);
$sql .= tablesort_sql($header);
$result = pager_query($sql, 50);
while ($comment = db_fetch_object($result)) {
$comment->name = $comment->uid ? $comment->registered_name : $comment->name;
$rows[] = array(
l($comment->subject, "node/$comment->nid", array('title' => truncate_utf8($comment->comment, 128)), NULL, "comment-$comment->cid") ." ". theme('mark', node_mark($comment->nid, $comment->timestamp)),
format_name($comment),
($comment->status == 0 ? t('Published') : t('Not published')),
format_date($comment->timestamp, 'small'),
l(t('edit'), "admin/comment/edit/$comment->cid", array(), $destination),
l(t('delete'), "admin/comment/delete/$comment->cid", array(), $destination)
);
}
if ($pager = theme('pager', NULL, 50, 0, tablesort_pager())) {
$rows[] = array(array('data' => $pager, 'colspan' => '6'));
}
if (!$rows) {
$rows[] = array(array('data' => t('No comments available.'), 'colspan' => '6'));
}
print theme('page', theme('table', $header, $rows));
}
?>Login or register to post comments 