function user_install

user_install()

Implements hook_install().

File

core/modules/user/user.install, line 66
Install, update and uninstall functions for the user module.

Code

function user_install() {
  $storage = \Drupal::entityManager()->getStorage('user');
  // Insert a row for the anonymous user.
  $storage
  ->create(array(
    'uid' => 0,
    'status' => 0,
    'name' => '',
  ))
    ->save();

  // We need some placeholders here as name and mail are unique.
  // This will be changed by the settings form in the installer.
  $storage
  ->create(array(
    'uid' => 1,
    'name' => 'placeholder-for-uid-1',
    'mail' => 'placeholder-for-uid-1',
    'status' => TRUE,
  ))
    ->save();
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!modules!user!user.install/function/user_install/8.1.x