[development] Disabling E-mail field in User Account > Edit

Adrian Rossouw adrian at bryght.com
Sun Dec 11 15:03:19 UTC 2005


On 11 Dec 2005, at 3:49 PM, Toufeeq Hussain wrote:

> Hi,
>
> I'm trying to disable the e-mail and user_name filed in the User
> Account Edit page.
> These details will be populated from LDAP so an user should not be
> able to edit them.

This can be easily done using Drupal 4.7 :

function mymodule_form_alter($form_id, $form) {
   if ($form_id == 'user_edit') {
     $form['account']['name']['#type'] => 'value';
     $form['account']['email]['#type'] => 'value';
   }

   return $form;
}

For 4.6 you will have to edit the module.

--
Adrian Rossouw
Drupal developer and Bryght Guy
http://drupal.org | http://bryght.com




More information about the development mailing list