Change record status: 
Project: 
Introduced in branch: 
8.x
Description: 

Commit 70b8337cdcbd4b4ec5633bd88fd6a8a81ba71d91 from #1291100: Remove category system from user edit and view removed the category system from user edit and view and made several API changes.

This affects a number of hooks, detailed below, and may manifest itself in several ways such as "Notice: Undefined index: #user_category in foo_form_user_profile_form_alter()"

Solution is to remove any references to the legacy category system from module code. For example:

Drupal 7

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;
  }
}

Drupal 8

function system_form_user_profile_form_alter(&$form, &$form_state) {
  if (Drupal::config('system.date')->get('timezone.user.configurable')) {
    system_user_timezone($form, $form_state);
  }
  return $form;
}

API Changes

Parameter $category was removed from the signatures of all functions in several modules. Also, a few functions were removed, and one function was added.

Changes to Hooks

The following changes were made to the hook functions. All implementations of these hooks in core were changed accordingly.

Signature Changes

  • hook_user_presave(&$edit, $account, $category) to hook_user_presave(&$edit, $account)
  • hook_user_insert(&$edit, $account, $category) to hook_user_insert(&$edit, $account)
  • hook_user_update(&$edit, $account, $category) to hook_user_update(&$edit, $account)

Removed Functions

  • hook_user_categories()

Changes to Other API Functions

Signature Changes

  • Changed locale_language_selector_form(&$form, &$form_state, $user) to locale_language_selector_form($user) and returns $form
  • trigger_user_login(&$edit, $account, $category) to trigger_user_login(&$edit, $account)
  • user_module_invoke($type, &$edit, $account, $category = NULL) to user_module_invoke($type, &$edit, $account)
  • user_save($account, $edit = array(), $category = 'account') to user_save($account, $edit = array())
  • user_profile_form($form, &$form_state, $account, $category = 'account') to user_profile_form($form, &$form_state, $account)

Added Functions

  • user_update_8000()

Removed Functions

  • user_element_info()
  • user_category_load($uid, &$map, $index)
  • template_preprocess_user_profile_item(&$variables)
  • template_preprocess_user_profile_category(&$variables)
Impacts: 
Module developers