Hello Somebodysysop!
I've been using og_user_roles for some time now, it is high time I got to implementing TAC and og_user_roles together. The problem is I am getting the following SQL errors:

user warning: Table 'openmusic2.usernode' doesn't exist query: SELECT count( DISTINCT(node.nid)) FROM node node LEFT JOIN node_comment_statistics node_comment_statistics ON node.nid = node_comment_statistics.nid INNER JOIN users users ON node.uid = users.uid INNER JOIN node_access na ON na.nid = node.nid INNER JOIN node_access naa ON naa.nid = node.nid LEFT OUTER JOIN og_ancestry ogan ON ogan.nid = naa.nid left outer join term_node trn on trn.nid = naa.nid left outer join term_access ta on ta.tid = trn.tid left outer join og ogm on ogm.nid = naa.nid left outer join og_users_roles ogr on ogr.rid = naa.gid left outer join og_uid ogu on ogu.nid = naa.nid left outer join nodefamily nof on nof.child_nid = naa.nid left outer join usernode un on nof.parent_nid = un.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 = 2 AND na.realm = 'og_subscriber') OR (na.gid = 4 AND na.realm = 'og_subscriber') OR (na.gid = 6 AND na.realm = 'og_subscriber') OR (na.gid = 2 AND na.realm = 'term_access') OR (na.gid = 3 AND na.realm = 'term_access'))) 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 = 2 AND na.realm = 'og_subscriber') OR (na.gid = 4 AND na.realm = 'og_subscriber') OR (na.gid = 6 AND na.realm = 'og_subscriber') OR (na.gid = 2 AND na.realm = 'term_access') OR (na.gid = 3 AND na.realm = 'term_access')) AND (ogan.group_nid in ('2','4','6') AND ta.rid in ('2','3') AND ta.grant_view = true) OR (na.realm = 'content_access_rid' AND ((na.gid in ('2','3')) OR (ogr.uid = 2 AND na.gid = ogr.rid)) AND na.grant_view = 1) OR (na.realm = 'content_access_author' AND na.gid = 2 AND na.grant_view = 1) OR (ogm.nid > 0 and (na.nid in ('2','4','6')) or ogm.directory = 1 ) OR (na.realm = 'og_public' AND na.gid = 0) OR (ogr.uid = 2 AND ta.rid = ogr.rid AND ogan.group_nid = ogr.gid AND ta.grant_list = true) OR (nof.child_nid = na.nid AND na.realm = 'term_access' AND un.uid = 2 AND na.grant_view = 1) OR (nof.child_nid = na.nid AND na.realm = 'term_access' AND ta.rid in ('2','3') AND ta.grant_view = true) OR (ogan.group_nid is null AND na.realm = 'term_access' AND ta.rid in ('2','3') AND ta.grant_view = true) ) AND ( (node.status = '1') ) in H:\sites\openmusic2\includes\database.mysql.inc on line 172.

user warning: Table 'openmusic2.usernode' doesn't exist query: SELECT DISTINCT(node.nid), node_comment_statistics.last_comment_timestamp AS node_comment_statistics_last_comment_timestamp_last_comment_timestamp, node.type AS node_type, node.title AS node_title, node.changed AS node_changed, users.name AS users_name, users.uid AS users_uid, node_comment_statistics.comment_count AS node_comment_statistics_comment_count, node_comment_statistics.last_comment_timestamp AS node_comment_statistics_last_comment_timestamp FROM node node LEFT JOIN node_comment_statistics node_comment_statistics ON node.nid = node_comment_statistics.nid INNER JOIN users users ON node.uid = users.uid INNER JOIN node_access na ON na.nid = node.nid INNER JOIN node_access naa ON naa.nid = node.nid LEFT OUTER JOIN og_ancestry ogan ON ogan.nid = naa.nid left outer join term_node trn on trn.nid = naa.nid left outer join term_access ta on ta.tid = trn.tid left outer join og ogm on ogm.nid = naa.nid left outer join og_users_roles ogr on ogr.rid = naa.gid left outer join og_uid ogu on ogu.nid = naa.nid left outer join nodefamily nof on nof.child_nid = naa.nid left outer join usernode un on nof.parent_nid = un.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 = 2 AND na.realm = 'og_subscriber') OR (na.gid = 4 AND na.realm = 'og_subscriber') OR (na.gid = 6 AND na.realm = 'og_subscriber') OR (na.gid = 2 AND na.realm = 'term_access') OR (na.gid = 3 AND na.realm = 'term_access'))) 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 = 2 AND na.realm = 'og_subscriber') OR (na.gid = 4 AND na.realm = 'og_subscriber') OR (na.gid = 6 AND na.realm = 'og_subscriber') OR (na.gid = 2 AND na.realm = 'term_access') OR (na.gid = 3 AND na.realm = 'term_access')) AND (ogan.group_nid in ('2','4','6') AND ta.rid in ('2','3') AND ta.grant_view = true) OR (na.realm = 'content_access_rid' AND ((na.gid in ('2','3')) OR (ogr.uid = 2 AND na.gid = ogr.rid)) AND na.grant_view = 1) OR (na.realm = 'content_access_author' AND na.gid = 2 AND na.grant_view = 1) OR (ogm.nid > 0 and (na.nid in ('2','4','6')) or ogm.directory = 1 ) OR (na.realm = 'og_public' AND na.gid = 0) OR (ogr.uid = 2 AND ta.rid = ogr.rid AND ogan.group_nid = ogr.gid AND ta.grant_list = true) OR (nof.child_nid = na.nid AND na.realm = 'term_access' AND un.uid = 2 AND na.grant_view = 1) OR (nof.child_nid = na.nid AND na.realm = 'term_access' AND ta.rid in ('2','3') AND ta.grant_view = true) OR (ogan.group_nid is null AND na.realm = 'term_access' AND ta.rid in ('2','3') AND ta.grant_view = true) ) AND ( (node.status = '1') ) ORDER BY node_comment_statistics_last_comment_timestamp_last_comment_timestamp DESC LIMIT 0, 25 in H:\sites\openmusic2\includes\database.mysql.inc on line 172.

I am using Drupal 5.2, og_user_roles 2.3 and Taxonomy Access Control 1.1. Also I have correctly applied the patch located at http://cvs.drupal.org/viewvc.py/drupal/contributions/sandbox/somebodysys...

I am getting the above errors only when I enable "Integrate TAC and OG Access Control?" in Organic groups user roles settings, and they show up wherever there is a node listing. Oddly the admin user doesn't get any of these errors.
Unfortunately I cannot understand SQL, but I see usernode mentioned in the errors. Is it a requirement?

Comments

somebodysysop’s picture

Assigned: Unassigned » somebodysysop
Status: Active » Needs review
StatusFileSize
new4.83 KB

Try this patch on release 2.3. Let me know if it solves the problem.

chrisroditis’s picture

SQL errors are gone! It looks OK, even though I am getting some access denied errors , it's because I haven't configured TAC yet, I guess. Thank you so much, for your prompt response, for fixing the problem, and for your revolutionary module

somebodysysop’s picture

Status: Needs review » Fixed

You're welcome. This fix will be committed to 2.4 release.

somebodysysop’s picture

Status: Fixed » Closed (fixed)

Modifications in version 5.x-2.4 which has just been released.

yched’s picture

Status: Closed (fixed) » Active

Similar error after enabling TAC/OG integration, except with table nodefamily instead of usernode.
Can the left outer join {nodefamily} part be enclosed in a module_exists test as well ?
(réopening fixed issue is not considered good practice, but this really looks like it's related...)

Table 'nodefamily' doesn't exist query: SELECT DISTINCT(node.nid), node.sticky AS node_sticky, node.created AS node_created_created FROM node node LEFT JOIN og_ancestry og_ancestry ON node.nid = og_ancestry.nid INNER JOIN node_access na ON na.nid = node.nid INNER JOIN node_access naa ON naa.nid = node.nid LEFT OUTER JOIN og_ancestry ogan ON ogan.nid = naa.nid left outer join term_node trn on trn.nid = naa.nid left outer join term_access ta on ta.tid = trn.tid left outer join og ogm on ogm.nid = naa.nid left outer join og_users_roles ogr on ogr.rid = naa.gid left outer join og_uid ogu on ogu.nid = naa.nid left outer join nodefamily nof on nof.child_nid = naa.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 = 4 AND na.realm = 'og_subscriber') OR (na.gid = 2 AND na.realm = 'term_access') OR (na.gid = 3 AND na.realm = 'term_access'))) 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 = 4 AND na.realm = 'og_subscriber') OR (na.gid = 2 AND na.realm = 'term_access') OR (na.gid = 3 AND na.realm = 'term_access')) AND (ogan.group_nid in ('4') AND ta.rid in ('2','3') AND ta.grant_view = true) OR (na.realm = 'content_access_rid' AND ((na.gid in ('2','3')) OR (ogr.uid = 2 AND na.gid = ogr.rid)) AND na.grant_view = 1) OR (na.realm = 'content_access_author' AND na.gid = 2 AND na.grant_view = 1) OR (ogm.nid > 0 and (na.nid in ('4')) or ogm.directory = 1 ) OR (na.realm = 'og_public' AND na.gid = 0) OR (ogr.uid = 2 AND ta.rid = ogr.rid AND ogan.group_nid = ogr.gid AND ta.grant_list = true) OR (nof.child_nid = na.nid AND na.realm = 'term_access' AND ta.rid in ('2','3') AND ta.grant_view = true) OR (ogan.group_nid is null AND na.realm = 'term_access' AND ta.rid in ('2','3') AND ta.grant_view = true) ) AND ( (node.status = '1') AND (og_ancestry.group_nid = 3) ) ORDER BY node_sticky DESC, node_created_created DESC

somebodysysop’s picture

Version: 5.x-2.3 » 5.x-2.4
StatusFileSize
new23.81 KB

Amazing! Please apply this patch to CLEAN (unpatched) version of 2.4 release. Thanks for locating it.

yched’s picture

I manually added the module_exists('nodefamily') test already, and things seem to work OK now (I'm only starting to play with the module).
I did not actually test all the other stuff included in your patch.

BTW : the coder.module would provide a valuable help in making the module's code up to drupal coding standards - would make browsing through the code much nicer :-)

somebodysysop’s picture

Status: Active » Fixed
somebodysysop’s picture

Status: Fixed » Closed (fixed)

New code in 2.5 release.