You are here

function user_edit_form in Drupal 4

Same name and namespace in other branches
  1. 5 modules/user/user.module \user_edit_form()
  2. 6 modules/user/user.module \user_edit_form()
1 call to user_edit_form()
user_user in modules/user.module
Implementation of hook_user().

File

modules/user.module, line 1302
Enables the user registration and login system.

Code

function user_edit_form($uid, $edit) {

  // Account information:
  $form['account'] = array(
    '#type' => 'fieldset',
    '#title' => t('Account information'),
  );
  if (user_access('change own username') || user_access('administer users')) {
    $form['account']['name'] = array(
      '#type' => 'textfield',
      '#title' => t('Username'),
      '#default_value' => $edit['name'],
      '#maxlength' => 60,
      '#description' => t('Your full name or your preferred username: only letters, numbers and spaces are allowed.'),
      '#required' => TRUE,
    );
  }
  $form['account']['mail'] = array(
    '#type' => 'textfield',
    '#title' => t('E-mail address'),
    '#default_value' => $edit['mail'],
    '#maxlength' => 64,
    '#description' => t('Insert a valid e-mail address. All e-mails from the system will be sent to this address. The e-mail address is not made public and will only be used if you wish to receive a new password or wish to receive certain news or notifications by e-mail.'),
    '#required' => TRUE,
  );
  $form['account']['pass'] = array(
    '#type' => 'password_confirm',
    '#title' => t('Password'),
    '#description' => t('To change the current user password, enter the new password in both fields.'),
  );
  if (user_access('administer users')) {
    $form['account']['status'] = array(
      '#type' => 'radios',
      '#title' => t('Status'),
      '#default_value' => $edit['status'],
      '#options' => array(
        t('Blocked'),
        t('Active'),
      ),
    );
  }
  if (user_access('administer access control')) {
    $roles = user_roles(1);
    unset($roles[DRUPAL_AUTHENTICATED_RID]);
    if ($roles) {
      $form['account']['roles'] = array(
        '#type' => 'checkboxes',
        '#title' => t('Roles'),
        '#default_value' => array_keys((array) $edit['roles']),
        '#options' => $roles,
        '#description' => t('The user receives the combined permissions of the %au role, and all roles selected here.', array(
          '%au' => theme('placeholder', t('authenticated user')),
        )),
      );
    }
  }

  // Picture/avatar:
  if (variable_get('user_pictures', 0)) {
    $form['picture'] = array(
      '#type' => 'fieldset',
      '#title' => t('Picture'),
      '#weight' => 1,
    );
    $picture = theme('user_picture', (object) $edit);
    if ($picture) {
      $form['picture']['current_picture'] = array(
        '#type' => 'markup',
        '#value' => $picture,
      );
      $form['picture']['picture_delete'] = array(
        '#type' => 'checkbox',
        '#title' => t('Delete picture'),
        '#description' => t('Check this box to delete your current picture.'),
      );
    }
    else {
      $form['picture']['picture_delete'] = array(
        '#type' => 'hidden',
      );
    }
    $form['picture']['picture_upload'] = array(
      '#type' => 'file',
      '#title' => t('Upload picture'),
      '#size' => 48,
      '#description' => t('Your virtual face or picture.  Maximum dimensions are %dimensions and the maximum size is %size kB.', array(
        '%dimensions' => variable_get('user_picture_dimensions', '85x85'),
        '%size' => variable_get('user_picture_file_size', '30'),
      )) . ' ' . variable_get('user_picture_guidelines', ''),
    );
  }
  return $form;
}