Index: modules/block/block.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/block/block.module,v
retrieving revision 1.345
diff -u -p -r1.345 block.module
--- modules/block/block.module 12 Jun 2009 09:02:55 -0000 1.345
+++ modules/block/block.module 17 Jun 2009 11:35:50 -0000
@@ -418,7 +418,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));
@@ -451,7 +451,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.323
diff -u -p -r1.323 blog.module
--- modules/blog/blog.module 12 Jun 2009 08:39:35 -0000 1.323
+++ modules/blog/blog.module 17 Jun 2009 11:35:50 -0000
@@ -44,7 +44,7 @@ function blog_access($op, $node, $accoun
/**
* Implement hook_user_view().
*/
-function blog_user_view(&$edit, &$user, $category) {
+function blog_user_view($user) {
if (user_access('create blog content', $user)) {
$user->content['summary']['blog'] = array(
'#type' => 'user_profile_item',
Index: modules/contact/contact.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/contact/contact.module,v
retrieving revision 1.117
diff -u -p -r1.117 contact.module
--- modules/contact/contact.module 13 Jun 2009 20:40:07 -0000 1.117
+++ modules/contact/contact.module 17 Jun 2009 11:35:50 -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, $user, $category) {
if ($category == 'account') {
$form['contact'] = array('#type' => 'fieldset',
'#title' => t('Contact settings'),
@@ -157,14 +157,14 @@ function contact_user_form(&$edit, &$use
/**
* Implement hook_user_insert().
*/
-function contact_user_insert(&$edit, &$user, $category = NULL) {
+function contact_user_insert(&$edit, $user, $category) {
$edit['contact'] = variable_get('contact_default_status', 1);
}
/**
* Implement hook_user_validate().
*/
-function contact_user_validate(&$edit, &$user, $category = NULL) {
+function contact_user_validate(&$edit, $user, $category) {
return array('contact' => isset($edit['contact']) ? $edit['contact'] : FALSE);
}
Index: modules/locale/locale.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/locale/locale.module,v
retrieving revision 1.242
diff -u -p -r1.242 locale.module
--- modules/locale/locale.module 8 Jun 2009 05:00:11 -0000 1.242
+++ modules/locale/locale.module 17 Jun 2009 11:35:51 -0000
@@ -212,7 +212,7 @@ function locale_locale($op = 'groups') {
/**
* Implement hook_user_register().
*/
-function locale_user_register(&$edit, &$user, $category = NULL) {
+function locale_user_register(&$edit, $user, $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')) {
@@ -223,7 +223,7 @@ function locale_user_register(&$edit, &$
/**
* Implement hook_user_form().
*/
-function locale_user_form(&$edit, &$user, $category = NULL) {
+function locale_user_form(&$edit, $user, $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') {
Index: modules/openid/openid.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/openid/openid.module,v
retrieving revision 1.50
diff -u -p -r1.50 openid.module
--- modules/openid/openid.module 10 Jun 2009 20:13:20 -0000 1.50
+++ modules/openid/openid.module 17 Jun 2009 11:35:51 -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.261
diff -u -p -r1.261 profile.module
--- modules/profile/profile.module 3 Jun 2009 07:28:28 -0000 1.261
+++ modules/profile/profile.module 17 Jun 2009 11:35:52 -0000
@@ -205,49 +205,49 @@ function profile_block_view($delta = '')
/**
* Implement hook_user_register().
*/
-function profile_user_register(&$edit, &$user, $category = NULL) {
+function profile_user_register(&$edit, $user, $category) {
return profile_form_profile($edit, $user, $category, TRUE);
}
/**
* Implement hook_user_update().
*/
-function profile_user_update(&$edit, &$user, $category = NULL) {
+function profile_user_update(&$edit, $user, $category) {
return profile_save_profile($edit, $user, $category);
}
/**
* Implement hook_user_insert().
*/
-function profile_user_insert(&$edit, &$user, $category = NULL) {
+function profile_user_insert(&$edit, $user, $category) {
return profile_save_profile($edit, $user, $category, TRUE);
}
/**
* Implement hook_user_view().
*/
-function profile_user_view(&$edit, &$user, $category = NULL) {
+function profile_user_view($user) {
return profile_view_profile($user);
}
/**
* Implement hook_user_form().
*/
-function profile_user_form(&$edit, &$user, $category = NULL) {
+function profile_user_form(&$edit, $user, $category) {
return profile_form_profile($edit, $user, $category);
}
/**
* Implement hook_user_validate().
*/
-function profile_user_validate(&$edit, &$user, $category = NULL) {
+function profile_user_validate(&$edit, $user, $category) {
return profile_validate_profile($edit, $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 +270,7 @@ function profile_user_load($users) {
}
}
-function profile_save_profile(&$edit, &$user, $category, $register = FALSE) {
+function profile_save_profile(&$edit, $user, $category, $register = FALSE) {
$result = _profile_get_fields($category, $register);
foreach ($result as $field) {
if (_profile_field_serialize($field->type)) {
@@ -335,7 +335,7 @@ function profile_view_field($user, $fiel
}
}
-function profile_view_profile(&$user) {
+function profile_view_profile($user) {
$user = user_load($user->uid);
Index: modules/system/system.api.php
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.api.php,v
retrieving revision 1.41
diff -u -p -r1.41 system.api.php
--- modules/system/system.api.php 8 Jun 2009 09:23:54 -0000 1.41
+++ modules/system/system.api.php 17 Jun 2009 11:35:53 -0000
@@ -477,21 +477,6 @@ function hook_link_alter(array &$links,
}
/**
- * 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.
- * @return
- * None.
- */
-function hook_profile_alter(&$account) {
- foreach ($account->content AS $key => $field) {
- // do something
- }
-}
-
-/**
* Alter any aspect of the emails sent by Drupal. You can use this hook
* to add a common site footer to all outgoing emails; add extra header
* fields and/or modify the mails sent out in any way. HTML-izing the
Index: modules/system/system.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.module,v
retrieving revision 1.712
diff -u -p -r1.712 system.module
--- modules/system/system.module 16 Jun 2009 08:41:35 -0000 1.712
+++ modules/system/system.module 17 Jun 2009 11:35:55 -0000
@@ -863,7 +863,7 @@ function system_preprocess_page(&$variab
/**
* Implement hook_user_form().
*/
-function system_user_form(&$edit, &$user, $category = NULL) {
+function system_user_form(&$edit, $user, $category) {
if ($category == 'account') {
$form['theme_select'] = system_theme_select_form(t('Selecting a different theme will change the look and feel of the site.'), isset($edit['theme']) ? $edit['theme'] : NULL, 2);
if (variable_get('configurable_timezones', 1)) {
@@ -876,7 +876,7 @@ function system_user_form(&$edit, &$user
/**
* Implement hook_user_register().
*/
-function system_user_register(&$edit, &$user, $category = NULL) {
+function system_user_register(&$edit, $user, $category) {
if (variable_get('configurable_timezones', 1)) {
$form = array();
if (variable_get('user_default_timezone', DRUPAL_USER_TIMEZONE_DEFAULT) == DRUPAL_USER_TIMEZONE_SELECT) {
@@ -895,7 +895,7 @@ function system_user_register(&$edit, &$
/**
* Implement hook_user_login().
*/
-function system_user_login(&$edit, &$user, $category = NULL) {
+function system_user_login(&$edit, $user) {
// 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 account time zone setting.', array('@user-edit' => url("user/$user->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.38
diff -u -p -r1.38 trigger.module
--- modules/trigger/trigger.module 5 Jun 2009 15:41:05 -0000 1.38
+++ modules/trigger/trigger.module 17 Jun 2009 11:35:55 -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.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/user/user.module,v
retrieving revision 1.1001
diff -u -p -r1.1001 user.module
--- modules/user/user.module 13 Jun 2009 20:40:09 -0000 1.1001
+++ modules/user/user.module 17 Jun 2009 11:35:57 -0000
@@ -23,7 +23,7 @@ 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, &$array, $user, $category = NULL) {
foreach (module_implements('user_' . $type) as $module) {
$function = $module . '_user_' . $type;
$function($array, $user, $category);
@@ -903,7 +903,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,
@@ -927,7 +927,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);
@@ -937,7 +937,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.
@@ -978,7 +978,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'];
@@ -2041,8 +2041,7 @@ 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.
@@ -2050,11 +2049,7 @@ function user_build_content(&$account) {
// TODO D7 : $page / $teaser ??
$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.api.php
===================================================================
RCS file: /cvs/drupal/drupal/modules/user/user.api.php,v
retrieving revision 1.7
diff -u -p -r1.7 user.api.php
--- modules/user/user.api.php 15 Jun 2009 19:21:54 -0000 1.7
+++ modules/user/user.api.php 17 Jun 2009 11:35:58 -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,30 @@ 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 being performed.
+ * @param $category
+ * The active category of user information being edited.
+ */
+function hook_user_after_update(&$edit, $account, $category) {
+}
/**
* 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 +211,181 @@ 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 is being 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 account time zone setting.', 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 is being performed.
+ */
+function hook_user_logout($account) {
+
+}
+
+/**
+ * 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 being performed.
+ * @param $category
+ * The active category of user information being edited.
+ */
+function hook_user_submit(&$edit, $account, $category) {
+
+}
+
+/**
+ * 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 being 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) {
+
+}
+
+/**
+ * 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) {
+
+}
/**
* @} End of "addtogroup hooks".