Hello,
I hope someone can help.

I'm using Organic Groups with Avatar "Who's New" and "Who's on line" blocks enabled and getting the following error:

user warning: Unknown column 'n.nid' in 'on clause' query: SELECT DISTINCT u.uid, u.name, u.picture, s.timestamp FROM users u INNER JOIN sessions s ON u.uid = s.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 = 0 AND na.realm = 'og_public') OR (na.gid = 1 AND na.realm = 'og_subscriber'))) AND ( s.timestamp >= 1217796045 AND s.uid > 0 ) ORDER BY s.timestamp DESC LIMIT 0, 10 in /usr/www/users/xxxxxx/xxxxxx/sandbox/includes/database.mysql.inc on line 172.

user warning: Unknown column 'n.nid' in 'on clause' query: SELECT uid,name,picture FROM users 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 = 0 AND na.realm = 'og_public') OR (na.gid = 1 AND na.realm = 'og_subscriber'))) AND ( uid > 0 AND access > 0 ) ORDER BY created DESC LIMIT 0, 10 in /usr/www/users/xxxxxx/xxxxxx/sandbox/includes/database.mysql.inc on line 172. 

Does anyone know why this is happening.

It looks like it missing a reference to the node table. I rewrote a test version of this query as follows:

 SELECT DISTINCT u.uid, u.name, u.picture, s.timestamp
FROM users u, sessions s, node_access na, node n
WHERE u.uid = s.uid
AND na.nid = n.nid
AND ( na.grant_view >=1
AND ( ( na.gid =0 AND na.realm = 'all' )
OR ( na.gid =0 AND na.realm = 'og_public' )
OR ( na.gid =1 AND na.realm = 'og_subscriber' ) ) )
AND ( s.timestamp >=1217796045 AND s.uid >0 )
ORDER BY s.timestamp DESC
LIMIT 0 , 10 

And it returned what I would expect it to. Can I modify the SQL myself if necessary? If so where does the SQL live?

Comments

roopletheme’s picture

Seen this on a few sites that are running the OG Access module (which is just about every OG site). Here's the solution that worked every time I've encountered it so far:

http://drupal.org/node/287300

roopletheme’s picture

On second thought, this might be related to this issue. Any chance version 1.2 fixes this for you?