I have installed NG3 along with the Node Gallery Access module and I am getting the following warning at the top of my pages. I am disabling the module for now. But if anyone else has seen this type of warning please advise how to correct it.

Thanks in advance.

CommentFileSizeAuthor
#5 node_gallery_access.module.patch934 bytessimonmeaden

Comments

macmaci’s picture

I am getting something similar. I moved a site from my server to webenabled. I have Node Gallery Access 6.x-2.0-beta2 and Node Gallery 6.x-2.0-beta2 installed on Drupal 6

When I try to access a gallery I get the following:
user warning: Table 'drupal.node_galleries' doesn't exist query: SELECT DISTINCT(node.nid) AS nid, node_galleries_gallery.gid AS node_galleries_gallery_gid, node.title AS node_title, (SELECT COUNT(*) FROM node_galleries ng JOIN node n on ng.nid = n.nid WHERE n.status = 1 AND ng.gid = node_galleries_gallery.gid) AS image_count, node_revisions.body AS node_revisions_body, node_revisions.format AS node_revisions_format FROM node node INNER JOIN node_galleries node_galleries_gallery ON node.nid = node_galleries_gallery.gid LEFT JOIN node_revisions node_revisions ON node.vid = node_revisions.vid WHERE (node.status <> 0) AND (node.type in ('node_gallery_gallery')) GROUP BY nid in /home/clients/websites/w_iyobu6/public_html/iyobu6/sites/all/modules/views/includes/view.inc on line 775.

bteale’s picture

I believe the issue is from the query against the wrong table.

The code in node_gallery_access.module currently has:

//check image access;
return db_fetch_object(db_query('SELECT ng.* FROM {node_gallery_access} ng INNER JOIN {node_galleries} g
ON ng.nid = g.gid WHERE g.nid = %d', $args[1]));

but I think it should have:

//check image access;
return db_fetch_object(db_query('SELECT ng.* FROM {node_gallery_access} ng INNER JOIN {node_gallery_images} g
ON ng.nid = g.gid WHERE g.nid = %d', $args[1]));

based on the comment above the line of code.

macmaci’s picture

Thanks for your feedback. Where would I change this info?

xamount’s picture

in node_gallery_access.module change every instance of node_galleries to node_gallery_images

Just do a text search and replace.

You should find 2 instances in this file. I don't have the time now or else I would have submitted a patch, sorry.

I did this and I no longer get the error.

simonmeaden’s picture

StatusFileSize
new934 bytes

I had the same problem and when I looked at node_gallery_access.module line 182 i found

return db_fetch_object(db_query('SELECT ng.* FROM {node_gallery_access} ng INNER JOIN {node_galleries} g
ON ng.nid = g.gid WHERE g.nid = %d', $args[1]));

Now there is no table named node_galleries but there is one called node_gallery_galleries which makes more sense anyway as all table should be named node_gallery_'something'.

I changed the table name and got an error about g.nid not existing in the table which it doesn't so I changed it to ng.nid and this seems to work. No error anyway. The new query would be as below.

return db_fetch_object(db_query('SELECT ng.* FROM {node_gallery_access} ng INNER JOIN {node_gallery_galleries} g ON ng.nid = g.gid WHERE ng.nid = %d', $args[1]));

Have attached a patch. At least I think so I've never done one before but it looks OK.

unc0nnected’s picture

Thanks so much for figuring that out.. Was encountering the same problem and following yuor instructions fixed that.

one eighty design studio’s picture

I encountered the same issue on a site I am working on. I had a fresh install of Node Gallery version 6.x-3.0-beta1 and Node Gallery Access version 6.x-2.0-beta2. The instructions provided by simonmeaden seems to have fixed my issue as well although I haven't uploaded any images nor have I created any galleries. But, the warning on the front page disappeared after changing the code.

dddave’s picture

Assigned: ao2ice » Unassigned
Status: Active » Needs review

Correcting settings...

justintime’s picture

I just pushed up a huge commit that works for me in all my tests. See #1247098: How to use Node Gallery Access, and please report any successes or failures. This is essentially a complete rewrite of the module.

justintime’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

cooldeeponline’s picture

Comment #4 worked for me.

Thanks a lot!