There's a bug in this line (function _recent_blocks_block):

($show['node date'] ? '<br />'. t('%time ago', array('%time' => format_interval(time() - $node->$s['mode_full_sort']))) : '') .

Note that mode_full_sort may not point to the node changed column. Here's how IMO that line should look:

($show['node date'] ? '<br />'. t('%time ago', array('%time' => format_interval(time() - $node->changed))) : '') .

Comments

markus_petrux’s picture

Title: Wrong node formatted in date in full mode » Wrong formatted node date in full mode

Sorry, fixing the title. How could I wrote that?

Cvbge’s picture

Status: Needs review » Closed (works as designed)

Hi.

Please note that sorting method is configurable and $s['mode_full_sort'] tells us by which property we should sort.

markus_petrux’s picture

But this is not about the "Sort by", but about the date displayed when "Show what?" is set to 'node date'.

...or is it that "Show what?" refers to the date selected in the "Sort by" field? If so, this is not clear in the settings panel description. I seemed to me that 'node date' was related to the $node->changed data.

I'm afraid to change the status of the issue.

markus_petrux’s picture

Status: Closed (works as designed) » Needs review

If "Sort what" refers to "Sort by", then one thing is wrong, the "created" column is missing in the query used in _recent_blocks_block() for full mode:

    $sql = "SELECT n.nid, n.title, n.uid, n.changed, l.last_comment_timestamp, GREATEST(n.changed, l.last_comment_timestamp) AS last_change, l.comment_count". 
            " FROM {node} n, {node_comment_statistics} l".
            " WHERE n.nid = l.nid AND $common_where AND $wow_comments". 
            " ORDER BY $s[mode_full_sort] DESC";

With the created column:

    $sql = "SELECT n.nid, n.title, n.uid, n.created, n.changed, l.last_comment_timestamp, GREATEST(n.changed, l.last_comment_timestamp) AS last_change, l.comment_count". 
            " FROM {node} n, {node_comment_statistics} l".
            " WHERE n.nid = l.nid AND $common_where AND $wow_comments". 
            " ORDER BY $s[mode_full_sort] DESC";
Cvbge’s picture

Status: Needs review » Fixed

You're right.

I've changed it so it displays node 'created' date if "sort by" is set to created, or 'changed' in all other cases.

But I think it'd be nice to be able to display GREATEST(last post, changed) even if there are no comments (currently not possibile)...

Anonymous’s picture

Status: Fixed » Closed (fixed)