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
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
You can achieve that by using hook_form_alter() in your template.php, there is an elaborate solution here: http://drupal.org/node/1241204#comment-7057244
*The following code was created by Isabug at the previous link:
/**
* Implements hook_form_alter().
*/
function mytheme_form_user_profile_form_alter(&$form, &$form_state, $form_id) {
global $user;
$roles = $user->roles;
if(in_array('administrator', $roles)) {
return;
}
$form['account']['mail']['#disabled'] = TRUE;
}
Cheers,
You can disable email field using jquery,
Set the disabled attribute.
$("yourIdorClassforemailfield").attr('disabled','disabled');
To enable again
$("yourIdorClassforemailfield").removeAttr('disabled');