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.
By AshwinB on
I want to remove the descriptions on login page. I tried removing it from user.module, but still it showed up. I am using Form placeholder module and Betterlogin module to enhance the login page. Please suggest.
Comments
=-=
per: https://www.drupal.org/node/644164 please edit the opening post and move it to the 'post installation' forum.Thank you.Use hook_form_alter
Please do as VM said.
Please have a look at the code snipped and try to reproduce such thing in your custom module.
This will remove the description below the Login Form fields.
I don't have any custom
I don't have any custom developed modules. 'Betterlogin' and 'Form Placeholder' modules are already available. I already tried inserting the code you suggested in betterlogin.module and form_placeholder.module. But this resulted in a fatal error. Am I missing anything?
=-=
you do not hack core or other modules and add code. You put code in your own custom.module. see: http://websmiths.co/blog/very-introduction-drupals-hookformalter for a better understanding. Also of note you will need to modify the snippet provided. You can't just add it.
Else use CSS to hide the element.
Never Hack Core
Amaster123,
You cannot just add the provided code in betterlogin.module please check https://www.drupal.org/best-practices/do-not-hack-core
You need to create a custom module for that, Link shared by VM is very useful, please refer it.
Thanks!
Ok. Thanks for this important
Ok. Thanks for this important know-how.!
I did exactly as told in
I did exactly as told in https://www.drupal.org/node/754542#comment-2775706 But this also didn't worked. Are there any modifications to make? (as I am a beginner in this field, still learning).
As mentioned in https://www
As mentioned in https://www.drupal.org/node/2351093#comment-9221203 by VM, what modifications do I need to make in
=-=
what is the name of your module? did you include it in the function name? show us the code you yourself wrote.
I made two files.
I made two files.
1. alterlogin.info
2. alterlogin.module
alterlogin.info
alterlogin.module
I placed these two files in a folder named 'alterlogin' and placed the folder in sites/all/modules directory; enabled the module; cleared the cache; and nothing seems to work.
As a note:- when I was reading betterlogin.module, I found
Is this anything that matters?
=-=
note the function name in your snippet above. Then refer back to the this thread where you are pulling the alterlogin.module snippet. See the differences in the function name?
also of note you switched the code you were provided
with:
why?
have you tried something like the following?:
If it still doesn't work, I'd disable and uninstall the better login module and test.
This worked.. (My Bad)
Thanks...VM...All my mistake. Actually the
function alterlogin_form_user_login_alter(&$form, &$form_state)
didn't worked. But what I did, was, I addedIn the css of betterlogin module.
=-=
you shouldn't be hacking files. CUSTOM CSS should go into your own custom.css file within your subtheme.
When you update core or a module changes will be overwritten when you hack files.
Name of Module
The hook that VM gave you should have worked. Keep in mind that from my understanding modules are loaded alphabetically (or weight if assigned) so that what you wrote in the Afterlogin module might have gotten overridden by a module that came after it.
Cheers,
Drupal Development and Consulting.
Targeting the wrong element
I realise this is an old thread but the problem is you were targeting the wrong element. It should have been:
unset($form['account']['name']['description']);