My forum is denied to anonymous users through the nodeaccess module.
When these users goes to my forum root, i.e: http://mysite/forum, this sql error is logged:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AS r ON n.nid=r.nid INNER JOIN term_node AS t ON n.nid = t.nid INN' at line 33 query: SELECT n.title AS topictitle, r.title AS replytitle, r.time timestamp, r.type AS replytype, n.type AS topictype, n.nid AS topicid, t.tid, r.cid AS cid, r.uid, u.name FROM node AS n INNER JOIN ( (SELECT title, created AS time, nid, uid, type, 'cid' AS cid FROM node ) UNION (SELECT subject, timestamp, nid, uid, 'comment', cid FROM comments INNER JOIN node_access na ON na.nid = n.nid WHERE (na.grant_view >= 1 AND ((na.gid = 0 AND na.realm = 'all') OR (na.gid = 1 AND na.realm = 'nodeaccess_rid') OR (na.gid = 0 AND na.realm = 'nodeaccess_uid') OR (na.gid = 0 AND na.realm = 'nodeaccess_author'))) AND ( comments.status = 0 ) ORDER BY time DESC ) AS r ON n.nid=r.nid INNER JOIN term_node AS t ON n.nid = t.nid INNER JOIN users AS u ON r.uid = u.uid INNER JOIN node_access na ON na.nid = n.nid WHERE (na.grant_view >= 1 AND ((na.gid = 0 AND na.realm = 'all') OR (na.gid = 1 AND na.realm = 'nodeaccess_rid') OR (na.gid = 0 AND na.realm = 'nodeaccess_uid') OR (na.gid = 0 AND na.realm = 'nodeaccess_author'))) AND ( n.status = 1 ) GROUP BY tid; in /var/www/site/includes/database.mysql.inc nella riga 172.

Comments

michelle’s picture

Project: Advanced Forum » Nodeaccess
Version: 5.x-1.0-alpha6 » 5.x-1.x-dev

I know nothing about this module. If they're adding to my query and breaking it, then it seems like their error. If there's something I can change in my query to help, just let me know, but I'm not going to go digging into a module I don't use to figure it out.

Michelle

samuelet’s picture

In case it could help, from drupal log it seems that this bug did not happen before advanced forum 5.x-1.0-alpha6. In old releases the main forum page did not honour acl settings, showing all informations about denied forums (number of posts, last post title, etc) , while in the last release only forum names and descriptions are displayed (that is a more correct way) but the sql error is logged.

michelle’s picture

Whoops, forgot to come back to this issue. It turns out the problem is that the sql rewrite doesn't support subqueries. So I removed it again. See http://drupal.org/node/238125#comment-781387 . I'll leave it up to the nodeaccess module's maintainer whether s/he wants to won't fix it or wants to make it work. Making it work would involve rewriting the SQL so it doesn't use a subquery which I have neither the knowledge nor interest in doing.

Michelle

mantyla’s picture

Status: Active » Closed (fixed)

This is a problem with Drupal core, not with Nodeaccess - or any other access control module. See my reply: http://drupal.org/node/238125#comment-905441.