Index: modules/block/block.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/block/block.module,v
retrieving revision 1.355
diff -u -p -r1.355 block.module
--- modules/block/block.module	11 Aug 2009 14:16:55 -0000	1.355
+++ modules/block/block.module	11 Aug 2009 20:19:40 -0000
@@ -419,7 +419,7 @@ function block_box_save($edit, $delta) {
 /**
  * Implement hook_user_form().
  */
-function block_user_form(&$edit, &$account, $category = NULL) {
+function block_user_form(&$edit, $account, $category) {
   if ($category == 'account') {
     $rids = array_keys($account->roles);
     $result = db_query("SELECT DISTINCT b.* FROM {block} b LEFT JOIN {block_role} r ON b.module = r.module AND b.delta = r.delta WHERE b.status = 1 AND b.custom <> 0 AND (r.rid IN (:rids) OR r.rid IS NULL) ORDER BY b.weight, b.module", array(':rids' => $rids));
@@ -452,7 +452,7 @@ function block_user_form(&$edit, &$accou
 /**
  * Implement hook_user_validate().
  */
-function block_user_validate(&$edit, &$account, $category = NULL) {
+function block_user_validate(&$edit, $account, $category) {
   if (empty($edit['block'])) {
     $edit['block'] = array();
   }
Index: modules/blog/blog.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/blog/blog.module,v
retrieving revision 1.328
diff -u -p -r1.328 blog.module
--- modules/blog/blog.module	20 Jul 2009 18:51:32 -0000	1.328
+++ modules/blog/blog.module	11 Aug 2009 20:19:41 -0000
@@ -44,12 +44,12 @@ function blog_access($op, $node, $accoun
 /**
  * Implement hook_user_view().
  */
-function blog_user_view(&$edit, &$user, $category) {
-  if (user_access('create blog content', $user)) {
-    $user->content['summary']['blog'] =  array(
+function blog_user_view($account) {
+  if (user_access('create blog content', $account)) {
+    $account->content['summary']['blog'] =  array(
       '#type' => 'user_profile_item',
       '#title' => t('Blog'),
-      '#markup' => l(t('View recent blog entries'), "blog/$user->uid", array('attributes' => array('title' => t("Read !username's latest blog entries.", array('!username' => $user->name))))),
+      '#markup' => l(t('View recent blog entries'), "blog/$account->uid", array('attributes' => array('title' => t("Read !username's latest blog entries.", array('!username' => $account->name))))),
       '#attributes' => array('class' => 'blog'),
     );
   }
Index: modules/contact/contact.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/contact/contact.module,v
retrieving revision 1.119
diff -u -p -r1.119 contact.module
--- modules/contact/contact.module	20 Jul 2009 18:51:33 -0000	1.119
+++ modules/contact/contact.module	11 Aug 2009 20:19:41 -0000
@@ -138,7 +138,7 @@ function contact_load($cid) {
 /**
  * Implement hook_user_form().
  */
-function contact_user_form(&$edit, &$user, $category = NULL) {
+function contact_user_form(&$edit, $account, $category) {
   if ($category == 'account') {
     $form['contact'] = array('#type' => 'fieldset',
       '#title' => t('Contact settings'),
@@ -148,7 +148,7 @@ function contact_user_form(&$edit, &$use
     $form['contact']['contact'] = array('#type' => 'checkbox',
       '#title' => t('Personal contact form'),
       '#default_value' => !empty($edit['contact']) ? $edit['contact'] : FALSE,
-      '#description' => t('Allow other users to contact you via a <a href="@url">personal contact form</a> which keeps your e-mail address hidden. Note that some privileged users such as site administrators are still able to contact you even if you choose to disable this feature.', array('@url' => url("user/$user->uid/contact"))),
+      '#description' => t('Allow other users to contact you via a <a href="@url">personal contact form</a> which keeps your e-mail address hidden. Note that some privileged users such as site administrators are still able to contact you even if you choose to disable this feature.', array('@url' => url("user/$account->uid/contact"))),
     );
     return $form;
   }
@@ -157,18 +157,11 @@ function contact_user_form(&$edit, &$use
 /**
  * Implement hook_user_insert().
  */
-function contact_user_insert(&$edit, &$user, $category = NULL) {
+function contact_user_insert(&$edit, $account, $category) {
   $edit['contact'] = variable_get('contact_default_status', 1);
 }
 
 /**
- * Implement hook_user_validate().
- */
-function contact_user_validate(&$edit, &$user, $category = NULL) {
-  return array('contact' => isset($edit['contact']) ? $edit['contact'] : FALSE);
-}
-
-/**
  * Implement hook_mail().
  */
 function contact_mail($key, &$message, $params) {
Index: modules/locale/locale.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/locale/locale.module,v
retrieving revision 1.247
diff -u -p -r1.247 locale.module
--- modules/locale/locale.module	11 Aug 2009 11:52:45 -0000	1.247
+++ modules/locale/locale.module	11 Aug 2009 20:19:42 -0000
@@ -212,22 +212,22 @@ function locale_locale($op = 'groups') {
 /**
  * Implement hook_user_register().
  */
-function locale_user_register(&$edit, &$user, $category = NULL) {
+function locale_user_register(&$edit, $account, $category) {
   // If we have more then one language and either creating a user on the
   // admin interface or edit the user, show the language selector.
   if (variable_get('language_count', 1) > 1 && user_access('administer users')) {
-    return locale_language_selector_form($user);
+    return locale_language_selector_form($account);
   }
 }
 
 /**
  * Implement hook_user_form().
  */
-function locale_user_form(&$edit, &$user, $category = NULL) {
+function locale_user_form(&$edit, $account, $category) {
   // If we have more then one language and either creating a user on the
   // admin interface or edit the user, show the language selector.
   if (variable_get('language_count', 1) > 1 && $category == 'account') {
-    return locale_language_selector_form($user);
+    return locale_language_selector_form($account);
   }
 }
 
Index: modules/openid/openid.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/openid/openid.module,v
retrieving revision 1.51
diff -u -p -r1.51 openid.module
--- modules/openid/openid.module	30 Jun 2009 11:32:08 -0000	1.51
+++ modules/openid/openid.module	11 Aug 2009 20:19:43 -0000
@@ -59,7 +59,7 @@ function openid_help($path, $arg) {
 /**
  * Implement hook_user_insert().
  */
-function openid_user_insert(&$edit, &$account, $category = NULL) {
+function openid_user_insert(&$edit, $account, $category) {
   if (isset($_SESSION['openid']['values'])) {
     // The user has registered after trying to login via OpenID.
     if (variable_get('user_email_verification', TRUE)) {
Index: modules/profile/profile.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/profile/profile.module,v
retrieving revision 1.265
diff -u -p -r1.265 profile.module
--- modules/profile/profile.module	6 Aug 2009 05:05:59 -0000	1.265
+++ modules/profile/profile.module	11 Aug 2009 20:19:44 -0000
@@ -205,49 +205,35 @@ function profile_block_view($delta = '')
 /**
  * Implement hook_user_register().
  */
-function profile_user_register(&$edit, &$user, $category = NULL) {
-  return profile_form_profile($edit, $user, $category, TRUE);
+function profile_user_register(&$edit, $account, $category) {
+  return profile_form_profile($edit, $account, $category, TRUE);
 }
 
 /**
  * Implement hook_user_update().
  */
-function profile_user_update(&$edit, &$user, $category = NULL) {
-  return profile_save_profile($edit, $user, $category);
+function profile_user_update(&$edit, $account, $category) {
+  return profile_save_profile($edit, $account, $category);
 }
 
 /**
  * Implement hook_user_insert().
  */
-function profile_user_insert(&$edit, &$user, $category = NULL) {
-  return profile_save_profile($edit, $user, $category, TRUE);
-}
-
-/**
- * Implement hook_user_view().
- */
-function profile_user_view(&$edit, &$user, $category = NULL) {
-  return profile_view_profile($user);
+function profile_user_insert(&$edit, $account, $category) {
+  return profile_save_profile($edit, $account, $category, TRUE);
 }
 
 /**
  * Implement hook_user_form().
  */
-function profile_user_form(&$edit, &$user, $category = NULL) {
-  return profile_form_profile($edit, $user, $category);
-}
-
-/**
- * Implement hook_user_validate().
- */
-function profile_user_validate(&$edit, &$user, $category = NULL) {
-  return profile_validate_profile($edit, $category);
+function profile_user_form(&$edit, $account, $category) {
+  return profile_form_profile($edit, $account, $category);
 }
 
 /**
  * Implement hook_user_cancel().
  */
-function profile_user_cancel(&$edit, &$account, $method) {
+function profile_user_cancel(&$edit, $account, $method) {
   switch ($method) {
     case 'user_cancel_reassign':
     case 'user_cancel_delete':
@@ -270,7 +256,7 @@ function profile_user_load($users) {
   }
 }
 
-function profile_save_profile(&$edit, &$user, $category, $register = FALSE) {
+function profile_save_profile(&$edit, $account, $category, $register = FALSE) {
   $result = _profile_get_fields($category, $register);
   foreach ($result as $field) {
     if (_profile_field_serialize($field->type)) {
@@ -279,7 +265,7 @@ function profile_save_profile(&$edit, &$
     db_merge('profile_value')
       ->key(array(
         'fid' => $field->fid,
-        'uid' => $user->uid,
+        'uid' => $account->uid,
       ))
       ->fields(array('value' => $edit[$field->name]))
       ->execute();
@@ -288,7 +274,7 @@ function profile_save_profile(&$edit, &$
   }
 }
 
-function profile_view_field($user, $field) {
+function profile_view_field($account, $field) {
   // Only allow browsing of private fields for admins, if browsing is enabled,
   // and if a user has permission to view profiles. Note that this check is
   // necessary because a user may always see their own profile.
@@ -296,7 +282,7 @@ function profile_view_field($user, $fiel
         && (user_access('administer users') || $field->visibility != PROFILE_PRIVATE)
         && !empty($field->page);
 
-  if (isset($user->{$field->name}) && $value = $user->{$field->name}) {
+  if (isset($account->{$field->name}) && $value = $account->{$field->name}) {
     switch ($field->type) {
       case 'textarea':
         return check_markup($value);
@@ -335,12 +321,12 @@ function profile_view_field($user, $fiel
   }
 }
 
-function profile_view_profile(&$user) {
-
-  $user = user_load($user->uid);
-
+/**
+ * Implement hook_user_view().
+ */
+function profile_user_view($account) {
   // Show private fields to administrators and people viewing their own account.
-  if (user_access('administer users') || $GLOBALS['user']->uid == $user->uid) {
+  if (user_access('administer users') || $GLOBALS['user']->uid == $account->uid) {
     $result = db_query('SELECT * FROM {profile_field} WHERE visibility <> :hidden ORDER BY category, weight', array(':hidden' => PROFILE_HIDDEN));
   }
   else {
@@ -349,18 +335,18 @@ function profile_view_profile(&$user) {
 
   $fields = array();
   foreach ($result as $field) {
-    if ($value = profile_view_field($user, $field)) {
+    if ($value = profile_view_field($account, $field)) {
       $title = ($field->type != 'checkbox') ? check_plain($field->title) : NULL;
 
       // Create a single fieldset for each category.
-      if (!isset($user->content[$field->category])) {
-        $user->content[$field->category] = array(
+      if (!isset($account->content[$field->category])) {
+        $account->content[$field->category] = array(
           '#type' => 'user_profile_category',
           '#title' => $field->category,
         );
       }
 
-      $user->content[$field->category][$field->name] = array(
+      $account->content[$field->category][$field->name] = array(
         '#type' => 'user_profile_item',
         '#title' => $title,
         '#markup' => $value,
@@ -385,7 +371,7 @@ function _profile_form_explanation($fiel
   return $output;
 }
 
-function profile_form_profile($edit, $user, $category, $register = FALSE) {
+function profile_form_profile($edit, $account, $category, $register = FALSE) {
   $result = _profile_get_fields($category, $register);
   $weight = 1;
   $fields = array();
@@ -471,7 +457,10 @@ function _profile_update_user_fields($fi
   return $fields;
 }
 
-function profile_validate_profile($edit, $category) {
+/**
+ * Implement hook_user_validate().
+ */
+function profile_user_validate(&$edit, $account, $category) {
   $result = _profile_get_fields($category);
   foreach ($result as $field) {
     if ($edit[$field->name]) {
Index: modules/system/system.api.php
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.api.php,v
retrieving revision 1.60
diff -u -p -r1.60 system.api.php
--- modules/system/system.api.php	11 Aug 2009 12:20:26 -0000	1.60
+++ modules/system/system.api.php	11 Aug 2009 20:19:46 -0000
@@ -512,19 +512,6 @@ function hook_image_toolkits() {
 }
 
 /**
- * Perform alterations profile items before they are rendered. You may omit/add/re-sort/re-categorize, etc.
- *
- * @param $account
- *   A user object whose profile is being rendered. Profile items
- *   are stored in $account->content.
- */
-function hook_profile_alter(&$account) {
-  foreach ($account->content AS $key => $field) {
-    // do something
-  }
-}
-
-/**
  * Alter any aspect of email sent by Drupal. You can use this hook
  * to add a common site footer to all outgoing email, add extra header
  * fields, and/or modify the email in any way. HTML-izing the
Index: modules/system/system.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.module,v
retrieving revision 1.739
diff -u -p -r1.739 system.module
--- modules/system/system.module	11 Aug 2009 17:26:33 -0000	1.739
+++ modules/system/system.module	11 Aug 2009 20:19:49 -0000
@@ -1392,7 +1392,7 @@ function system_preprocess_page(&$variab
 /**
  * Implement hook_user_form().
  */
-function system_user_form(&$edit, &$user, $category = NULL) {
+function system_user_form(&$edit, $account, $category) {
   if ($category == 'account') {
     if (variable_get('configurable_timezones', 1)) {
       system_user_timezone($edit, $form);
@@ -1404,7 +1404,7 @@ function system_user_form(&$edit, &$user
 /**
  * Implement hook_user_register().
  */
-function system_user_register(&$edit, &$user, $category = NULL) {
+function system_user_register(&$edit, $account, $category) {
   if (variable_get('configurable_timezones', 1)) {
     $form = array();
     if (variable_get('user_default_timezone', DRUPAL_USER_TIMEZONE_DEFAULT) == DRUPAL_USER_TIMEZONE_SELECT) {
@@ -1423,10 +1423,10 @@ function system_user_register(&$edit, &$
 /**
  * Implement hook_user_login().
  */
-function system_user_login(&$edit, &$user, $category = NULL) {
+function system_user_login(&$edit, $account) {
   // If the user has a NULL time zone, notify them to set a time zone.
-  if (!$user->timezone && variable_get('configurable_timezones', 1) && variable_get('empty_timezone_message', 0)) {
-    drupal_set_message(t('Please configure your <a href="@user-edit">account time zone setting</a>.', array('@user-edit' => url("user/$user->uid/edit", array('query' => drupal_get_destination(), 'fragment' => 'edit-timezone')))));
+  if (!$account->timezone && variable_get('configurable_timezones', 1) && variable_get('empty_timezone_message', 0)) {
+    drupal_set_message(t('Please configure your <a href="@user-edit">account time zone setting</a>.', array('@user-edit' => url("user/$account->uid/edit", array('query' => drupal_get_destination(), 'fragment' => 'edit-timezone')))));
   }
 }
 
Index: modules/trigger/trigger.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/trigger/trigger.module,v
retrieving revision 1.41
diff -u -p -r1.41 trigger.module
--- modules/trigger/trigger.module	20 Jul 2009 18:51:35 -0000	1.41
+++ modules/trigger/trigger.module	11 Aug 2009 20:19:50 -0000
@@ -416,28 +416,28 @@ function _trigger_normalize_user_context
 /**
  * trigger_user_login
  */
-function trigger_user_login(&$edit, &$account, $category) {
+function trigger_user_login(&$edit, $account, $category) {
   _trigger_user('login', $edit, $account, $category);
 }
 
 /**
  * Implement hook_user_logout().
  */
-function trigger_user_logout($edit, $account) {
-  _trigger_user('logout', $edit, $account);
+function trigger_user_logout($account) {
+  _trigger_user('logout', $edit = NULL, $account);
 }
 
 /**
  * Implement hook_user_insert().
  */
-function trigger_user_insert(&$edit, &$account, $category) {
+function trigger_user_insert(&$edit, $account, $category) {
   _trigger_user('insert', $edit, $account, $category);
 }
 
 /**
  * Implement hook_user_update().
  */
-function trigger_user_update(&$edit, &$account, $category) {
+function trigger_user_update(&$edit, $account, $category) {
   _trigger_user('update', $edit, $account, $category);
 }
 
@@ -456,8 +456,8 @@ function trigger_user_cancel($edit, $acc
 /**
  * Implement hook_user_view().
  */
-function trigger_user_view(&$edit, &$account, $category) {
-  _trigger_user('view', $edit, $account, $category);
+function trigger_user_view($account) {
+  _trigger_user('view', $edit = NULL, $account, NULL);
 }
 
 /**
@@ -465,7 +465,7 @@ function trigger_user_view(&$edit, &$acc
  *
  * @TODO: Take advantage of the new API and reorganise/remove this function.
  */
-function _trigger_user($op, &$edit, &$account, $category = NULL) {
+function _trigger_user($op, &$edit, $account, $category = NULL) {
   // Keep objects for reuse so that changes actions make to objects can persist.
   static $objects;
   $aids = _trigger_get_hook_aids('user', $op);
Index: modules/user/user.api.php
===================================================================
RCS file: /cvs/drupal/drupal/modules/user/user.api.php,v
retrieving revision 1.9
diff -u -p -r1.9 user.api.php
--- modules/user/user.api.php	11 Aug 2009 11:47:58 -0000	1.9
+++ modules/user/user.api.php	11 Aug 2009 20:19:50 -0000
@@ -12,79 +12,6 @@
  */
 
 /**
- * Act on user account actions.
- *
- * This hook allows modules to react when operations are performed on user
- * accounts.
- *
- * @param $op
- *   What kind of action is being performed. Possible values (in alphabetical order):
- *   - "after_update": The user object has been updated and changed. Use this if
- *     (probably along with 'insert') if you want to reuse some information from
- *     the user object.
- *   - "categories": A set of user information categories is requested.
- *   - "form": The user account edit form is about to be displayed. The module
- *     should present the form elements it wishes to inject into the form.
- *   - "insert": The user account is being added. The module should save its
- *     custom additions to the user object into the database and set the saved
- *     fields to NULL in $edit.
- *   - "load": The user account is being loaded. The module may respond to this
- *     and insert additional information into the user object.
- *   - "login": The user just logged in.
- *   - "logout": The user just logged out.
- *   - "register": The user account registration form is about to be displayed.
- *     The module should present the form elements it wishes to inject into the
- *     form.
- *   - "submit": Modify the account before it gets saved.
- *   - "update": The user account is being changed. The module should save its
- *     custom additions to the user object into the database and set the saved
- *     fields to NULL in $edit.
- *   - "validate": The user account is about to be modified. The module should
- *     validate its custom additions to the user object, registering errors as
- *     necessary.
- *   - "view": The user's account information is being displayed. The module
- *     should format its custom additions for display and add them to the
- *     $account->content array.
- * @param &$edit
- *   The array of form values submitted by the user.
- * @param &$account
- *   The user object on which the operation is being performed.
- * @param $category
- *   The active category of user information being edited.
- * @return
- *   This varies depending on the operation.
- *   - "categories": A linear array of associative arrays. These arrays have
- *     keys:
- *     - "name": The internal name of the category.
- *     - "title": The human-readable, localized name of the category.
- *     - "weight": An integer specifying the category's sort ordering.
- *   - "delete": None.
- *   - "form", "register": A $form array containing the form elements to display.
- *   - "insert": None.
- *   - "load": None.
- *   - "login": None.
- *   - "logout": None.
- *   - "submit": None:
- *   - "update": None.
- *   - "validate": None.
- *   - "view": None. For an example see: user_user().
- */
-function hook_user($op, &$edit, &$account, $category = NULL) {
-  if ($op == 'form' && $category == 'account') {
-    $form['comment_settings'] = array(
-      '#type' => 'fieldset',
-      '#title' => t('Comment settings'),
-      '#collapsible' => TRUE,
-      '#weight' => 4);
-    $form['comment_settings']['signature'] = array(
-      '#type' => 'textarea',
-      '#title' => t('Signature'),
-      '#default_value' => $edit['signature'],
-      '#description' => t('Your signature will be publicly displayed at the end of your comments.'));
-    return $form;
-  }
-}
-/**
  * Act on user objects when loaded from the database.
  *
  * Due to the static cache in user_load_multiple() you should not use this
@@ -251,9 +178,36 @@ function hook_user_operations() {
   return $operations;
 }
 
+/**
+ * The user object has been updated and changed.
+ *
+ * Use this if (probably along with 'insert') if you want to reuse some
+ * information from the user object.
+ *
+ * @param &$edit
+ *   The array of form values submitted by the user.
+ * @param $account
+ *   The user object on which the operation is performed.
+ * @param $category
+ *   The active category of user information being edited.
+ */
+function hook_user_after_update(&$edit, $account, $category) {
+  db_insert('user_changes')
+    ->fields(array(
+      'uid' => $account->uid,
+      'changed' => time(),
+    ))
+    ->execute();
+}
 
 /**
  * Retrieve a list of all user setting/information categories.
+ *
+ * @return
+ *   A linear array of associative arrays. These arrays have keys:
+ *   - "name": The internal name of the category.
+ *   - "title": The human-readable, localized name of the category.
+ *   - "weight": An integer specifying the category's sort ordering.
  */
 function hook_user_categories() {
   return array(array(
@@ -263,6 +217,210 @@ function hook_user_categories() {
   ));
 }
 
+/**
+ * The user account edit form is about to be displayed.
+ *
+ * The module should present the form elements it wishes to inject
+ * into the form.
+ *
+ * @param &$edit
+ *   The array of form values submitted by the user.
+ * @param $account
+ *   The user object on which the operation is being performed.
+ * @param $category
+ *   The active category of user information being edited.
+ * @return
+ *   A $form array containing the form elements to display.
+ */
+function hook_user_form(&$edit, $account, $category = NULL) {
+  if ($category == 'account') {
+    $form['comment_settings'] = array(
+      '#type' => 'fieldset',
+      '#title' => t('Comment settings'),
+      '#collapsible' => TRUE,
+      '#weight' => 4);
+    $form['comment_settings']['signature'] = array(
+      '#type' => 'textarea',
+      '#title' => t('Signature'),
+      '#default_value' => $edit['signature'],
+      '#description' => t('Your signature will be publicly displayed at the end of your comments.'));
+    return $form;
+  }
+}
+
+
+/**
+ * The user account is being added.
+ *
+ * The module should save its custom additions to the user object into the
+ * database and set the saved fields to NULL in $edit.
+ *
+ * @param &$edit
+ *   The array of form values submitted by the user.
+ * @param $account
+ *   The user object on which the operation is being performed.
+ * @param $category
+ *   The active category of user information being edited.
+ */
+function hook_user_insert(&$edit, $account, $category) {
+  db_insert('mytable')
+    ->fields(array(
+      'myfield' => $edit['myfield'],
+      'uid' => $account->uid,
+    ))
+    ->execute();
+  $edit['myfield'] = NULL;
+}
+
+/**
+ * The user just logged in.
+ *
+ * @param &$edit
+ *   The array of form values submitted by the user.
+ * @param $account
+ *   The user object on which the operation was just performed.
+ */
+function hook_user_login(&$edit, $account) {
+  // If the user has a NULL time zone, notify them to set a time zone.
+  if (!$user->timezone && variable_get('configurable_timezones', 1) && variable_get('empty_timezone_message', 0)) {
+    drupal_set_message(t('Please configure your <a href="@user-edit">account time zone setting</a>.', array('@user-edit' => url("user/$user->uid/edit", array('query' => drupal_get_destination(), 'fragment' => 'edit-timezone')))));
+  }
+}
+
+/**
+ * The user just logged out.
+ *
+ * @param $account
+ *   The user object on which the operation was just performed.
+ */
+function hook_user_logout($account) {
+  db_insert('logouts')
+    ->fields(array(
+      'uid' => $account->uid,
+      'time' => time(),
+    ))
+    ->execute();
+}
+
+/**
+ * The user account registration form is about to be displayed.
+ *
+ * The module should present the form elements it wishes to inject into the
+ * form.
+ *
+ * @param &$edit
+ *   The array of form values submitted by the user.
+ * @param $account
+ *   The user object on which the operation is being performed.
+ * @param $category
+ *   The active category of user information being edited.
+ * @return
+ *   A $form array containing the form elements to display.
+ */
+function hook_user_register(&$edit, $account, $category) {
+  if (variable_get('configurable_timezones', 1)) {
+    $form = array();
+    if (variable_get('user_default_timezone', DRUPAL_USER_TIMEZONE_DEFAULT) == DRUPAL_USER_TIMEZONE_SELECT) {
+      system_user_timezone($edit, $form);
+    }
+    else {
+      $form['timezone'] = array(
+        '#type' => 'hidden',
+        '#value' => variable_get('user_default_timezone', DRUPAL_USER_TIMEZONE_DEFAULT) ? '' : variable_get('date_default_timezone', ''),
+      );
+    }
+    return $form;
+  }
+}
+
+/**
+ * Modify the account before it gets saved.
+ *
+ * @param &$edit
+ *   The array of form values submitted by the user.
+ * @param $account
+ *   The user object on which the operation is performed.
+ * @param $category
+ *   The active category of user information being edited.
+ */
+function hook_user_submit(&$edit, $account, $category) {
+  if ($category == 'account') {
+    if (!empty($edit['picture_upload'])) {
+      $edit['picture'] = $edit['picture_upload'];
+    }
+    // Delete picture if requested, and if no replacement picture was given.
+    elseif (!empty($edit['picture_delete'])) {
+      $edit['picture'] = NULL;
+    }
+    // Remove these values so they don't end up serialized in the data field.
+    $edit['picture_upload'] = NULL;
+    $edit['picture_delete'] = NULL;
+
+    if (isset($edit['roles'])) {
+      $edit['roles'] = array_filter($edit['roles']);
+    }
+  }
+}
+
+/**
+ * The user account is being changed.
+ *
+ * The module should save its custom additions to the user object into the
+ * database and set the saved fields to NULL in $edit.
+ *
+ * @param &$edit
+ *   The array of form values submitted by the user.
+ * @param $account
+ *   The user object on which the operation is performed.
+ * @param $category
+ *   The active category of user information being edited.
+ */
+function hook_user_update(&$edit, $account, $category) {
+  db_update('mytable')
+    ->fields(array('myfield' => $edit['myfield']))
+    ->condition('uid', $account->uid)
+    ->execute();
+  $edit['myfield'] = NULL;
+}
+
+/**
+ * The user account is about to be modified.
+ *
+ * The module should validate its custom additions to the user object,
+ * registering errors as necessary.
+ *
+ * @param &$edit
+ *   The array of form values submitted by the user.
+ * @param $account
+ *   The user object on which the operation is being performed.
+ * @param $category
+ *   The active category of user information being edited.
+ */
+function hook_user_validate(&$edit, $account, $category) {
+  if ($category == 'mymodule' && empty($edit['myfield'])) {
+    form_set_error('myfield', t('Myfield is required.'));
+  }
+}
+
+/**
+ * The user's account information is being displayed.
+ *
+ * The module should format its custom additions for display and add them to the
+ * $account->content array.
+ *
+ * @param $account
+ *   The user object on which the operation is being performed.
+ */
+function hook_user_view($account) {
+  if (user_access('create blog content', $account)) {
+    $account->content['summary']['blog'] =  array(
+      '#type' => 'user_profile_item',
+      '#title' => t('Blog'),
+      '#markup' => l(t('View recent blog entries'), "blog/$account->uid", array('attributes' => array('title' => t("Read !username's latest blog entries.", array('!username' => $account->name))))),
+      '#attributes' => array('class' => 'blog'),
+    );
+  }
+}
 
 /**
  * @} End of "addtogroup hooks".
Index: modules/user/user.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/user/user.module,v
retrieving revision 1.1020
diff -u -p -r1.1020 user.module
--- modules/user/user.module	11 Aug 2009 11:47:58 -0000	1.1020
+++ modules/user/user.module	11 Aug 2009 20:19:53 -0000
@@ -23,10 +23,10 @@ define('EMAIL_MAX_LENGTH', 64);
  * We cannot use module_invoke() for this, because the arguments need to
  * be passed by reference.
  */
-function user_module_invoke($type, &$array, &$user, $category = NULL) {
+function user_module_invoke($type, &$edit, $account, $category = NULL) {
   foreach (module_implements('user_' . $type) as $module) {
     $function = $module . '_user_' . $type;
-    $function($array, $user, $category);
+    $function($edit, $account, $category);
   }
 }
 
@@ -878,7 +878,7 @@ function user_elements() {
 /**
  * Implement hook_user_view().
  */
-function user_user_view(&$edit, &$account, $category = NULL) {
+function user_user_view($account) {
   $account->content['user_picture'] = array(
     '#markup' => theme('user_picture', $account),
     '#weight' => -10,
@@ -902,7 +902,7 @@ function user_user_view(&$edit, &$accoun
 /**
  * Implement hook_user_form.
  */
-function user_user_form(&$edit, &$account, $category = NULL) {
+function user_user_form(&$edit, $account, $category) {
   if ($category == 'account') {
     $form_state = array();
     return user_edit_form($form_state, (isset($account->uid) ? $account->uid : FALSE), $edit);
@@ -912,7 +912,7 @@ function user_user_form(&$edit, &$accoun
 /**
  * Implement hook_user_validate().
  */
-function user_user_validate(&$edit, &$account, $category = NULL) {
+function user_user_validate(&$edit, $account, $category) {
   if ($category == 'account') {
     $uid = isset($account->uid) ? $account->uid : FALSE;
     // Validate the username when: new user account; or user is editing own account and can change username; or an admin user.
@@ -953,7 +953,7 @@ function user_user_validate(&$edit, &$ac
 /**
  * Implement hook_user_submit().
  */
-function user_user_submit(&$edit, &$account, $category = NULL) {
+function user_user_submit(&$edit, $account, $category) {
   if ($category == 'account') {
     if (!empty($edit['picture_upload'])) {
       $edit['picture'] = $edit['picture_upload'];
@@ -2065,19 +2065,14 @@ function _user_cancel($edit, $account, $
  * @return
  *   A structured array containing the individual elements of the profile.
  */
-function user_build_content(&$account) {
-  $edit = NULL;
+function user_build_content($account) {
   $account->content = array();
 
   // Build fields content.
   // TODO D7 : figure out where exactly this needs to go
   $account->content += field_attach_view('user', $account);
 
-  user_module_invoke('view', $edit, $account);
-
-  // Allow modules to modify the fully-built profile.
-  drupal_alter('profile', $account);
-
+  module_invoke_all('user_view', $account);
   return $account->content;
 }
 
Index: modules/user/user.pages.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/user/user.pages.inc,v
retrieving revision 1.47
diff -u -p -r1.47 user.pages.inc
--- modules/user/user.pages.inc	11 Aug 2009 11:47:58 -0000	1.47
+++ modules/user/user.pages.inc	11 Aug 2009 20:19:53 -0000
@@ -136,7 +136,7 @@ function user_logout() {
 
   watchdog('user', 'Session closed for %name.', array('%name' => $user->name));
 
-  module_invoke_all('user_logout', NULL, $user);
+  module_invoke_all('user_logout', $user);
 
   // Destroy the current session, and reset $user to the anonymous user.
   session_destroy();
