Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I'm using the forums module in a sligthly specific way, which requires the use of the 'changed' field from the node db-table.
In order to do this today, I need to hack the forum.module to add the the field to the sql query.
I suggest adding the 'changed' field to the $topics variable in core, because that way, it is themeable.
As far as I can tell, there is only one place that needs a change:
In forum.module:
function forum_get_topics
- line 582: the $sql variable: add n.changed to the list of fields to select. (see the following example, including the n.changed AS last_changed addition)
$sql = db_rewrite_sql("SELECT n.nid, r.tid, n.title, n.type, n.sticky, u.name, u.uid, n.created AS timestamp, n.changed AS last_changed, n.comment AS comment_mode, l.last_comment_timestamp, IF(l.last_comment_uid != 0, cu.name, l.last_comment_name) AS last_comment_name, l.last_comment_uid, l.comment_count AS num_comments, f.tid AS forum_tid FROM {node_comment_statistics} l INNER JOIN {node} n ON n.nid = l.nid INNER JOIN {users} cu ON l.last_comment_uid = cu.uid INNER JOIN {term_node} r ON n.vid = r.vid INNER JOIN {users} u ON n.uid = u.uid INNER JOIN {forum} f ON n.vid = f.vid WHERE n.status = 1 AND r.tid = %d");
Alas, I don't know how to create a patch, otherwise I would.
Comments
Comment #1
elfur CreditAttribution: elfur commentedTo add a little to my feature request:
It would also be neat to wrap the $topic->changed into a similar variable as $topic->created. That is, to display the author of the last change within the variable as is done with the created variable.
This I have no idea how to do.
thanks
/elfur
Comment #2
Jooblay.net CreditAttribution: Jooblay.net commentedWhat is the status of this ticket:) Can we close this...