Only one line to change, so no patch and I leave this as active
PROBLEM
User keeps getting logged out of Drupal every time she visits either a Gallery page or a Gallery block config page within Drupal. This is reported as a secondary issue in several threads on other issues and in Wahkah' blog, so it seems pretty wides spread.
REASON
Every time you go to a Gallery page, Gallery generates a new session id. This is because for Drupal user #1, the user name is hard coded into the gallery.module. If you are using a name other than 'admin' for Drupal, it won't work.
In /modules/gallery/gallery.module, line 259 of current CVS, function _galler_init(), the code is:
list ($ret, $user) = GalleryCoreApi::fetchUserByUsername('admin');
RESOLUTION
To work properly for users who have set up Drupal using some other name for the admin, this needs to use the $user object to grab the username, just as it uses it to grab the user ID.
list ($ret, $user) = GalleryCoreApi::fetchUserByUsername($user->name);
This works for me.
Comments
Comment #1
MartinA-1 commentedAnother one having the problem. Unfortunately the patch did not work for me. Tried before and after patching as admin and other user name. Symptoms as described - access to the blocks causes 'access denied error'. Logging in again is ok until...
For testing I installed the gallery module with gallery2 on another drupal system. The symptoms were different: enabling the module worked fine. Checking administer / settings / gallery is fine. When I try to place one or both of the block, after hitting save, the page comes back as it was before. No error. The block stays in 'disabled' so not really activated (???) and the tickmark is still in the box. Shutting down browser (Firefox 1.06) starting up again: blank page, no content. Remove the gallery folder from module directory press reload and all is fine.
Two different installations, both having trouble.
Using in both: Slackware 10.1, Drupal 4.6.2, gallery module 1.4.2.1 2005/04/26
Comment #2
ergophobe commentedSorry that didn't help. I think there are a lot of complicated issues with the gallery module which is trying to bridge between two relatively large, complicated systems. I also set $full to 'true' in the gallery module to solve another problem with user ids not being passed. That may also have some interaction with the admin getting logged out, but I'm not sure.
Unfortunately, I've spent hours tracing interactions through the module and the Gallery embedding code and haven't gotten very far. I need to focus on other stuff for a while and so I've just given up on the Gallery module as I have yet to get a single component of it to work. Some crash drupal, some just seem to have no effect at all. The only one that has worked in any sense is the one that puts a random image in a block, but that generates the wrong URL (as another issue has mentioned) so I consider that to be a non-critical but significant error.
What gets me is that many people seem to be using the gallery module with no problems at all, and yet I've tried multiple different installs under a variety of conditions and the best I can do is to get it to not log me out and not crash drupal! That helps with the rest of the debugging, but I'm still a far cry from getting it to actually add functionality to Drupal.
Comment #3
MartinA-1 commentedHi Rick, thanks for having another look. Guess its a basic feature of bugs that they don't show up consistantly. I spent a good amount of time looking through the forum and old issues. Seems 'gallery' or rather the actual program has not found the most enthusiasm in the past. Or rather that enthusiasm was always dampened after a while of fighting problems. I am thinking of al's posts which started around 2003.
Not sure if I will pursue 'gallery' as an option for having a gallery. Currently looking at other paths to take. It would be nice though to have a Drupal solution. Well, and one that goes beyond 'image' :)
Comment #4
ergophobe commentedKeep in mind that Gallery 2, for which this module is designed, is at this writing just out of beta and into release candidate status. The API has evolved fairly recently and it is not unexpected that this module would have troubles hitting a moving target. Gallery of 2003 has nothing to do with Gallery of late 2005 - it's a total rewrite and my experience is that it is quite nice.
Gallery and Drupal have both reached the stage where the APIs are stable for the time being. I'm sure that in time the gallery integration will also be stable and have all the issues ironed out.
Comment #5
MartinA-1 commentedGuess moving target is a good description. Looking at forums on the gallery website (http://gallery.menalto.com) I find more hints of problems. For that sake of it, I installed Gallery 1.5.1-RC2 Preview Release. No problem connecting to it with Gallery Remote which also was not possible with G2.
Another promising attempt of was using image_pub which uses GR to access image.module, see: http://drupal.org/node/23645 I again have protocol problems (cannot find remote protocol) as I had with GR to G2. So you find a note of mine in there... Might have a look at nightly builds.
Guess things are very much in flux. Though I never know whether I blundered something up or there really is a bug :(
Comment #6
drazzig commentedFINALLY!!
Thank you very much. I was the one you were reffering to whose been posting all the messages on the message boards regarding this issue! I can't believe just one line of code has been causing me so many problems.
Good luck to everyone else still having problems and thanks a lot for the fix.
Draz
Comment #7
ergophobe commentedDraz,
So are you confirming that this worked for you as well? I mean, have you actually tried the code I posted, or was that just optimism?
Are you setting $full to true or false?
It would be nice to try to nail down why it's working for me and you, but not Martin.
Comment #8
drazzig commentedHi,
Yes, I'm using different names for my Admin (i.e. my admin is called Drazzig) so this fix works! However, I never played with the $full variable, not sure what that does. Just changed the line up above.
Draz
Comment #9
LukeLast commentedThis simple fix solved the problem for me, why would this not be commited to CVS?
Comment #10
alexandreracine commentedThis has been fixed in the latest release.
Hi, since there was some release lately please check out...
1- The G2 version 1.0 of gallery.
2- The latest version of this module.