Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I suggest adding text like this to the project page:
A simple way to do this without a module is to go to on your site to admin/config/system/site-information and set "Default 403 (access denied) page" to "/user/login". This works in Drupal 8 and perhaps earlier versions as well.
For many people, that will do what they need without the need for a module.
Comment | File | Size | Author |
---|---|---|---|
#6 | R4032.PNG | 10.77 KB | AdamPS |
#6 | PanelsBlock.PNG | 11.65 KB | AdamPS |
#6 | UserLogin.PNG | 6.67 KB | AdamPS |
Comments
Comment #2
AdamPS CreditAttribution: AdamPS at AlbanyWeb commentedThanks for the idea - cunning. However I'm not sure I would recommend it, except as a short term solution whilst waiting for a stable release.
Comment #3
Liam MorlandSearch engines should not index the page because it will have HTTP status 403.
Comment #4
AdamPS CreditAttribution: AdamPS at AlbanyWeb commented@Liam Morland Sorry, you are quite right. I got confused, because the page looks like the login page, and doesn't say "access denied" but of course it is still a 403.
And I've just checked my third point is fine too. Although I was initially nervous about the idea of relying on /user/login to generate an access denied when already logged in, actually it does generate exactly the right message.
So I am starting to realise the benefits of your suggestion, thank you, but that leaves just the first point - there is no message to say "access denied". I feel it would be better to set the 403 page to something that shows a clear access denied message as normal, and then put the login block underneath provided the user is not already logged in. And it should be possible to make a page exactly like that using panels or perhaps with a hook. I will experiment and report any useful ideas here in case it helps anyone else.
This approach is neat because it generates a real 403. This avoids problems like #2855531: Web service requests recieve incorrect status code and the need for the module config parameter r4032login_match_noredirect_pages.
Comment #5
Liam MorlandYes, it would be better if the "access denied" message was present. I like that this method means that the URL doesn't change.
Comment #6
AdamPS CreditAttribution: AdamPS at AlbanyWeb commentedSome experimentation and screenshots.
1) "/user/login". No "Access denied" message. Action links (create/reset password) are missing.
2) Panels+page manager+custom block+login block. (~5 modules and a lot more work than enabling the r4032 module!). Access denied message. Action links are bullets underneath.
3) This module, r4032login. Access denied message. Proper action links. However URL does change.
Your idea is a good one, but in the end I think I might use r4032login.
Comment #7
Liam MorlandI see action links on my site:
https://traditionalscouting.ca/members/handbooks-forms-documents/
Comment #8
AdamPS CreditAttribution: AdamPS at AlbanyWeb commentedInteresting. I can't figure out what I am missing.
Comment #9
Nixou CreditAttribution: Nixou at Actency commented@Liam Morland, your suggestion is interesting.
However, I think it's not the goal of module project page to explain how to not use the module.
Actually, r4032login provide more features than just displaying the login form on a 403 page and the behavior is quite different than the one you propose.
Maybe you can add a documentation page on drupal.org to provide your tips for other users.
Comment #10
AdamPS CreditAttribution: AdamPS at AlbanyWeb commented@Nixou thanks for your time.
Actually it was @Liam Morland that raised the issue - I just joined in later. I mostly came along because the module does not yet have a release. If we could have a beta release then hopefully the need for alternative approaches would be less. Thanks!
Comment #11
Nixou CreditAttribution: Nixou at Actency commentedYes sorry I was wrong on the pseudonym, I just fixed it in my comment above.
Yeah the goal is to fix all actual issues in 2 next weeks and then I'll release a alpha, beta or stable version (not sure yet).
Comment #12
AdamPS CreditAttribution: AdamPS at AlbanyWeb commentedGreat news, thanks!
Comment #13
Liam MorlandThis is documented on "Redirecting anonymous users to the login page on Access Denied".