Posted by tim.plunkett on May 30, 2011 at 1:29am
4 followers
| Project: | LoginToboggan |
| Version: | 7.x-1.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (fixed) |
Issue Summary
As a follow-up to #886878: add option to show registration form rather than login on access denied pages, it would be nice if the unified login could be shown on 403.
I thought adding yet another checkbox to the admin UI was too much, and I think this is the expected behavior.
If you want another checkbox, I can do that too.
| Attachment | Size |
|---|---|
| logintoboggan-unified_on_403.patch | 537 bytes |
Comments
#1
This patch works and is what I had expected from normal functionality. If you select unified login for the normal login/register, that same setting should apply to the 403/access denied page as well.
#2
so, try the attached patch. untested, but i think it will accomplish the goal and fix those issues noted above.
#3
further refinement, broke the generation of the unified login form out into a separate function from the full page generation. this cleans up the usage of the unified login form nicely.
light testing seems to show everything working, but i would like confirmation from somebody else here before i commit.
#4
My only nitpick:
+++ b/logintoboggan.moduleundefined@@ -888,11 +872,61 @@ function _logintoboggan_toggleboggan ($form) {
+function logintoboggan_get_authentication_form($active_form = 'login') {
+ $output = '';
+ if (variable_get('logintoboggan_unified_login', 0)) {
+ $output = logintoboggan_unified_login_form($active_form);
+ }
+ elseif ($active_form == 'login') {
+ $output = drupal_get_form('user_login');
+ }
+ elseif ($active_form == 'register') {
+ $output = drupal_get_form('user_register_form');
+ }
+ return $output;
Why not just return instead of instantiating a variable? And then they could be if() not elseif()
#5
the caller is expecting a string, this is a clean way to always return a string. i also find it easier to debug code when you put something in a variable first before returning it (easier to toss in a var_dump()).
#6
did a bit more testing, and i think this is good to go. committed to 7.x-1.x.
#7
Automatically closed -- issue fixed for 2 weeks with no activity.