function user_profile_form
user_profile_form($form, &$form_state, $account, $category = 'account')
Form builder; edit a user account or one of their profile categories.
See also
user_cancel_confirm_form_submit()
Related topics
File
- modules/user/user.pages.inc, line 283
- 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. $langcode = entity_language('user', $account); field_attach_form('user', $account, $form, $form_state, $langcode); } $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; }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/modules!user!user.pages.inc/function/user_profile_form/7.x