Hi!

I got a very strange behaviour that i cannot explain to myself.

The situation: I'm using node_gallery in my community project for 3 month. Since approximately 4 weeks uploaded images are not shown up, neither in the gallery view nor in the gallery management. I figured out that the node object of the gallery contains an emtpy images array, although images where uploaded. So i took a closer look to the code, especially on the hook nodeapi where the node object gets parsed. I figured out that the function node_gallery_get_gallery_images in the node_gallery.inc file (line 128) has a strange behaviour. There the sql statement for fetching the images is stored in the $sql variable. On line 137 and line 140 the $sql variable and its statement is passed to the db_query() function. When i remove the db_rewrite_sql() function so that the SQL statement gets directly to the query, all images are shown up and all seems to work correctly.

Has anybody the same problem? Or can anybody explain this very strange behaviour to me?

Thanks,

Niko

Comments

justintime’s picture

Category: bug » support

If removing db_rewrite_sql fixes the problem, then another module is causing the problem. This page shows what db_rewrite_sql is used for. The module in question will have an implementation of hook_db_rewrite_sql().

More than likely, this is being done by an *_access module, like content_access, node_access, etc.

HTH!

nikolai fischer’s picture

Hi Justintime,

thanks for your comment and your hint to the hook_db_rewrite_sql(). I think i've not seen the forest for the trees :)

The only access module i use is menu_access but there's no hook_db_rewrite_sql function(nevertheless I deactivated it to see whats happening, but I had no luck). So I searched my whole modules folder for that - with Dreamweaver it tooks only an hour ;)

The only modules I've installed using the hook function are the i18n modules (core module, i18ntaxonomy, etc.). I'll fetch a backup of my project tomorrow morning in order to deactivate the i18n modules in a secure environment. I'll report to you what happens...

Greetings,

Niko

dddave’s picture

Status: Active » Fixed

No info, so I guess this is fixed by now....

Status: Fixed » Closed (fixed)

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

Jonathan Peterson’s picture

Adding a comment for those who might search for this in the future: I was seeing this behavior also, and traced it down.

In my case, I was using the node_type_filter module. This module was called in _db_rewrite_sql, and was adding the clause n.type IN ('node_gallery_gallery') to the SQL statement. As there are no galleries in galleries, an empty result set was being returned each time.

In short, not a node_gallery bug.

Still haven't decided how to address this, though...