summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2008-10-06 11:30:12 +0000
committerDries Buytaert <dries@buytaert.net>2008-10-06 11:30:12 +0000
commit026af5df34694c8ca5c3708f3fe23fd10ec160cb (patch)
tree3c557e61dd8b65bc31cd3538d499f08785c7d134 /modules
parenteabf7ab4ca423df42e53d11de30a814b39b03800 (diff)
downloadbrdo-026af5df34694c8ca5c3708f3fe23fd10ec160cb.tar.gz
brdo-026af5df34694c8ca5c3708f3fe23fd10ec160cb.tar.bz2
- Patch #310212 by justinrandell, catch, et all: killed in _user hook, as well as two small kittens.
Diffstat (limited to 'modules')
-rw-r--r--modules/block/block.module53
-rw-r--r--modules/blog/blog.module6
-rw-r--r--modules/comment/comment.module10
-rw-r--r--modules/contact/contact.module28
-rw-r--r--modules/dblog/dblog.module8
-rw-r--r--modules/locale/locale.module72
-rw-r--r--modules/node/node.module10
-rw-r--r--modules/openid/openid.module8
-rw-r--r--modules/openid/openid.pages.inc2
-rw-r--r--modules/poll/poll.module9
-rw-r--r--modules/profile/profile.module81
-rw-r--r--modules/statistics/statistics.module8
-rw-r--r--modules/system/system.module8
-rw-r--r--modules/trigger/trigger.module48
-rw-r--r--modules/user/user.module82
-rw-r--r--modules/user/user.pages.inc2
16 files changed, 270 insertions, 165 deletions
diff --git a/modules/block/block.module b/modules/block/block.module
index 9893cf6db..7c976ad24 100644
--- a/modules/block/block.module
+++ b/modules/block/block.module
@@ -335,38 +335,35 @@ function block_box_save($edit, $delta) {
}
/**
- * Implementation of hook_user().
- *
- * Allow users to decide which custom blocks to display when they visit
- * the site.
+ * Implementation of hook_user_form().
*/
-function block_user($type, $edit, &$account, $category = NULL) {
- switch ($type) {
- case 'form':
- if ($category == 'account') {
- $rids = array_keys($account->roles);
- $result = db_query("SELECT DISTINCT b.* FROM {blocks} b LEFT JOIN {blocks_roles} r ON b.module = r.module AND b.delta = r.delta WHERE b.status = 1 AND b.custom != 0 AND (r.rid IN (" . db_placeholders($rids) . ") OR r.rid IS NULL) ORDER BY b.weight, b.module", $rids);
- $form['block'] = array('#type' => 'fieldset', '#title' => t('Block configuration'), '#weight' => 3, '#collapsible' => TRUE, '#tree' => TRUE);
- while ($block = db_fetch_object($result)) {
- $data = module_invoke($block->module, 'block', 'list');
- if ($data[$block->delta]['info']) {
- $return = TRUE;
- $form['block'][$block->module][$block->delta] = array('#type' => 'checkbox', '#title' => check_plain($data[$block->delta]['info']), '#default_value' => isset($account->block[$block->module][$block->delta]) ? $account->block[$block->module][$block->delta] : ($block->custom == 1));
- }
- }
-
- if (!empty($return)) {
- return $form;
- }
+function block_user_form(&$edit, &$account, $category = NULL) {
+ if ($category == 'account') {
+ $rids = array_keys($account->roles);
+ $result = db_query("SELECT DISTINCT b.* FROM {blocks} b LEFT JOIN {blocks_roles} r ON b.module = r.module AND b.delta = r.delta WHERE b.status = 1 AND b.custom != 0 AND (r.rid IN (" . db_placeholders($rids) . ") OR r.rid IS NULL) ORDER BY b.weight, b.module", $rids);
+ $form['block'] = array('#type' => 'fieldset', '#title' => t('Block configuration'), '#weight' => 3, '#collapsible' => TRUE, '#tree' => TRUE);
+ while ($block = db_fetch_object($result)) {
+ $data = module_invoke($block->module, 'block', 'list');
+ if ($data[$block->delta]['info']) {
+ $return = TRUE;
+ $form['block'][$block->module][$block->delta] = array('#type' => 'checkbox', '#title' => check_plain($data[$block->delta]['info']), '#default_value' => isset($account->block[$block->module][$block->delta]) ? $account->block[$block->module][$block->delta] : ($block->custom == 1));
}
+ }
- break;
- case 'validate':
- if (empty($edit['block'])) {
- $edit['block'] = array();
- }
- return $edit;
+ if (!empty($return)) {
+ return $form;
+ }
+ }
+}
+
+/**
+ * Implementation of hook_user_validate().
+ */
+function block_user_validate(&$edit, &$account, $category = NULL) {
+ if (empty($edit['block'])) {
+ $edit['block'] = array();
}
+ return $edit;
}
/**
diff --git a/modules/blog/blog.module b/modules/blog/blog.module
index 1bd68a80e..c848b90ba 100644
--- a/modules/blog/blog.module
+++ b/modules/blog/blog.module
@@ -42,10 +42,10 @@ function blog_access($op, $node, $account) {
}
/**
- * Implementation of hook_user().
+ * Implementation of hook_user_view().
*/
-function blog_user($type, &$edit, &$user) {
- if ($type == 'view' && user_access('create blog content', $user)) {
+function blog_user_view(&$edit, &$user, $category) {
+ if (user_access('create blog content', $user)) {
$user->content['summary']['blog'] = array(
'#type' => 'user_profile_item',
'#title' => t('Blog'),
diff --git a/modules/comment/comment.module b/modules/comment/comment.module
index 80e9aad2f..d020f8d31 100644
--- a/modules/comment/comment.module
+++ b/modules/comment/comment.module
@@ -600,13 +600,11 @@ function comment_nodeapi(&$node, $op, $arg = 0) {
}
/**
- * Implementation of hook_user().
+ * Implementation of hook_user_delete().
*/
-function comment_user($type, $edit, &$user, $category = NULL) {
- if ($type == 'delete') {
- db_query('UPDATE {comments} SET uid = 0 WHERE uid = %d', $user->uid);
- db_query('UPDATE {node_comment_statistics} SET last_comment_uid = 0 WHERE last_comment_uid = %d', $user->uid);
- }
+function comment_user_delete(&$edit, &$user, $category = NULL) {
+ db_query('UPDATE {comments} SET uid = 0 WHERE uid = %d', $user->uid);
+ db_query('UPDATE {node_comment_statistics} SET last_comment_uid = 0 WHERE last_comment_uid = %d', $user->uid);
}
/**
diff --git a/modules/contact/contact.module b/modules/contact/contact.module
index bbe1389c5..4eb82043f 100644
--- a/modules/contact/contact.module
+++ b/modules/contact/contact.module
@@ -130,12 +130,10 @@ function contact_load($cid) {
}
/**
- * Implementation of hook_user().
- *
- * Allows the user the option of enabling/disabling his personal contact form.
+ * Implementation of hook_user_form().
*/
-function contact_user($type, &$edit, &$user, $category = NULL) {
- if ($type == 'form' && $category == 'account') {
+function contact_user_form(&$edit, &$user, $category = NULL) {
+ if ($category == 'account') {
$form['contact'] = array('#type' => 'fieldset',
'#title' => t('Contact settings'),
'#weight' => 5,
@@ -148,12 +146,20 @@ function contact_user($type, &$edit, &$user, $category = NULL) {
);
return $form;
}
- elseif ($type == 'validate') {
- return array('contact' => isset($edit['contact']) ? $edit['contact'] : FALSE);
- }
- elseif ($type == 'insert') {
- $edit['contact'] = variable_get('contact_default_status', 1);
- }
+}
+
+/**
+ * Implementation of hook_user_insert().
+ */
+function contact_user_insert(&$edit, &$user, $category = NULL) {
+ $edit['contact'] = variable_get('contact_default_status', 1);
+}
+
+/**
+ * Implementation of hook_user_validate().
+ */
+function contact_user_validate(&$edit, &$user, $category = NULL) {
+ return array('contact' => isset($edit['contact']) ? $edit['contact'] : FALSE);
}
/**
diff --git a/modules/dblog/dblog.module b/modules/dblog/dblog.module
index 4fb41b0f5..7fbee34bc 100644
--- a/modules/dblog/dblog.module
+++ b/modules/dblog/dblog.module
@@ -101,12 +101,10 @@ function dblog_cron() {
}
/**
- * Implementation of hook_user().
+ * Implementation of hook_user_delete().
*/
-function dblog_user($op, &$edit, &$user) {
- if ($op == 'delete') {
- db_query('UPDATE {watchdog} SET uid = 0 WHERE uid = %d', $user->uid);
- }
+function dblog_user_delete(&$edit, &$user) {
+ db_query('UPDATE {watchdog} SET uid = 0 WHERE uid = %d', $user->uid);
}
function _dblog_get_message_types() {
diff --git a/modules/locale/locale.module b/modules/locale/locale.module
index df905bfe0..b48bb239f 100644
--- a/modules/locale/locale.module
+++ b/modules/locale/locale.module
@@ -206,42 +206,56 @@ function locale_locale($op = 'groups') {
}
/**
- * Implementation of hook_user().
+ * Implementation of hook_user_register().
*/
-function locale_user($type, $edit, &$user, $category = NULL) {
- global $language;
+function locale_user_register(&$edit, &$user, $category = NULL) {
+ // 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);
+ }
+}
+/**
+ * Implementation of hook_user_form().
+ */
+function locale_user_form(&$edit, &$user, $category = NULL) {
// 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 && ($type == 'register' && user_access('administer users') || $type == 'form' && $category == 'account' )) {
- $languages = language_list('enabled');
- $languages = $languages[1];
+ if (variable_get('language_count', 1) > 1 && $category == 'account') {
+ return locale_language_selector_form($user);
+ }
+}
- // If the user is being created, we set the user language to the page language.
- $user_preferred_language = $user ? user_preferred_language($user) : $language;
+function locale_language_selector_form($user) {
+ global $language;
+ $languages = language_list('enabled');
+ $languages = $languages[1];
- $names = array();
- foreach ($languages as $langcode => $item) {
- $name = t($item->name);
- $names[$langcode] = $name . ($item->native != $name ? ' (' . $item->native . ')' : '');
- }
- $form['locale'] = array(
- '#type' => 'fieldset',
- '#title' => t('Language settings'),
- '#weight' => 1,
- );
-
- // Get language negotiation settings.
- $mode = variable_get('language_negotiation', LANGUAGE_NEGOTIATION_NONE);
- $form['locale']['language'] = array(
- '#type' => (count($names) <= 5 ? 'radios' : 'select'),
- '#title' => t('Language'),
- '#default_value' => $user_preferred_language->language,
- '#options' => $names,
- '#description' => ($mode == LANGUAGE_NEGOTIATION_PATH) ? t("This account's default language for e-mails, and preferred language for site presentation.") : t("This account's default language for e-mails."),
- );
- return $form;
+ // If the user is being created, we set the user language to the page language.
+ $user_preferred_language = $user ? user_preferred_language($user) : $language;
+
+ $names = array();
+ foreach ($languages as $langcode => $item) {
+ $name = t($item->name);
+ $names[$langcode] = $name . ($item->native != $name ? ' (' . $item->native . ')' : '');
}
+ $form['locale'] = array(
+ '#type' => 'fieldset',
+ '#title' => t('Language settings'),
+ '#weight' => 1,
+ );
+
+ // Get language negotiation settings.
+ $mode = variable_get('language_negotiation', LANGUAGE_NEGOTIATION_NONE);
+ $form['locale']['language'] = array(
+ '#type' => (count($names) <= 5 ? 'radios' : 'select'),
+ '#title' => t('Language'),
+ '#default_value' => $user_preferred_language->language,
+ '#options' => $names,
+ '#description' => ($mode == LANGUAGE_NEGOTIATION_PATH) ? t("This account's default language for e-mails, and preferred language for site presentation.") : t("This account's default language for e-mails."),
+ );
+ return $form;
}
/**
diff --git a/modules/node/node.module b/modules/node/node.module
index 8f6031cf3..9a14b4c7c 100644
--- a/modules/node/node.module
+++ b/modules/node/node.module
@@ -1379,13 +1379,11 @@ function node_ranking() {
}
/**
- * Implementation of hook_user().
+ * Implementation of hook_user_delete().
*/
-function node_user($op, &$edit, &$user) {
- if ($op == 'delete') {
- db_query('UPDATE {node} SET uid = 0 WHERE uid = %d', $user->uid);
- db_query('UPDATE {node_revisions} SET uid = 0 WHERE uid = %d', $user->uid);
- }
+function node_user_delete(&$edit, &$user) {
+ db_query('UPDATE {node} SET uid = 0 WHERE uid = %d', $user->uid);
+ db_query('UPDATE {node_revisions} SET uid = 0 WHERE uid = %d', $user->uid);
}
/**
diff --git a/modules/openid/openid.module b/modules/openid/openid.module
index fb390a27d..b4057c463 100644
--- a/modules/openid/openid.module
+++ b/modules/openid/openid.module
@@ -26,7 +26,7 @@ function openid_menu() {
);
$items['user/%user/openid/delete'] = array(
'title' => 'Delete OpenID',
- 'page callback' => 'openid_user_delete',
+ 'page callback' => 'openid_delete_user',
'page arguments' => array(1),
'access callback' => 'user_edit_access',
'access arguments' => array(1),
@@ -58,10 +58,10 @@ function openid_help($path, $arg) {
}
/**
- * Implementation of hook_user().
+ * Implementation of hook_user_insert().
*/
-function openid_user($op, &$edit, &$account, $category = NULL) {
- if ($op == 'insert' && isset($_SESSION['openid']['values'])) {
+function openid_user_insert(&$edit, &$account, $category = NULL) {
+ if (isset($_SESSION['openid']['values'])) {
// The user has registered after trying to login via OpenID.
if (variable_get('user_email_verification', TRUE)) {
drupal_set_message(t('Once you have verified your email address, you may log in via OpenID.'));
diff --git a/modules/openid/openid.pages.inc b/modules/openid/openid.pages.inc
index 57f2687f2..6d8ba2d60 100644
--- a/modules/openid/openid.pages.inc
+++ b/modules/openid/openid.pages.inc
@@ -82,7 +82,7 @@ function openid_user_add_validate($form, &$form_state) {
/**
* Menu callback; Delete the specified OpenID identity from the system.
*/
-function openid_user_delete($account, $aid = 0) {
+function openid_delete_user($account, $aid = 0) {
db_query("DELETE FROM {authmap} WHERE uid=%d AND aid=%d AND module='openid'", $account->uid, $aid);
if (db_affected_rows()) {
drupal_set_message(t('OpenID deleted.'));
diff --git a/modules/poll/poll.module b/modules/poll/poll.module
index 49fc6d00f..71d6129a7 100644
--- a/modules/poll/poll.module
+++ b/modules/poll/poll.module
@@ -823,10 +823,9 @@ function poll_cancel($form, &$form_state) {
}
/**
- * Implementation of hook_user().
+ * Implementation of hook_user_delete().
*/
-function poll_user($op, &$edit, &$user) {
- if ($op == 'delete') {
- db_query('UPDATE {poll_votes} SET uid = 0 WHERE uid = %d', $user->uid);
- }
+function poll_user_delete(&$edit, &$user) {
+ db_query('UPDATE {poll_votes} SET uid = 0 WHERE uid = %d', $user->uid);
}
+
diff --git a/modules/profile/profile.module b/modules/profile/profile.module
index c5ade96b1..abb70d9c1 100644
--- a/modules/profile/profile.module
+++ b/modules/profile/profile.module
@@ -194,29 +194,66 @@ function profile_block($op = 'list', $delta = '', $edit = array()) {
}
/**
- * Implementation of hook_user().
+ * Implementation of hook_user_load().
*/
-function profile_user($type, &$edit, &$user, $category = NULL) {
- switch ($type) {
- case 'load':
- return profile_load_profile($user);
- case 'register':
- return profile_form_profile($edit, $user, $category, TRUE);
- case 'update':
- return profile_save_profile($edit, $user, $category);
- case 'insert':
- return profile_save_profile($edit, $user, $category, TRUE);
- case 'view':
- return profile_view_profile($user);
- case 'form':
- return profile_form_profile($edit, $user, $category);
- case 'validate':
- return profile_validate_profile($edit, $category);
- case 'categories':
- return profile_categories();
- case 'delete':
- db_query('DELETE FROM {profile_values} WHERE uid = %d', $user->uid);
- }
+function profile_user_load(&$edit, &$user, $category = NULL) {
+ return profile_load_profile($user);
+}
+
+/**
+ * Implementation of hook_user_register().
+ */
+function profile_user_register(&$edit, &$user, $category = NULL) {
+ return profile_form_profile($edit, $user, $category, TRUE);
+}
+
+/**
+ * Implementation of hook_user_update().
+ */
+function profile_user_update(&$edit, &$user, $category = NULL) {
+ return profile_save_profile($edit, $user, $category);
+}
+
+/**
+ * Implementation of hook_user_insert().
+ */
+function profile_user_insert(&$edit, &$user, $category = NULL) {
+ return profile_save_profile($edit, $user, $category, TRUE);
+}
+
+/**
+ * Implementation of hook_user_view().
+ */
+function profile_user_view(&$edit, &$user, $category = NULL) {
+ return profile_view_profile($user);
+}
+
+/**
+ * Implementation of hook_user_form().
+ */
+function profile_user_form(&$edit, &$user, $category = NULL) {
+ return profile_form_profile($edit, $user, $category);
+}
+
+/**
+ * Implementation of hook_user_validate().
+ */
+function profile_user_validate(&$edit, &$user, $category = NULL) {
+ return profile_validate_profile($edit, $category);
+}
+
+/**
+ * Implementation of hook_user_categories().
+ */
+function profile_user_categories(&$edit, &$user, $category = NULL) {
+ return profile_categories();
+}
+
+/**
+ * Implementation of hook_user_delete().
+ */
+function profile_user_delete(&$edit, &$user, $category = NULL) {
+ db_query('DELETE FROM {profile_values} WHERE uid = %d', $user->uid);
}
function profile_load_profile(&$user) {
diff --git a/modules/statistics/statistics.module b/modules/statistics/statistics.module
index cf5378a72..42d4b6782 100644
--- a/modules/statistics/statistics.module
+++ b/modules/statistics/statistics.module
@@ -174,12 +174,10 @@ function statistics_menu() {
}
/**
- * Implementation of hook_user().
+ * Implementation of hook_user_delete().
*/
-function statistics_user($op, &$edit, &$user) {
- if ($op == 'delete') {
- db_query('UPDATE {accesslog} SET uid = 0 WHERE uid = %d', $user->uid);
- }
+function statistics_user_delete(&$edit, &$user, $category) {
+ db_query('UPDATE {accesslog} SET uid = 0 WHERE uid = %d', $user->uid);
}
/**
diff --git a/modules/system/system.module b/modules/system/system.module
index 68d2c24ad..39019fe78 100644
--- a/modules/system/system.module
+++ b/modules/system/system.module
@@ -711,12 +711,10 @@ function system_preprocess_page(&$variables) {
}
/**
- * Implementation of hook_user().
- *
- * Allows users to individually set their theme and time zone.
+ * Implementation of hook_user_form().
*/
-function system_user($type, $edit, &$user, $category = NULL) {
- if ($type == 'form' && $category == 'account') {
+function system_user_form(&$edit, &$user, $category = NULL) {
+ 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)) {
diff --git a/modules/trigger/trigger.module b/modules/trigger/trigger.module
index 91416f5dc..e59d33851 100644
--- a/modules/trigger/trigger.module
+++ b/modules/trigger/trigger.module
@@ -347,9 +347,53 @@ function _trigger_normalize_user_context($type, $account) {
}
/**
- * Implementation of hook_user().
+ * trigger_user_login
*/
-function trigger_user($op, &$edit, &$account, $category = NULL) {
+function trigger_user_login(&$edit, &$account, $category) {
+ _trigger_user('login', $edit, $account, $category);
+}
+
+/**
+ * Implementation of hook_user_logout().
+ */
+function trigger_user_logout(&$edit, &$account, $category) {
+ _trigger_user('logout', $edit, $account, $category);
+}
+
+/**
+ * Implementation of hook_user_insert().
+ */
+function trigger_user_insert(&$edit, &$account, $category) {
+ _trigger_user('insert', $edit, $account, $category);
+}
+
+/**
+ * Implementation of hook_user_update().
+ */
+function trigger_user_update(&$edit, &$account, $category) {
+ _trigger_user('update', $edit, $account, $category);
+}
+
+/**
+ * Implementation of hook_user_delete().
+ */
+function trigger_user_delete(&$edit, &$account, $category) {
+ _trigger_user('delete', $edit, $account, $category);
+}
+
+/**
+ * Implementation of hook_user_view().
+ */
+function trigger_user_view(&$edit, &$account, $category) {
+ _trigger_user('view', $edit, $account, $category);
+}
+
+/**
+ * Simple wrapper function to make user hooks work with new entry points.
+ *
+ * @TODO: Take advantage of the new API and reorganise/remove this function.
+ */
+function _trigger_user($op, &$edit, &$account, $category = NULL) {
// Keep objects for reuse so that changes actions make to objects can persist.
static $objects;
// We support a subset of operations.
diff --git a/modules/user/user.module b/modules/user/user.module
index 975a1ad77..4138fd72e 100644
--- a/modules/user/user.module
+++ b/modules/user/user.module
@@ -24,9 +24,9 @@ define('EMAIL_MAX_LENGTH', 64);
*/
function user_module_invoke($type, &$array, &$user, $category = NULL) {
foreach (module_list() as $module) {
- $function = $module . '_user';
+ $function = $module . '_user_' . $type;
if (function_exists($function)) {
- $function($type, $array, $user, $category);
+ $function($array, $user, $category);
}
}
}
@@ -633,45 +633,62 @@ function user_elements() {
}
/**
- * Implementation of hook_user().
+ * Implementation of hook_user_view().
*/
-function user_user($type, &$edit, &$account, $category = NULL) {
- if ($type == 'view') {
- $account->content['user_picture'] = array(
- '#value' => theme('user_picture', $account),
- '#weight' => -10,
- );
- if (!isset($account->content['summary'])) {
- $account->content['summary'] = array();
- }
- $account->content['summary'] += array(
- '#type' => 'user_profile_category',
- '#attributes' => array('class' => 'user-member'),
- '#weight' => 5,
- '#title' => t('History'),
- );
- $account->content['summary']['member_for'] = array(
- '#type' => 'user_profile_item',
- '#title' => t('Member for'),
- '#markup' => format_interval(REQUEST_TIME - $account->created),
- );
- }
- if ($type == 'form' && $category == 'account') {
+function user_user_view(&$edit, &$account, $category = NULL) {
+ $account->content['user_picture'] = array(
+ '#value' => theme('user_picture', $account),
+ '#weight' => -10,
+ );
+ if (!isset($account->content['summary'])) {
+ $account->content['summary'] = array();
+ }
+ $account->content['summary'] += array(
+ '#type' => 'user_profile_category',
+ '#attributes' => array('class' => 'user-member'),
+ '#weight' => 5,
+ '#title' => t('History'),
+ );
+ $account->content['summary']['member_for'] = array(
+ '#type' => 'user_profile_item',
+ '#title' => t('Member for'),
+ '#markup' => format_interval(REQUEST_TIME - $account->created),
+ );
+}
+
+/**
+ * Implementation of hook_user_form.
+ */
+function user_user_form(&$edit, &$account, $category = NULL) {
+ if ($category == 'account') {
$form_state = array();
return user_edit_form($form_state, arg(1), $edit);
}
+}
- if ($type == 'validate' && $category == 'account') {
+/**
+ * Implementation of hook_user_validate.
+ */
+function user_user_validate(&$edit, &$account, $category = NULL) {
+ if ($category == 'account') {
return _user_edit_validate(arg(1), $edit);
}
+}
- if ($type == 'submit' && $category == 'account') {
+/**
+ * Implementation of hook_user_submit.
+ */
+function user_user_submit(&$edit, &$account, $category = NULL) {
+ if ($category == 'account') {
return _user_edit_submit(arg(1), $edit);
}
+}
- if ($type == 'categories') {
+/**
+ * Implementation of hook_user_categories.
+ */
+function user_user_categories(&$edit, &$account, $category = NULL) {
return array(array('name' => 'account', 'title' => t('Account settings'), 'weight' => 1));
- }
}
function user_login_block() {
@@ -1560,7 +1577,7 @@ function user_delete($edit, $uid) {
$account = user_load(array('uid' => $uid));
drupal_session_destroy_uid($uid);
_user_mail_notify('status_deleted', $account);
- module_invoke_all('user', 'delete', $edit, $account);
+ module_invoke_all('user_delete', $edit, $account);
db_query('DELETE FROM {users} WHERE uid = %d', $uid);
db_query('DELETE FROM {users_roles} WHERE uid = %d', $uid);
db_query('DELETE FROM {authmap} WHERE uid = %d', $uid);
@@ -1888,7 +1905,7 @@ function _user_categories($account) {
$categories = array();
foreach (module_list() as $module) {
- if ($data = module_invoke($module, 'user', 'categories', NULL, $account, '')) {
+ if ($data = module_invoke($module, 'user_categories', NULL, $account, '')) {
$categories = array_merge($data, $categories);
}
}
@@ -2410,7 +2427,7 @@ function user_register_validate($form, &$form_state) {
function _user_forms(&$edit, $account, $category, $hook = 'form') {
$groups = array();
foreach (module_list() as $module) {
- if ($data = module_invoke($module, 'user', $hook, $edit, $account, $category)) {
+ if ($data = module_invoke($module, 'user_' . $hook, $edit, $account, $category)) {
$groups = array_merge_recursive($data, $groups);
}
}
@@ -2418,3 +2435,4 @@ function _user_forms(&$edit, $account, $category, $hook = 'form') {
return empty($groups) ? FALSE : $groups;
}
+
diff --git a/modules/user/user.pages.inc b/modules/user/user.pages.inc
index 727b2443e..5050f45e2 100644
--- a/modules/user/user.pages.inc
+++ b/modules/user/user.pages.inc
@@ -135,7 +135,7 @@ function user_logout() {
// Destroy the current session:
session_destroy();
- module_invoke_all('user', 'logout', NULL, $user);
+ module_invoke_all('user_logout', NULL, $user);
// Load the anonymous user
$user = drupal_anonymous_user();