Commit 9e2223c5 authored by catch's avatar catch

Issue #1377468 by droplet: Fixed remove unnecessary user join in forum_forum_load().

parent 1f3142df
......@@ -825,11 +825,10 @@ function forum_forum_load($tid = NULL) {
// Query "Last Post" information for this forum.
$query = db_select('node', 'n');
$query->join('users', 'u1', 'n.uid = u1.uid');
$query->join('forum', 'f', 'n.vid = f.vid AND f.tid = :tid', array(':tid' => $forum->tid));
$query->join('node_comment_statistics', 'ncs', 'n.nid = ncs.nid');
$query->join('users', 'u2', 'ncs.last_comment_uid = u2.uid');
$query->addExpression('CASE ncs.last_comment_uid WHEN 0 THEN ncs.last_comment_name ELSE u2.name END', 'last_comment_name');
$query->join('users', 'u', 'ncs.last_comment_uid = u.uid');
$query->addExpression('CASE ncs.last_comment_uid WHEN 0 THEN ncs.last_comment_name ELSE u.name END', 'last_comment_name');
$topic = $query
->fields('ncs', array('last_comment_timestamp', 'last_comment_uid'))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment