
Drupal 6. Disable mail field on the user account page
Julia 08/06/2010
If you need to make email field disabled, it won't be anough just make it #disabled.
You have to add the same hidden field:
<?php
function [modulename]_form_alter(&$form, $form_state, $form_id) {
global $user;
switch ($form_id) {
case 'user_profile_form':
if ($user->uid != 1){
// fields must have a hidden field w/ proper value as disabled fields are not submitted.
$form['account']['readonly']['mail'] = $form['account']['mail'];
$form['account']['readonly']['mail']['#type'] = 'hidden';
$form['account']['mail']['#disabled'] = TRUE;
}
break;
}
}
?>
Post new comment