Index: modules/user/user.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/user/user.admin.inc,v retrieving revision 1.67 diff -u -p -r1.67 user.admin.inc --- modules/user/user.admin.inc 11 Aug 2009 11:47:58 -0000 1.67 +++ modules/user/user.admin.inc 13 Aug 2009 00:59:40 -0000 @@ -6,22 +6,13 @@ * Admin page callback file for the user module. */ -function user_admin($callback_arg = '') { - $op = isset($_POST['op']) ? $_POST['op'] : $callback_arg; - - switch ($op) { - case t('Create new account'): - case 'create': - $build['user_register'] = drupal_get_form('user_register'); - break; - default: - if (!empty($_POST['accounts']) && isset($_POST['operation']) && ($_POST['operation'] == 'cancel')) { - $build['user_multiple_cancel_confirm'] = drupal_get_form('user_multiple_cancel_confirm'); - } - else { - $build['user_filter_form'] = drupal_get_form('user_filter_form'); - $build['user_admin_account'] = drupal_get_form('user_admin_account'); - } +function user_admin() { + if (!empty($_POST['accounts']) && isset($_POST['operation']) && ($_POST['operation'] == 'cancel')) { + return drupal_get_form('user_multiple_cancel_confirm'); + } + else { + $build = drupal_get_form('user_filter_form'); + $build['user_admin_account'] = drupal_get_form('user_admin_account'); } return $build; } Index: modules/user/user.module =================================================================== RCS file: /cvs/drupal/drupal/modules/user/user.module,v retrieving revision 1.1021 diff -u -p -r1.1021 user.module --- modules/user/user.module 12 Aug 2009 12:36:05 -0000 1.1021 +++ modules/user/user.module 13 Aug 2009 00:59:41 -0000 @@ -1317,7 +1317,6 @@ function user_menu() { $items['admin/people'] = array( 'title' => 'People', 'page callback' => 'user_admin', - 'page arguments' => array('list'), 'access arguments' => array('administer users'), 'weight' => -4, ); @@ -1328,7 +1327,8 @@ function user_menu() { ); $items['admin/people/create'] = array( 'title' => 'Add user', - 'page arguments' => array('create'), + 'page callback' => 'drupal_get_form', + 'page arguments' => array('user_register'), 'access arguments' => array('administer users'), 'type' => MENU_LOCAL_TASK, ); @@ -1400,8 +1400,8 @@ function user_menu() { $items['user/%user/edit'] = array( 'title' => 'Edit', - 'page callback' => 'user_edit', - 'page arguments' => array(1), + 'page callback' => 'drupal_get_form', + 'page arguments' => array('user_profile_form', 1), 'access callback' => 'user_edit_access', 'access arguments' => array(1), 'type' => MENU_LOCAL_TASK, Index: modules/user/user.pages.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/user/user.pages.inc,v retrieving revision 1.48 diff -u -p -r1.48 user.pages.inc --- modules/user/user.pages.inc 12 Aug 2009 12:36:05 -0000 1.48 +++ modules/user/user.pages.inc 13 Aug 2009 00:59:42 -0000 @@ -225,18 +225,6 @@ function template_preprocess_user_profil } /** - * Form builder; Present the form to edit a given user or profile category. - * - * @ingroup forms - * @see user_edit_validate() - * @see user_edit_submit() - */ -function user_edit($account, $category = 'account') { - drupal_set_title($account->name); - return drupal_get_form('user_profile_form', $account, $category); -} - -/** * Form builder; edit a user account or one of their profile categories. * * @ingroup forms @@ -247,6 +235,8 @@ function user_edit($account, $category = function user_profile_form($form_state, $account, $category = 'account') { global $user; + drupal_set_title($account->name); + $edit = (empty($form_state['values'])) ? (array)$account : $form_state['values']; $form = _user_forms($edit, $account, $category); @@ -262,7 +252,7 @@ function user_profile_form($form_state, '#type' => 'submit', '#value' => t('Cancel account'), '#weight' => 31, - '#submit' => array('user_edit_cancel_submit'), + '#submit' => array('user_profile_form_cancel_submit'), ); } @@ -309,7 +299,7 @@ function user_profile_form_submit($form, /** * Submit function for the 'Cancel account' button on the user edit form. */ -function user_edit_cancel_submit($form, &$form_state) { +function user_profile_form_cancel_submit($form, &$form_state) { $destination = ''; if (isset($_REQUEST['destination'])) { $destination = drupal_get_destination(); @@ -323,7 +313,7 @@ function user_edit_cancel_submit($form, * Form builder; confirm form for cancelling user account. * * @ingroup forms - * @see user_edit_cancel_submit() + * @see user_profile_form_cancel_submit() */ function user_cancel_confirm_form(&$form_state, $account) { global $user; @@ -517,30 +507,6 @@ function user_cancel_confirm($account, $ drupal_access_denied(); } -function user_edit_validate($form, &$form_state) { - user_module_invoke('validate', $form_state['values'], $form_state['values']['_account'], $form_state['values']['_category']); - // Validate input to ensure that non-privileged users can't alter protected data. - if ((!user_access('administer users') && array_intersect(array_keys($form_state['values']), array('uid', 'init', 'session'))) || (!user_access('administer permissions') && isset($form_state['values']['roles']))) { - watchdog('security', 'Detected malicious attempt to alter protected user fields.', array(), WATCHDOG_WARNING); - // set this to a value type field - form_set_error('category', t('Detected malicious attempt to alter protected user fields.')); - } -} - -function user_edit_submit($form, &$form_state) { - $account = $form_state['values']['_account']; - $category = $form_state['values']['_category']; - unset($form_state['values']['_account'], $form_state['values']['op'], $form_state['values']['submit'], $form_state['values']['cancel'], $form_state['values']['form_token'], $form_state['values']['form_id'], $form_state['values']['_category'], $form_state['values']['form_build_id']); - user_module_invoke('submit', $form_state['values'], $account, $category); - user_save($account, $form_state['values'], $category); - - // Clear the page cache because pages can contain usernames and/or profile information: - cache_clear_all(); - - drupal_set_message(t('The changes have been saved.')); - return; -} - /** * Access callback for path /user. *