Hi guys,
Here is how to add "Forgot your password?" link just before the "Log in" button:
- find this line inside the drop_down_login.module:
Line 105:
if ($form_id == 'user_login') {
- insert this line right after it:
$form['link'] = array('#markup' => l(t('Forgot your password?'),'user/password'));
I also needed this added to drop_down_login\theme\drop_down_login.css to have some space between added link and "Log in" button (not only on the Drop Down Login form, but all user-login forms, e.g. user/login):
[id^="user-login"] .btn {
margin-top: 10px;
}
Thank you,
Gennady
Comments
Comment #1
gennadiy commentedComment #2
gennadiy commentedComment #3
nashkrammer commentedHi @gennadly,
Thanks for your inputs. I'll add the 'forgot password' link as you suggested. I am also working on a settings page for the same.
Thank You
-Avinash
Comment #4
dgregory commentedI think that a register link would be a great feature on the drop down login as well.
Comment #5
sdsheridanI'd do this slightly differently, as follows:
drupal_get_form, as follows:The parameter will get passed along to all alter functions in
$form_state['build_info']['args'](which is an array) as an array element.hook_form_altertohook_form_FORM_ID_alter, so that your function is only called for theuser_loginform, and not all forms. That way too, you don't have to test the$form_idin the "if" statement.Don't forget to clear caches if you're doing this real-time, so the hook information gets regenerated. Otherwise, you won't see the alterations to the form.
drop_down_login_form_user_login_alter, instead of checking the$form_id, test for the parameter passed, so you're only modifying the form you're generating for your dropdown, and not every user_login form everywhere:This will eliminate side-effects from your module colliding with how other modules may be modifying the regular user-login form, block, and page.
hook_form_user_login_alterfunction. The code below wraps both links inside their own divs, and then inside an overall div to facilitate theming and placement (via the#weightattribute in the outer div).Notice too I changed the double-quotes around
#validateand#submitto single quotes to avoid invoking PHP's string replacement feature, which is clearly not needed here, and thus improves performance a bit.I think these changes make the module a bit better performance-wise, and fully featured, with no side-effects on other modules.
Shawn
Comment #6
sdsheridanOh, and while we're at it, we could add a slight enhancement to the .js to place focus in the login name when the box drops down, as follows:
Shawn
Comment #7
sandeep.kumbhatil commentedAdded the link for Forgot password and Signup, Also added a setting form to enable / disable the same. Added feature to enable my account and extra links under drop down.
Comment #9
nashkrammer commentedHi,
This issue is fixed in the dev version. Initial as Sandeep added a configuration for the forgot passord link in the block, later the block is replaced with the one that is used by the core i.e "user_login_block" instead of "user_login". This allows to render "create new account" and "request new password" links by default.
Comment #10
sandeep.kumbhatil commented