I am looking to try and achieve 3 things with the recent comments block:
1/ Have the node title displayed above each of the recent comments in the recent comments block.
2/ List (eg) 30 words of each comment
3/ Get rid of the time stamp
The code in the comments module that i think must be tweaked is this:
/**
* Implementation of hook_block().
*
* Generates a block with the most recent comments.
*/
function comment_block($op = 'list', $delta = 0) {
if ($op == 'list') {
$blocks[0]['info'] = t('Recent comments');
return $blocks;
}
else if ($op == 'view' && user_access('access comments')) {
$result = db_query_range(db_rewrite_sql('SELECT c.nid, c.* FROM {comments} c WHERE c.status = 0 ORDER BY c.timestamp DESC', 'c'), 0, 10);
$items = array();
while ($comment = db_fetch_object($result)) {
$items[] = l($comment->subject, 'node/'. $comment->nid, NULL, NULL, 'comment-'. $comment->cid) .'<br />'. t('%time ago', array('%time' => format_interval(time() - $comment->timestamp)));
}
$block['subject'] = t('Recent comments');
$block['content'] = theme('item_list', $items);
return $block;
}
}
From looking at the code above, would i need to add to the $result query to SELECT title FROM {node}
? How would i actually code that in?
With the length of the recent comment itself, where can this be altered?