I am using Gallery2 and the gallery.module and it works quite well with registered users.
But when I try to access the gallery page as guest the module redirects me to the login page.
This is not what I expected. Guest users should be presented the guest view of gallery2.
When a registered user logs into gallery2 and switches to guest view, guest view is shown correctly,
but not for anonymous users!
Is this a bug or a feature?
What can I do to present my guest users the gallery2 guest view?
Greetings Thilo
Comments
Comment #1
michelleNeither, as far as I know. It sounds like you have something set wrong on your install as the embedded G2 works just fine for not logged in users.
Sorry that's not much help for fixing your actual problem, but maybe that narrows it down to know that this generally works and the problem is specific to your install.
Michelle
Comment #2
profix898 commentedThank you. Yes, it is good to know that the issue is limited to my installation.
But at the moment I don't have any clue where to start my diagnosis.
As I mentioned above for registered users everything is working perfectly.
Do you have any idea what might cause my trouble?
What is the code for guest different from that registered users?
Thilo
Comment #3
kiz_0987 commentedWhat version of gallery.module are you using? Can you send a link to your page (PM me if necessary) if it's public.
Comment #4
kiz_0987 commentedThanks for the site access. I've looked around and your setup seems generally fine, although I wonder about the settings you have for embedded URL Rewrite. It looks to me that this will use the same .htaccess file as Drupal, which is not correct I think.
The error that you get on guest access is the addition of what looks like a Drupal URL at the end -- gallery2/user/login. This may be something weird on G2 URL rewrite, but I also wonder about your use of i18n. I seem to remember people having issues with that at rewritten URLs.
I suggest, first turn off (deactivate and uninstall) URL Rewrite in G2. If that works, turn it back on and change the embedded URL rewrite options as above. If that fails, try deactivating i18n and see if that helps.
Please let us know what you did when you finally get it to work.
Comment #5
profix898 commentedNo, it does not. htaccess for Gallery2 is located under /files/profix898/gallery. Drupals htaccess lies in root path.
I agree, it does. Thats the reason why I thought this might be a problem with drupal and the module, and not with Gallery2.
I just uninstalled URLRewrite in Gallery2 AND deactivted i18n module in Drupal. Unfortunately it does not seem to have
the desired effect. Same behaviour like before. Even the weird URL "/gallery2/user/login" is still the same.
I also tried to deactivate URLRewrite in Drupal. Guest users are then redirected to Gallery2 Installer page.
(for registered users everything is fine)
Any more ideas? I will keep on trying, play with the config and try to find working settings. Maybe gallery.module interferes
with one of my other modules installed. I will try to figure out. Any help would be appreciated ;)
Thanks, Thilo
Comment #6
kiz_0987 commentedI didn't check this before, but if I check your site under gallery2 (ie unembedded) on http://site/gallery2 I get the G2 install page -- whether I'm logged in or not. When I go to the http://site/gallery or http://sites//files/profix898/gallery I get the gallery (embedded and non-embedded). I suspect now that something about your Multi-site install is causing the non-logged-in users to access the http://site/gallery2 instead. Not clear why yet -- I know that this can work as I have multiple sites working from the same Drupal and G2 codebase. It took me a while to get it to work -- can you run through the steps you made.
Comment #7
kiz_0987 commentedHere's how I've set up my multi-site to work.
Code base:
- Drupal: /basedir/public_html/
- G2: /basedir/public_html/gallery2
Site A:
- Added symbolic link to siteA in /basedir/public_html: /basedir/public_html/siteA -> /basedir/public_html
- Added the usual Drupal multi-site stuff in /basedir/public_html/sites
G2 Embedded URL Rewrite:
- Htaccess path: /basedir/sites/siteA (note this is outside of public_html as it is with my g2data dir)
- Public path: http://www.mysiteA.com/sites/siteA
Going to http://www.mysiteA.com/gallery gets me to the photo gallery for mysiteA.
Comment #8
profix898 commentedSorry, I was out for some hours, but now I got some time to answer your questions and give a report
what I tried to solve my problem.
0) I read your posting describing your setup with Drupal and Gallery2
- I cant neither use symbolic links nor put my data folder outside the "public_html" path as I do not
have root access to my webserver (sites are hosted on a shared server)
This is my "sitemap" (adapted from your posting)
CodeBase:
- Drupal: /userwww
- G2: /userwww/gallery2
SiteA:
- configuration: /userwww/sites/sitea
- public files for site a /userwww/files/sitea
(Yes, I read the discussion where to place public files, in sites/sitea/files or /files/sitea/ ;) )
G2:
- htaccess and configuration /userwww/files/sitea/gallery
- data dir /userwww/files/sitea/gallery/data (not possible to put this outside /userwww, see above)
1) I deactivated all modules not essential for drupal to work (including i18n and path) => failed
2) My "main" htaccess contains lots of rewrite rules to keep my site compatible with my obsolete static
version. So I replaced it with the clean version from drupal install archiv => failed
3) I also removed the subdomain gallery.sitea... to rule out another possibility => failed
4) I changed gallery path in module's settings to one of my other Gallery2 sites
(from /files/profxi898/gallery to /files/abi2000/gallery) => SUCCESS
Yes, it really seems to work with my configuration of drupal and Gallery2,
even with URLRewrite activated in Gallery2.
5) Encouraged by the success with the same drupal site but one different gallery (same codebase,
different config/data folder), I compared config.php and the vital settings of the two galleries but was
unable to find any obvious difference. The setup looks the same to me. => failed
Its already late, so I will continue research tomorrow morning. But now it seems like the problems lies
with Gallery2 and my gallery's configuration. I still dont know where! Access rights to config/data?
If you got any idea, please let me know.
Thilo
Comment #9
profix898 commentedYeah, finally I got it to work! :)
Its so simple:
You need to assign anonymous (guest) user rights to the galleries "root" album.
In my case all sub-albums were configured for specific user rights, but I never
realized that the main album has got its own. I cant remember but it seems like
I removed "view all versions" rights for "everybody" from main album.
I cant explain why G2 redirects anonymous users trying to access the album
to /gallery2/user/login path and not to /gallery/user/login or so, but since I granted
guest access the problem does not occur anymore.
Thank you for your help again kiz_0987!
Greetings Thilo
Comment #10
profix898 commentedSome remarks on previous comment:
I know why I removed guest access to main album. In the standalone version of G2 you can
have galleries with access to the entire content being restricted to registered users.
By denying anonymous access you can force all users to identify/login first.
But it is not possible to have "private-only" galleries with G2 embedded in Durpal.
I will review G2 code to have the "empty album" message appropriate.
For example: "This is an empty album or your must login to see the content".
Thilo
Comment #11
kiz_0987 commentedGood to hear that you got it working. I will add this to the FAQ at some point. One other similar item you may notice with URL rewrite is that if a photo is requested that is not there (eg a bad gallery/xxx link) there will be a gallery error generated instead of a 404. These issues kind of go together -- something to be fixed in the future hopefully.
Comment #12
profix898 commentedDrupal 4.6 is no longer supported (and/or issue is irrelevant for the current version). Closing.
Comment #13
daniel.hunt commentedMassive bump here - but this exact problem is happening for me with a clean Drupal 5.7 install, with the latest and greatest Gallery2 installation and module.
Anon users can't view the gallery - they're prompted with the login screen, regardless of the access rights of the anon user in drupal, or in gallery2.
Its setup as a multisite gallery, and accessing the gallery using the multisite url directly (/sites/*domain*/gallery2) works fine for anon.
Anyone have any ideas? I dont want to open a new bug if its just me being stupid :)