user_edit

Versions
4.6 – 5
user_edit($category = 'account')
6
user_edit($account, $category = 'account')

Code

modules/user.module, line 1400

<?php
function user_edit($category = 'account') {
  global $user;

  $account = user_load(array('uid' => arg(1)));
  if ($account === FALSE) {
    drupal_set_message(t('The account does not exist or has already been deleted.'));
    drupal_goto('admin/user');
  }
  $edit = $_POST['op'] ? $_POST['edit'] : (array)$account;

  if (arg(2) == 'delete') {
    $form = array();
    $form['account'] = array('#type' => 'value', '#value' => $account);
    return confirm_form('user_confirm_delete', $form, t('Are you sure you want to delete the account %name?', array('%name' => theme('placeholder', $account->name))), 'user/'. $account->uid, t('All submissions made by this user will be attributed to the anonymous account. This action cannot be undone.'), t('Delete'), t('Cancel'));
  }
  else if ($_POST['op'] == t('Delete')) {
    if ($_REQUEST['destination']) {
      $destination = drupal_get_destination();
      unset($_REQUEST['destination']);
    }
    // Note: we redirect from user/uid/edit to user/uid/delete to make the tabs disappear.
    drupal_goto("user/$account->uid/delete", $destination);
  }

  $form = _user_forms($edit, $account, $category);
  $form['_category'] = array('#type' => 'value', '#value' => $category);
  $form['_account'] = array('#type' => 'value', '#value' => $account);
  $form['submit'] = array('#type' => 'submit', '#value' => t('Submit'), '#weight' => 30);
  if (user_access('administer users')) {
    $form['delete'] = array('#type' => 'submit', '#value' => t('Delete'), '#weight' => 31);
  }
  $form['#attributes']['enctype'] = 'multipart/form-data';

  drupal_set_title(check_plain($account->name));
  return drupal_get_form('user_edit', $form);
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.