DrupalBin
Submit Code
About
Recent Posts
Code
9 hours 15 min
ago
Code
13 hours 32 min
ago
Logging without output buffer trouble
14 hours 23 min
ago
Code
15 hours 13 min
ago
more
Tags
CCK
drupal
fapi
jquery
menu
module
Panels
php
simpletest
test
theme
views
more tags
User login
Log in using OpenID:
What is OpenID?
Username:
*
Password:
*
Create new account
Request new password
Log in using OpenID
Cancel OpenID login
Home
Fix for relative date in comments
View
Download
Fix
This fix will not be saved to the database until you submit.
Summary:
Tags:
Any tags you'd like to associate with your code, delimitered by commas (example: Views, CCK, Module, etc).
Source code:
*
function tassoman_comment_view($comment, $links = array(), $visible = 1) { static $first_new = TRUE; // comment time difference static $comment_previous_timestamp; $n = node_load($comment->nid); if(! $comment_previous_timestamp) $comment_previous_timestamp = $n->created; $comment_difference_timestamp = $comment->timestamp - $comment_previous_timestamp; $comment->previous_difference = format_interval($comment_difference_timestamp); $comment_previous_timestamp = $comment->timestamp; $output = ''; $comment->new = node_mark($comment->nid, $comment->timestamp); if ($first_new && $comment->new != MARK_READ) { // Assign the anchor only for the first new comment. This avoids duplicate // id attributes on a page. $first_new = FALSE; $output .= "<a id=\"new\"></a>\n"; } $output .= "<a id=\"comment-$comment->cid\"></a>\n"; // Switch to folded/unfolded view of the comment if ($visible) { $comment->comment = check_markup($comment->comment, $comment->format, FALSE); // Comment API hook comment_invoke_comment($comment, 'view'); $output .= theme('comment', $comment, $links); } else { $output .= theme('comment_folded', $comment); } return $output; }
Syntax highlighting mode:
ActionScript
ColdFusion
Diff
Drupal
Drupal 5
Drupal 6
HTML
Javascript
MySQL
PHP
Python
robots.txt
SQL
Text
Select the syntax highlighting mode to use.