Hello,

I use the advanced forum module and there is a forum-thread.tpl.php, which formats the thread (1st posting = node & follow-ups = comments). I want to display the month, the node/comment was created. If it is the first post of the thread (= a node), I can use this code:

print (format_date($node->created, 'custom', 'M'))

But if it is a follow-up, the code always produces the 1st of January. I think this is because the follow-ups are no nodes at all. Is there anything I can use for comments to get the creation date?

Comments

Tim99’s picture

Found a solution:

if ($node) {
	$month_created = format_date($node->created, 'custom', 'M');
	$day_created = format_date($node->created, 'custom', 'd');
} else {
	$month_created = format_date($comment->timestamp, 'custom', 'M');
	$day_created = format_date($comment->timestamp, 'custom', 'd');
}