| Versionen | |
|---|---|
| drupal6 – drupal7 | user_profile_form($form_state, $account, $category = 'account') |
Form builder; edit a user account or one of their profile categories.
user_cancel_confirm_form_submit()
modules/
<?php
function user_profile_form($form_state, $account, $category = 'account') {
global $user;
$edit = (empty($form_state['values'])) ? (array) $account : $form_state['values'];
$form = _user_forms($edit, $account, $category);
// Attach field widgets.
field_attach_form('user', (object) $edit, $form, $form_state);
$form['_category'] = array('#type' => 'value', '#value' => $category);
$form['_account'] = array('#type' => 'value', '#value' => $account);
$form['submit'] = array('#type' => 'submit', '#value' => t('Save'), '#weight' => 30);
if (($account->uid == $user->uid && user_access('cancel account')) || user_access('administer users')) {
$form['cancel'] = array(
'#type' => 'submit',
'#value' => t('Cancel account'),
'#weight' => 31,
'#submit' => array('user_edit_cancel_submit'),
);
}
return $form;
}
?>
Kommentare
Kommentar hinzufügen