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

In you custom module put:

<?php
function YOUR_MODULE_form_user_profile_form_alter(&$form, &$form_state) {
   
$form['account']['mail']['#disabled'] = TRUE;
}
?>

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.

// Ayesh

Already using it.

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

// Ayesh

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 very much, this is that what I wanted

Pleasure! Nice to know that the module solved your problem.
All the best