Posted by FiNeX on October 3, 2011 at 10:41pm
3 followers
| Project: | Advanced Forum |
| Version: | 6.x-2.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (fixed) |
Issue Summary
Even after updating to the new D6.22 and the -dev version of FA+AF and the lastest stable ACL1.4, I'm experiencing the wrong post count on the forum: all users (except admin) have a wrong number.
In the past the bug was on the core forum module:
- http://drupal.org/node/113611
- http://drupal.org/node/250041
but it has been fixed recently.
Now we have only a small bug left on the Advanced Forum code.
The db_rewrite_sql() called from advanced_forum_unread_replies_in_forum() doesn't set the primary table and the primary field.
Now we have:
if (module_exists("nodecomment")) {
$sql = "SELECT COUNT(nc.cid) AS count, f.tid
FROM {node_comments} nc
INNER JOIN {forum} f ON nc.nid = f.nid
INNER JOIN {node} n ON nc.cid = n.nid
INNER JOIN {node} tn ON nc.nid = tn.nid and f.vid = tn.vid
LEFT JOIN {history} h ON nc.nid = h.nid AND h.uid = %d
WHERE n.status = 1 AND n.changed > %d AND (n.changed > h.timestamp OR h.timestamp IS NULL)
GROUP BY f.tid";
$sql = db_rewrite_sql($sql);
}But the db_rewrite_sql() should be:
$sql = db_rewrite_sql($sql, 'nc', 'cid');
Comments
#1
Small patch
#2
Thanks FiNeX - committed to 6.x-2.x branch.
#3
Automatically closed -- issue fixed for 2 weeks with no activity.