function user_edit in Drupal 5
Same name and namespace in other branches
- 4 modules/user.module \user_edit()
- 6 modules/user/user.pages.inc \user_edit()
1 string reference to 'user_edit'
- user_menu in modules/
user/ user.module - Implementation of hook_menu().
File
- modules/
user/ user.module, line 1441 - Enables the user registration and login system.
Code
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/user');
}
$edit = $_POST['op'] ? $_POST : (array) $account;
if (arg(2) == 'delete') {
return drupal_get_form('user_confirm_delete', $account->name, $account->uid);
}
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 $form;
}