Views currently provides an ability to sort nodes by 'updated/commented date' which is useful for seeing nodes which are 'active' when viewed in a DESC order.

I have a workflow issue where when a content administrator changes the taxonomy terms on a node for example, it floats to the top of a view when sorted by 'updated/commented date' - I would find it useful to sort by 'posted/commented date' so node edits don't mean a post floats up, only the newest posts or posts with recent comments are at the top of lists/views. I believe this would be useful for many sites where moderators/administrators may edit nodes and don't want those nodes going to the top of lists when doing so.

Comments

dawehner’s picture

Writing a patch woud be very easy.

<?php
class views_handler_sort_ncs_last_posted extends views_handler_sort_date {
  function query() {
    $this->ensure_my_table();
    $this->node_table = $this->query->ensure_table('node', $this->relationship);
    $this->field_alias = $this->query->add_orderby(NULL, "GREATEST(" . $this->node_table . ".created, " . $this->table_alias . ".last_comment_timestamp)", $this->options['order'], $this->table_alias . '_' . $this->field);
  }
}

?>

This would be the handler code.

dawehner’s picture

@zhte

When you need this feature, why are you not writing a patch?

iamjon’s picture

Category: feature » task

I'm marked this as an unassigned task. If anyone would like to role up their sleeves and take it upon themselves to write a patch it would be awesome

kars-t’s picture

Status: Active » Fixed

I am closing this issue to clean up the issue queue as it is more than a year old. Feel free to reopen the issue.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.