diff --git a/modules/block/block.module b/modules/block/block.module
index d0f07e4..8936b1b 100644
--- a/modules/block/block.module
+++ b/modules/block/block.module
@@ -572,41 +572,39 @@ function block_custom_block_save($edit, $delta) {
* Implements hook_form_FORM_ID_alter().
*/
function block_form_user_profile_form_alter(&$form, &$form_state) {
- if ($form['#user_category'] == 'account') {
- $account = $form['#user'];
- $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));
+ $account = $form['#user'];
+ $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));
- $blocks = array();
- foreach ($result as $block) {
- $data = module_invoke($block->module, 'block_info');
- if ($data[$block->delta]['info']) {
- $blocks[$block->module][$block->delta] = array(
- '#type' => 'checkbox',
- '#title' => check_plain($data[$block->delta]['info']),
- '#default_value' => isset($account->data['block'][$block->module][$block->delta]) ? $account->data['block'][$block->module][$block->delta] : ($block->custom == 1),
- );
- }
- }
- // Only display the fieldset if there are any personalizable blocks.
- if ($blocks) {
- $form['block'] = array(
- '#type' => 'fieldset',
- '#title' => t('Personalize blocks'),
- '#description' => t('Blocks consist of content or information that complements the main content of the page. Enable or disable optional blocks using the checkboxes below.'),
- '#weight' => 3,
- '#collapsible' => TRUE,
- '#tree' => TRUE,
+ $blocks = array();
+ foreach ($result as $block) {
+ $data = module_invoke($block->module, 'block_info');
+ if ($data[$block->delta]['info']) {
+ $blocks[$block->module][$block->delta] = array(
+ '#type' => 'checkbox',
+ '#title' => check_plain($data[$block->delta]['info']),
+ '#default_value' => isset($account->data['block'][$block->module][$block->delta]) ? $account->data['block'][$block->module][$block->delta] : ($block->custom == 1),
);
- $form['block'] += $blocks;
}
}
+ // Only display the fieldset if there are any personalizable blocks.
+ if ($blocks) {
+ $form['block'] = array(
+ '#type' => 'fieldset',
+ '#title' => t('Personalize blocks'),
+ '#description' => t('Blocks consist of content or information that complements the main content of the page. Enable or disable optional blocks using the checkboxes below.'),
+ '#weight' => 3,
+ '#collapsible' => TRUE,
+ '#tree' => TRUE,
+ );
+ $form['block'] += $blocks;
+ }
}
/**
* Implements hook_user_presave().
*/
-function block_user_presave(&$edit, $account, $category) {
+function block_user_presave(&$edit, $account) {
if (isset($edit['block'])) {
$edit['data']['block'] = $edit['block'];
}
diff --git a/modules/contact/contact.module b/modules/contact/contact.module
index eaae9c6..9388877 100644
--- a/modules/contact/contact.module
+++ b/modules/contact/contact.module
@@ -213,27 +213,25 @@ function contact_mail($key, &$message, $params) {
* Add the enable personal contact form to an individual user's account page.
*/
function contact_form_user_profile_form_alter(&$form, &$form_state) {
- if ($form['#user_category'] == 'account') {
- $account = $form['#user'];
- $form['contact'] = array(
- '#type' => 'fieldset',
- '#title' => t('Contact settings'),
- '#weight' => 5,
- '#collapsible' => TRUE,
- );
- $form['contact']['contact'] = array(
- '#type' => 'checkbox',
- '#title' => t('Personal contact form'),
- '#default_value' => !empty($account->data['contact']) ? $account->data['contact'] : FALSE,
- '#description' => t('Allow other users to contact you via a personal contact form 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"))),
- );
- }
+ $form['contact'] = array(
+ '#type' => 'fieldset',
+ '#title' => t('Contact settings'),
+ '#weight' => 5,
+ '#collapsible' => TRUE,
+ );
+ $account = $form['#user'];
+ $form['contact']['contact'] = array(
+ '#type' => 'checkbox',
+ '#title' => t('Personal contact form'),
+ '#default_value' => !empty($account->data['contact']) ? $account->data['contact'] : FALSE,
+ '#description' => t('Allow other users to contact you via a personal contact form 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"))),
+ );
}
/**
* Implements hook_user_presave().
*/
-function contact_user_presave(&$edit, $account, $category) {
+function contact_user_presave(&$edit, $account) {
$edit['data']['contact'] = isset($edit['contact']) ? $edit['contact'] : variable_get('contact_default_status', 1);
}
diff --git a/modules/locale/locale.module b/modules/locale/locale.module
index 6bb697d..fb5e9ff 100644
--- a/modules/locale/locale.module
+++ b/modules/locale/locale.module
@@ -275,15 +275,15 @@ function locale_language_selector_form(&$form, &$form_state, $user) {
$name = t($item->name);
$names[$langcode] = $name . ($item->native != $name ? ' (' . $item->native . ')' : '');
}
+ // Get language negotiation settings.
+ $mode = language_negotiation_get(LANGUAGE_TYPE_INTERFACE) != LANGUAGE_NEGOTIATION_DEFAULT;
+ $form_id = $form['#form_id']['#value'];
$form['locale'] = array(
'#type' => 'fieldset',
'#title' => t('Language settings'),
'#weight' => 1,
- '#access' => ($form['#user_category'] == 'account' || ($form['#user_category'] == 'register' && user_access('administer users'))),
+ '#access' => $form_id == 'user-profile-form' || !($form_id == 'user-register-form' && !user_access('administer users')),
);
-
- // Get language negotiation settings.
- $mode = language_negotiation_get(LANGUAGE_TYPE_INTERFACE) != LANGUAGE_NEGOTIATION_DEFAULT;
$form['locale']['language'] = array(
'#type' => (count($names) <= 5 ? 'radios' : 'select'),
'#title' => t('Language'),
@@ -328,7 +328,7 @@ function locale_form_alter(&$form, &$form_state, $form_id) {
if (drupal_multilingual()) {
// Display language selector when either creating a user on the admin
// interface or editing a user account.
- if ($form_id == 'user_register_form' || ($form_id == 'user_profile_form' && $form['#user_category'] == 'account')) {
+ if ($form_id == 'user_register_form' || $form_id == 'user_profile_form') {
locale_language_selector_form($form, $form_state, $form['#user']);
}
}
diff --git a/modules/locale/locale.test b/modules/locale/locale.test
index 31556cb..49bd99a 100644
--- a/modules/locale/locale.test
+++ b/modules/locale/locale.test
@@ -1371,7 +1371,7 @@ class LocaleUserLanguageFunctionalTest extends DrupalWebTestCase {
$path = 'user/' . $web_user->uid . '/edit';
$this->drupalGet($path);
// Ensure language settings fieldset is available.
- $this->assertText(t('Language settings'), t('Language settings available.'));
+ $this->assertText(t('Language'), t('Language selector available.'));
// Ensure custom language is present.
$this->assertText($name, t('Language present on form.'));
// Ensure disabled language isn't present.
diff --git a/modules/openid/openid.module b/modules/openid/openid.module
index 2bf891a..ed02891 100644
--- a/modules/openid/openid.module
+++ b/modules/openid/openid.module
@@ -83,7 +83,7 @@ function openid_help($path, $arg) {
/**
* Implements hook_user_insert().
*/
-function openid_user_insert(&$edit, $account, $category) {
+function openid_user_insert(&$edit, $account) {
if (!empty($edit['openid_claimed_id'])) {
// The user has registered after trying to log in via OpenID.
if (variable_get('user_email_verification', TRUE)) {
diff --git a/modules/overlay/overlay.module b/modules/overlay/overlay.module
index 6e137b7..0c84f89 100644
--- a/modules/overlay/overlay.module
+++ b/modules/overlay/overlay.module
@@ -82,30 +82,26 @@ function overlay_theme() {
* Implements hook_form_FORM_ID_alter().
*/
function overlay_form_user_profile_form_alter(&$form, &$form_state) {
- if ($form['#user_category'] == 'account') {
- $account = $form['#user'];
- if (user_access('access overlay', $account)) {
- $form['overlay_control'] = array(
- '#type' => 'fieldset',
- '#title' => t('Administrative overlay'),
- '#weight' => 4,
- '#collapsible' => TRUE,
- );
-
- $form['overlay_control']['overlay'] = array(
- '#type' => 'checkbox',
- '#title' => t('Use the overlay for administrative pages.'),
- '#description' => t('Show administrative pages on top of the page you started from.'),
- '#default_value' => isset($account->data['overlay']) ? $account->data['overlay'] : 1,
- );
- }
- }
+ $account = $form['#user'];
+ $form['overlay_control'] = array(
+ '#type' => 'fieldset',
+ '#title' => t('Administrative overlay'),
+ '#weight' => 4,
+ '#collapsible' => TRUE,
+ '#access' => user_access('access overlay', $account),
+ );
+ $form['overlay_control']['overlay'] = array(
+ '#type' => 'checkbox',
+ '#title' => t('Use the overlay for administrative pages.'),
+ '#description' => t('Show administrative pages on top of the page you started from.'),
+ '#default_value' => isset($account->data['overlay']) ? $account->data['overlay'] : 1,
+ );
}
/**
* Implements hook_user_presave().
*/
-function overlay_user_presave(&$edit, $account, $category) {
+function overlay_user_presave(&$edit, $account) {
if (isset($edit['overlay'])) {
$edit['data']['overlay'] = $edit['overlay'];
}
diff --git a/modules/system/system.module b/modules/system/system.module
index b11e77e..ef86b54 100644
--- a/modules/system/system.module
+++ b/modules/system/system.module
@@ -1944,12 +1944,10 @@ function system_custom_theme() {
* Implements hook_form_FORM_ID_alter().
*/
function system_form_user_profile_form_alter(&$form, &$form_state) {
- if ($form['#user_category'] == 'account') {
- if (variable_get('configurable_timezones', 1)) {
- system_user_timezone($form, $form_state);
- }
- return $form;
+ if (variable_get('configurable_timezones', 1)) {
+ system_user_timezone($form, $form_state);
}
+ return $form;
}
/**
@@ -1987,7 +1985,6 @@ function system_user_timezone(&$form, &$form_state) {
global $user;
$account = $form['#user'];
-
$form['timezone'] = array(
'#type' => 'fieldset',
'#title' => t('Locale settings'),
@@ -2002,7 +1999,7 @@ function system_user_timezone(&$form, &$form_state) {
'#description' => t('Select the desired local time and time zone. Dates and times throughout this site will be displayed using this time zone.'),
);
if (!isset($account->timezone) && $account->uid == $user->uid && empty($form_state['input']['timezone'])) {
- $form['timezone']['#description'] = t('Your time zone setting will be automatically detected if possible. Confirm the selection and click save.');
+ $form['#description'] = t('Your time zone setting will be automatically detected if possible. Confirm the selection and click save.');
$form['timezone']['timezone']['#attributes'] = array('class' => array('timezone-detect'));
drupal_add_js('misc/timezone.js');
}
diff --git a/modules/trigger/trigger.module b/modules/trigger/trigger.module
index 6c1f58f..bfcb0ea 100644
--- a/modules/trigger/trigger.module
+++ b/modules/trigger/trigger.module
@@ -463,8 +463,8 @@ function _trigger_normalize_user_context($type, $account) {
/**
* Implements hook_user_login().
*/
-function trigger_user_login(&$edit, $account, $category) {
- _trigger_user('user_login', $edit, $account, $category);
+function trigger_user_login(&$edit, $account) {
+ _trigger_user('user_login', $edit, $account);
}
/**
@@ -478,15 +478,15 @@ function trigger_user_logout($account) {
/**
* Implements hook_user_insert().
*/
-function trigger_user_insert(&$edit, $account, $category) {
- _trigger_user('user_insert', $edit, $account, $category);
+function trigger_user_insert(&$edit, $account) {
+ _trigger_user('user_insert', $edit, $account);
}
/**
* Implements hook_user_update().
*/
-function trigger_user_update(&$edit, $account, $category) {
- _trigger_user('user_update', $edit, $account, $category);
+function trigger_user_update(&$edit, $account) {
+ _trigger_user('user_update', $edit, $account);
}
/**
@@ -505,7 +505,7 @@ function trigger_user_cancel($edit, $account, $method) {
*/
function trigger_user_delete($account) {
$edit = array();
- _trigger_user('user_delete', $edit, $account, NULL);
+ _trigger_user('user_delete', $edit, $account);
}
/**
@@ -513,13 +513,13 @@ function trigger_user_delete($account) {
*/
function trigger_user_view($account) {
$edit = NULL;
- _trigger_user('user_view', $edit, $account, NULL);
+ _trigger_user('user_view', $edit, $account);
}
/**
* Calls action functions for user triggers.
*/
-function _trigger_user($hook, &$edit, $account, $category = NULL) {
+function _trigger_user($hook, &$edit, $account, $method = NULL) {
// Keep objects for reuse so that changes actions make to objects can persist.
static $objects;
$aids = trigger_get_assigned_actions($hook);
@@ -535,10 +535,10 @@ function _trigger_user($hook, &$edit, $account, $category = NULL) {
$objects[$type] = _trigger_normalize_user_context($type, $account);
}
$context['user'] = $account;
- actions_do($aid, $objects[$type], $context);
+ actions_do($aid, $objects[$type], $context, $method);
}
else {
- actions_do($aid, $account, $context, $category);
+ actions_do($aid, $account, $context);
}
}
}
diff --git a/modules/user/user-profile-category.tpl.php b/modules/user/user-profile-category.tpl.php
deleted file mode 100644
index 8b6cd99..0000000
--- a/modules/user/user-profile-category.tpl.php
+++ /dev/null
@@ -1,35 +0,0 @@
-
-
diff --git a/modules/user/user-profile-item.tpl.php b/modules/user/user-profile-item.tpl.php
deleted file mode 100644
index 042d43a..0000000
--- a/modules/user/user-profile-item.tpl.php
+++ /dev/null
@@ -1,26 +0,0 @@
-
-
>
->
diff --git a/modules/user/user.api.php b/modules/user/user.api.php
index 0b4f38f..8cf788c 100644
--- a/modules/user/user.api.php
+++ b/modules/user/user.api.php
@@ -183,29 +183,6 @@ function hook_user_operations() {
}
/**
- * Retrieve a list of user setting or profile information categories.
- *
- * @return
- * An array of associative arrays. Each inner array has elements:
- * - "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.
- * - "access callback": Name of the access callback function to use to
- * determine whether the user can edit the category. Defaults to using
- * user_edit_access(). See hook_menu() for more information on access
- * callbacks.
- * - "access arguments": Arguments for the access callback function. Defaults
- * to array(1).
- */
-function hook_user_categories() {
- return array(array(
- 'name' => 'account',
- 'title' => t('Account settings'),
- 'weight' => 1,
- ));
-}
-
-/**
* A user account is about to be created or updated.
*
* This hook is primarily intended for modules that want to store properties in
@@ -217,13 +194,11 @@ function hook_user_categories() {
* 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.
*
* @see hook_user_insert()
* @see hook_user_update()
*/
-function hook_user_presave(&$edit, $account, $category) {
+function hook_user_presave(&$edit, $account) {
// Make sure that our form value 'mymodule_foo' is stored as 'mymodule_bar'.
if (isset($edit['mymodule_foo'])) {
$edit['data']['my_module_foo'] = $edit['my_module_foo'];
@@ -240,13 +215,11 @@ function hook_user_presave(&$edit, $account, $category) {
* 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.
*
* @see hook_user_presave()
* @see hook_user_update()
*/
-function hook_user_insert(&$edit, $account, $category) {
+function hook_user_insert(&$edit, $account) {
db_insert('mytable')
->fields(array(
'myfield' => $edit['myfield'],
@@ -265,13 +238,11 @@ function hook_user_insert(&$edit, $account, $category) {
* 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.
*
* @see hook_user_presave()
* @see hook_user_insert()
*/
-function hook_user_update(&$edit, $account, $category) {
+function hook_user_update(&$edit, $account) {
db_insert('user_changes')
->fields(array(
'uid' => $account->uid,
@@ -331,17 +302,8 @@ function hook_user_view($account, $view_mode, $langcode) {
'#markup' => theme('user_picture', array('account' => $account)),
'#weight' => -10,
);
- if (!isset($account->content['summary'])) {
- $account->content['summary'] = array();
- }
- $account->content['summary'] += array(
- '#type' => 'user_profile_category',
- '#attributes' => array('class' => array('user-member')),
- '#weight' => 5,
- '#title' => t('History'),
- );
- $account->content['summary']['member_for'] = array(
- '#type' => 'user_profile_item',
+ $account->content['member_for'] = array(
+ '#type' => 'item',
'#title' => t('Member for'),
'#markup' => format_interval(REQUEST_TIME - $account->created),
);
diff --git a/modules/user/user.module b/modules/user/user.module
index 14e1459..0e2f5e0 100644
--- a/modules/user/user.module
+++ b/modules/user/user.module
@@ -92,13 +92,11 @@ function user_help($path, $arg) {
* @param $account
* The user account object to be passed as the second parameter of the hook
* function.
- * @param $category
- * The category of user information being acted upon.
*/
-function user_module_invoke($type, &$edit, $account, $category = NULL) {
+function user_module_invoke($type, &$edit, $account) {
foreach (module_implements('user_' . $type) as $module) {
$function = $module . '_user_' . $type;
- $function($edit, $account, $category);
+ $function($edit, $account);
}
}
@@ -116,16 +114,6 @@ function user_theme() {
'template' => 'user-profile',
'file' => 'user.pages.inc',
),
- 'user_profile_category' => array(
- 'render element' => 'element',
- 'template' => 'user-profile-category',
- 'file' => 'user.pages.inc',
- ),
- 'user_profile_item' => array(
- 'render element' => 'element',
- 'template' => 'user-profile-item',
- 'file' => 'user.pages.inc',
- ),
'user_list' => array(
'variables' => array('users' => NULL, 'title' => NULL),
),
@@ -222,7 +210,7 @@ function user_field_extra_fields() {
),
),
'display' => array(
- 'summary' => array(
+ 'member-for' => array(
'label' => t('History'),
'description' => t('User module history view element.'),
'weight' => 5,
@@ -362,15 +350,13 @@ function user_load_by_name($name) {
* An array of fields and values to save. For example array('name'
* => 'My name'). Key / value pairs added to the $edit['data'] will be
* serialized and saved in the {users.data} column.
- * @param $category
- * (optional) The category for storing profile information in.
*
* @return
* A fully-loaded $user object upon successful save or FALSE if the save failed.
*
* @todo D8: Drop $edit and fix user_save() to be consistent with others.
*/
-function user_save($account, $edit = array(), $category = 'account') {
+function user_save($account, $edit = array()) {
$transaction = db_transaction();
try {
if (!empty($edit['pass'])) {
@@ -408,7 +394,7 @@ function user_save($account, $edit = array(), $category = 'account') {
}
// Invoke hook_user_presave() for all modules.
- user_module_invoke('presave', $edit, $account, $category);
+ user_module_invoke('presave', $edit, $account);
// Invoke presave operations of Field Attach API and Entity API. Those APIs
// require a fully-fledged and updated entity object. Therefore, we need to
@@ -506,7 +492,7 @@ function user_save($account, $edit = array(), $category = 'account') {
$edit[$key] = $value;
}
}
- user_module_invoke('update', $edit, $account, $category);
+ user_module_invoke('update', $edit, $account);
module_invoke_all('entity_update', $account, 'user');
}
else {
@@ -531,7 +517,7 @@ function user_save($account, $edit = array(), $category = 'account') {
field_attach_insert('user', $account);
$edit = (array) $account;
- user_module_invoke('insert', $edit, $account, $category);
+ user_module_invoke('insert', $edit, $account);
module_invoke_all('entity_insert', $account, 'user');
// Save user roles.
@@ -904,19 +890,6 @@ function user_search_execute($keys = NULL, $conditions = NULL) {
}
/**
- * Implements hook_element_info().
- */
-function user_element_info() {
- $types['user_profile_category'] = array(
- '#theme_wrappers' => array('user_profile_category'),
- );
- $types['user_profile_item'] = array(
- '#theme' => 'user_profile_item',
- );
- return $types;
-}
-
-/**
* Implements hook_user_view().
*/
function user_user_view($account) {
@@ -924,17 +897,8 @@ function user_user_view($account) {
'#markup' => theme('user_picture', array('account' => $account)),
'#weight' => -10,
);
- if (!isset($account->content['summary'])) {
- $account->content['summary'] = array();
- }
- $account->content['summary'] += array(
- '#type' => 'user_profile_category',
- '#attributes' => array('class' => array('user-member')),
- '#weight' => 5,
- '#title' => t('History'),
- );
- $account->content['summary']['member_for'] = array(
- '#type' => 'user_profile_item',
+ $account->content['member_for'] = array(
+ '#type' => 'item',
'#title' => t('Member for'),
'#markup' => format_interval(REQUEST_TIME - $account->created),
);
@@ -1149,7 +1113,6 @@ function user_validate_current_pass(&$form, &$form_state) {
* @see user_account_form()
*/
function user_account_form_validate($form, &$form_state) {
- if ($form['#user_category'] == 'account' || $form['#user_category'] == 'register') {
$account = $form['#user'];
// Validate new or changing username.
if (isset($form_state['values']['name'])) {
@@ -1193,25 +1156,22 @@ function user_account_form_validate($form, &$form_state) {
form_set_error('signature', t('The signature is too long: it must be %max characters or less.', array('%max' => $user_schema['fields']['signature']['length'])));
}
}
- }
}
/**
* Implements hook_user_presave().
*/
-function user_user_presave(&$edit, $account, $category) {
- if ($category == 'account' || $category == 'register') {
- 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;
- }
- // Prepare user roles.
- if (isset($edit['roles'])) {
- $edit['roles'] = array_filter($edit['roles']);
- }
+function user_user_presave(&$edit, $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;
+ }
+ // Prepare user roles.
+ if (isset($edit['roles'])) {
+ $edit['roles'] = array_filter($edit['roles']);
}
// Move account cancellation information into $user->data.
@@ -1222,17 +1182,6 @@ function user_user_presave(&$edit, $account, $category) {
}
}
-/**
- * Implements hook_user_categories().
- */
-function user_user_categories() {
- return array(array(
- 'name' => 'account',
- 'title' => t('Account settings'),
- 'weight' => 1,
- ));
-}
-
function user_login_block($form) {
$form['#action'] = url($_GET['q'], array('query' => drupal_get_destination()));
$form['#id'] = 'user-login-form';
@@ -1716,33 +1665,6 @@ function user_menu() {
'type' => MENU_LOCAL_TASK,
'file' => 'user.pages.inc',
);
-
- $items['user/%user_category/edit/account'] = array(
- 'title' => 'Account',
- 'type' => MENU_DEFAULT_LOCAL_TASK,
- 'load arguments' => array('%map', '%index'),
- );
-
- if (($categories = _user_categories()) && (count($categories) > 1)) {
- foreach ($categories as $key => $category) {
- // 'account' is already handled by the MENU_DEFAULT_LOCAL_TASK.
- if ($category['name'] != 'account') {
- $items['user/%user_category/edit/' . $category['name']] = array(
- 'title callback' => 'check_plain',
- 'title arguments' => array($category['title']),
- 'page callback' => 'drupal_get_form',
- 'page arguments' => array('user_profile_form', 1, 3),
- 'access callback' => isset($category['access callback']) ? $category['access callback'] : 'user_edit_access',
- 'access arguments' => isset($category['access arguments']) ? $category['access arguments'] : array(1),
- 'type' => MENU_LOCAL_TASK,
- 'weight' => $category['weight'],
- 'load arguments' => array('%map', '%index'),
- 'tab_parent' => 'user/%/edit',
- 'file' => 'user.pages.inc',
- );
- }
- }
- }
return $items;
}
@@ -1861,44 +1783,6 @@ function user_uid_optional_load($uid = NULL) {
}
/**
- * Return a user object after checking if any profile category in the path exists.
- */
-function user_category_load($uid, &$map, $index) {
- static $user_categories, $accounts;
-
- // Cache $account - this load function will get called for each profile tab.
- if (!isset($accounts[$uid])) {
- $accounts[$uid] = user_load($uid);
- }
- $valid = TRUE;
- if ($account = $accounts[$uid]) {
- // Since the path is like user/%/edit/category_name, the category name will
- // be at a position 2 beyond the index corresponding to the % wildcard.
- $category_index = $index + 2;
- // Valid categories may contain slashes, and hence need to be imploded.
- $category_path = implode('/', array_slice($map, $category_index));
- if ($category_path) {
- // Check that the requested category exists.
- $valid = FALSE;
- if (!isset($user_categories)) {
- $user_categories = _user_categories();
- }
- foreach ($user_categories as $category) {
- if ($category['name'] == $category_path) {
- $valid = TRUE;
- // Truncate the map array in case the category name had slashes.
- $map = array_slice($map, 0, $category_index);
- // Assign the imploded category name to the last map element.
- $map[$category_index] = $category_path;
- break;
- }
- }
- }
- }
- return $valid ? $account : FALSE;
-}
-
-/**
* Returns $arg or the user ID of the current user if $arg is '%' or empty.
*
* @todo rethink the naming of this in Drupal 8.
@@ -2443,10 +2327,6 @@ function user_view_page($account) {
*
* When viewing a user profile, the $page array contains:
*
- * - $page['content']['Profile Category']:
- * Profile categories keyed by their human-readable names.
- * - $page['content']['Profile Category']['profile_machine_name']:
- * Profile fields keyed by their machine-readable names.
* - $page['content']['user_picture']:
* User's rendered picture.
* - $page['content']['summary']:
@@ -3257,22 +3137,6 @@ function user_multiple_cancel_confirm_submit($form, &$form_state) {
}
/**
- * Retrieve a list of all user setting/information categories and sort them by weight.
- */
-function _user_categories() {
- $categories = module_invoke_all('user_categories');
- usort($categories, '_user_sort');
-
- return $categories;
-}
-
-function _user_sort($a, $b) {
- $a = (array) $a + array('weight' => 0, 'title' => '');
- $b = (array) $b + array('weight' => 0, 'title' => '');
- return $a['weight'] < $b['weight'] ? -1 : ($a['weight'] > $b['weight'] ? 1 : ($a['title'] < $b['title'] ? -1 : 1));
-}
-
-/**
* List user administration filters that can be applied.
*/
function user_filters() {
@@ -3658,7 +3522,6 @@ function user_register_form($form, &$form_state) {
}
$form['#user'] = drupal_anonymous_user();
- $form['#user_category'] = 'register';
$form['#attached']['library'][] = array('system', 'jquery.cookie');
$form['#attributes']['class'][] = 'user-info-from-cookie';
diff --git a/modules/user/user.pages.inc b/modules/user/user.pages.inc
index 02870e9..8239c53 100644
--- a/modules/user/user.pages.inc
+++ b/modules/user/user.pages.inc
@@ -198,42 +198,7 @@ function template_preprocess_user_profile(&$variables) {
}
/**
- * Process variables for user-profile-item.tpl.php.
- *
- * The $variables array contains the following arguments:
- * - $element
- *
- * @see user-profile-item.tpl.php
- */
-function template_preprocess_user_profile_item(&$variables) {
- $variables['title'] = $variables['element']['#title'];
- $variables['value'] = $variables['element']['#markup'];
- $variables['attributes'] = '';
- if (isset($variables['element']['#attributes'])) {
- $variables['attributes'] = drupal_attributes($variables['element']['#attributes']);
- }
-}
-
-/**
- * Process variables for user-profile-category.tpl.php.
- *
- * The $variables array contains the following arguments:
- * - $element
- *
- * @see user-profile-category.tpl.php
- */
-function template_preprocess_user_profile_category(&$variables) {
- $variables['title'] = check_plain($variables['element']['#title']);
- $variables['classes_array'][] = 'user-profile-category-' . drupal_html_class($variables['title']);
- $variables['profile_items'] = $variables['element']['#children'];
- $variables['attributes'] = '';
- if (isset($variables['element']['#attributes'])) {
- $variables['attributes'] = drupal_attributes($variables['element']['#attributes']);
- }
-}
-
-/**
- * Form builder; edit a user account or one of their profile categories.
+ * Form builder; edit a user account.
*
* @ingroup forms
* @see user_account_form()
@@ -242,7 +207,7 @@ function template_preprocess_user_profile_category(&$variables) {
* @see user_profile_form_submit()
* @see user_cancel_confirm_form_submit()
*/
-function user_profile_form($form, &$form_state, $account, $category = 'account') {
+function user_profile_form($form, &$form_state, $account) {
global $user;
// During initial form build, add the entity to the form state for use during
@@ -258,27 +223,23 @@ function user_profile_form($form, &$form_state, $account, $category = 'account')
// @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.
- field_attach_form('user', $account, $form, $form_state);
- }
+
+ user_account_form($form, $form_state);
+ // Attach field widgets.
+ field_attach_form('user', $account, $form, $form_state);
$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['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.
@@ -299,7 +260,6 @@ function user_profile_form_validate($form, &$form_state) {
*/
function user_profile_form_submit($form, &$form_state) {
$account = $form_state['user'];
- $category = $form['#user_category'];
// Remove unneeded values.
form_state_values_clean($form_state);
@@ -315,10 +275,10 @@ function user_profile_form_submit($form, &$form_state) {
// this form by taking over all values, which appear in the form values too.
$edit = array_intersect_key((array) $account, $form_state['values']);
- user_save($account_unchanged, $edit, $category);
+ user_save($account_unchanged, $edit);
$form_state['values']['uid'] = $account->uid;
- if ($category == 'account' && !empty($edit['pass'])) {
+ if (!empty($edit['pass'])) {
// Remove the password reset tag since a new password was saved.
unset($_SESSION['pass_reset_'. $account->uid]);
}