Hi,
after upgrading from image module 5.x-2.0-alpha3 to 6.x-1.0-alpha4 I lost access to the image galleries.
Symptom: access to a gallery, e.g. image/tid/1917, results in "Zugriff verweigert" (= Access denied) for user #1 as well as for anonymous users; this error is displayed for users on the screen as well as in the watchdog log. The menu entry "Image galleries" points to www.mysite.org/image and lists the available galleries as well as the number of image nodes and an "last updated" timstamp.
As mentioned in 470720, during the upgrade from Drupal 5.18 to 6.12 the connections between image module and the gallery vocabulary are lost (as well as the connections between other vocabularies and custom content types; when upgrading, I followed the instructions from Drupal.org and disabled all modules before running update.php, then re-enabled the D6 versions of the modules again and re-run update.php several times, until no database updates were pending).
I restored the connection between the image content type and the "gallery" vocabulary at ./admin/content/taxonomy, however, the access problem remained. Individual image nodes can be displayed. ./admin/reports/status indicates no problems (all records "green"), e.g. "The imagemagick toolkit is installed", and "Galleries defined".
Any ideas or suggestions?
Greetings, -asb
Comments
Comment #1
joachim commentedSounds very weird.
The only access checks in the module at in hook_menu, so if you can get to /image, you can get to the galleries.
Do you have any access modules installed, such as access by taxonomy?
Are you sure your translation is working correctly? Is there any chance it is actually translating 'Page not found'?
Comment #2
asb commented> The only access checks in the module at in hook_menu, so if you can get to /image, you can get to the galleries.
Hmm... I rebuilt permissions through ./admin/content/node-settings, that changed nothing regarding to the image gallery.
> Do you have any access modules installed, such as access by taxonomy?
No access control module is running/enabled, and no access control module was installed (except Drupal core and CCK; even the "Content Permissions" module is disabled) - this is a very fresh site (about one week old ;), and it's pretty simple, not even stuff like pathauto is running yet.
> Are you sure your translation is working correctly? Is there any chance it is actually translating 'Page not found'?
Checked that by setting the default language back to English:
Also I tried to disable and re-enable the "image gallery" and "image" modules, and to run update.php just once more; this showed no errors, and it had no noticeable effect.
Available permissions at ./admin/user/permissions for "image_gallery module": just "administer images".
The "Gallery" vocabulary is configured for Freetagging and Multiple Selections, but not Required. For the "Image" content type, there are also three other vocabularies enabled.
Overview:
Is there anything that I could enable for debugging or verbose error logging?
Thanks & greetings, -asb
Comment #3
joachim commentedCheck you have 'access content' granted to users. That's the check on gallery pages.
If that isn't the problem, and if you're comfortable messing with code, can you install devel module and do a test dsm() output in the image_gallery_page function please, to check the code gets there?
Comment #4
asb commented> Check you have 'access content' granted to users. That's the check on gallery pages.
Granted to all users; and "Access denied for user #1" which should have all permissions anyway.
> If that isn't the problem, and if you're comfortable messing with code, can you install devel module and do a test dsm() output in the
> image_gallery_page function please, to check the code gets there?
If you can instruct me where to put what, I hope can do this. "Devel" is installed, but nothing enabled but "Devel" itself and a block with features like devel/elements, and devel/variable. In sites/all/modules/image/contrib/image_gallery/image_gallery.module, I located this function:
What to do now?
Thanks & greetings, asb
Comment #5
joachim commentedJust add a test output line at the top of that function, like this:
Comment #6
asb commentedWell, if I insert
dsm('the code gets to the gallery page function');into image_gallery.module, and access ./image, it prints "the code gets to the gallery page function" at the top of the image gallery page. When clicking on gallery like ./image/tid/1918, it prints nothing and outputs the "access denied" error. That's all, no nifty Krumo page or something helpful for a non-coder like me.In "Pro Drupal Development", VanDyke writes about "Creating a Module-Based Vocabulary" and uses the image gallery module as an example: "It creates its vocabulary programmatically [...], and assumes ownership of the vocabulary by setting the module key of the $vocabulary array to the module name [...]" (p. 337 s). That makes me suscpicious since I do not understand that "assume ownership" part. If I query the database, I get:
That's pretty much the array from _image_gallery_get_vid(); is this vocabulary ownership somewhere evaluated? Could this have changed between image modules for D5 and D6, or have been malformed during the upgrade process?
Digging further in muddy water (meaning: not knowing what I'm talking about): Why generates "image gallery" module a path to it's galleries like ./image/tid/1918? Normal/other taxonomy paths look like so: ./taxonomy/term/1977. Funny: ./image/term/1918 does work, and displays the (sub-) galleries! (and also prints "the code gets to the gallery page function")
Clicking on the first gallery (./image/tid/2133) again results in the "access denied" error; changing the url in the browser location bar to ./image/term/2133 gives me "the code gets to the gallery page function" - and the gallery!!!
Greetings and a good night,
-asb
Comment #7
matthiassamwald commentedI also get the "access denied" error described by asb. I also set all of the necessary permissions, but it does not help. I can also subsitue 'tid' with 'term' in the URL, which makes it work.
Comment #8
joachim commentedFirstly, the term/tid thing. It's a historical quirk of this module that the path 'tid' is used. In fact, this piece of the path is completely unused and ignored. You could access your galleries at 'image/boogaloo/1918' just as well. It's actually fairly primitive code, as you could use it to show images with terms from any other vocabulary.
#6 shows that when at the path /image/tid/1918, it's not actually image module that's handling the request.
My guess is that both of you have another module whose hook_menu is defining something more specific than the path 'image'. Or you've set up a URL alias, or something like that.
Comment #9
sunViews?
Comment #10
asb commented@sun (#9):
I checked this by disabling Views (and everything depending on it); the "access denied" error remains.
@joachim (#8):
> #6 shows that when at the path /image/tid/1918, it's not actually image module that's handling the request.
I checked this, also, by disabling as much contributed modules as possible. And once again you're right. Full list of enabled modules when image_gallery started to handle galleries/sub-galleries:
Now I'll enable the other modules one by one, until I can spot the path hijacker.
Edit: Found the bad guy; in my case, it's the Edit Term module (related issue: 474200). Should we close this issue since "image gallery" seems not to cause the problem?
Greetings, -asb
Comment #11
asb commentedChanging status to "by design" (we need an status like "incompatibility")
Comment #12
joachim commentedfrom edit_term_menu():
The problem is that edit term is trying to be helpful and integrate with image_gallery. It's doing this the proper way by using the cool stuff in the D6 menu system -- using the loading system with the % wildcard.
Meanwhile, image_gallery is still using ancient code that just registers the path at /image and then does the rest itself by looking at the arguments.
So edit_term registers the path 'image/tid/%' for the tabs to work, but doesn't supply the callback, and image_gallery hasn't given any 'real' data for that path to get handled. Result: access denied, for various complex reasons in the menu system (maybe because there's no user access callback?)
We could probably fix this by rewriting the menu code to use a loader.
The thing is, I want to move this module towards making galleries with views (#405456: Galleries made with views -- testers needed!), so I don't see that fixing the menu stuff here is a particularly good use of time. But I'll set this to active anyway -- if someone wants to provide a patch, we can commit it.
Comment #13
asb commentedHi,
Dan already provided an updated version of "edit term" which solves the issue - I don't know if fixing something that is doing it the proper way to make something work that uses ancient code is a good thing, but "edit term" and "image gallery" is working again for me.
However, #405456 sounds really interesting and I'll have a look at this ;)
Greetings, -asb
Comment #14
joachim commentedOk in which case let's close this again. Efforts are best concentrated on views integration.