| 6 user.pages.inc | user_profile_form($form_state, $account, $category = 'account') |
| 7 user.pages.inc | user_profile_form($form, &$form_state, $account, |
| 8 user.pages.inc | user_profile_form($form, &$form_state, $account) |
Form builder; edit a user account or one of their profile categories.
See also
user_cancel_confirm_form_submit()
Related topics
3 string references to 'user_profile_form'
File
- modules/
user/ user.pages.inc, line 244 - User page callback file for the user module.
Code
function user_profile_form($form, &$form_state, $account, $category = 'account') {
global $user;
// During initial form build, add the entity to the form state for use during
// form building and processing. During a rebuild, use what is in the form
// state.
if (!isset($form_state['user'])) {
$form_state['user'] = $account;
}
else {
$account = $form_state['user'];
}
// @todo Legacy support. Modules are encouraged to access the entity using
// $form_state. Remove in Drupal 8.
$form['#user'] = $account;
$form['#user_category'] = $category;
if ($category == 'account') {
user_account_form($form, $form_state);
// Attach field widgets.
field_attach_form('user', $account, $form, $form_state);
}
$form['actions'] = array('#type' => 'actions');
$form['actions']['submit'] = array(
'#type' => 'submit',
'#value' => t('Save'),
);
if ($category == 'account') {
$form['actions']['cancel'] = array(
'#type' => 'submit',
'#value' => t('Cancel account'),
'#submit' => array('user_edit_cancel_submit'),
'#access' => $account->uid > 1 && (($account->uid == $user->uid && user_access('cancel account')) || user_access('administer users')),
);
}
$form['#validate'][] = 'user_profile_form_validate';
// Add the final user profile form submit handler.
$form['#submit'][] = 'user_profile_form_submit';
return $form;
}
Login or register to post comments