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 Vahan Sargsyan on
Hi everyone,
How can I lock the default e-mail field (make it read only), so that users will not be able to change their e-mail addresses after registering.
Thanks
Comments
Fast
In you custom module put:
This will not work because
This will not work because when the field is disabled, browser does not send the value back, triggering a "Email field is required" error.
If you set #disabled, set #value as well.
What's new and changing in PHP 8
It works
Already using it.
There was a module to prevent
There was a module to prevent users from editing certain fields, including email and password but I couldn't find that right now. See modules list.
Alternately you can use Email Change Confirmation module so everytime the user changes his email address, they have to verify it.
http://drupal.org/project/email_confirm
What's new and changing in PHP 8
There is a contributed module
There is a contributed module called "User Read-Only" (http://drupal.org/project/user_readonly)
I guess, this module will fulfill your requirement
Thank you
Thank you very much, this is that what I wanted
Pleasure! Nice to know that
Pleasure! Nice to know that the module solved your problem.
All the best