Installed latest released Advanced Forum module, viewing page site.com/forum gives internal error. The module README doesn't mention which versions of other modules are required. Any ideas?

PDOException: SQLSTATE[HY000]: General error: 3065 Expression #1 of ORDER BY clause is not in SELECT list, references column 'classic3.lnsc.last_comment_timestamp' which is not in SELECT list; this is incompatible with DISTINCT: SELECT ncs.last_comment_timestamp AS last_comment_timestamp, ncs.last_comment_uid AS last_comment_uid, n.nid AS nid, n.title AS title, n.type AS type, CASE ncs.last_comment_uid WHEN 0 THEN ncs.last_comment_name ELSE u.name END AS last_comment_name FROM {node} n INNER JOIN (SELECT DISTINCT lnsc.nid AS nid FROM {node_comment_statistics} lnsc ORDER BY last_comment_timestamp DESC LIMIT 10000 OFFSET 0) lastnodes ON n.nid = lastnodes.nid INNER JOIN {forum_index} f ON n.nid = f.nid AND f.tid = :tid INNER JOIN {node_comment_statistics} ncs ON n.nid = ncs.nid INNER JOIN {users} u ON ncs.last_comment_uid = u.uid WHERE (n.status = :db_condition_placeholder_0) ORDER BY last_comment_timestamp DESC LIMIT 1 OFFSET 0; Array ( [:db_condition_placeholder_0] => 1 [:tid] => 12 ) in advanced_forum_forum_load() (line 224 of /var/www/drupal-7.39/sites/all/modules/advanced_forum/includes/core-overrides.inc).

Comments

pheski’s picture

Could this be a MySQL version error?  What MySQL version are you using?

je1’s picture

PHP 7.0.22-0ubuntu0.16.04.1
mysql Ver 14.14 Distrib 5.7.20

pheski’s picture

This is more than a little above my ability to actually fix it, but this may help:

https://www.drupal.org/node/2638760

je1’s picture

That old patch is in the released code. The issue now seems with 'last_comment_timestamp' in this line of code

    $topics = $query
        ->fields('ncs', array('last_comment_timestamp', 'last_comment_uid'))
        ->fields('n', array('nid', 'title', 'type'))
        ->condition('n.status', 1)
        ->orderBy('last_comment_timestamp', 'DESC')
        ->range(0, $post_count)
        ->addTag('node_access')
        ->execute();

je1’s picture

Forum core module works, this error shows up when Advanced form is enabled and view page .../forum, any one familiar with the module code to help?

VM’s picture

module specific issue should be worked on in the issue queue of the project in question. That's where you will find others using the module.

je1’s picture

Fixed by upgrading the drupal core to latest version