diff --git a/core/modules/system/system.api.php b/core/modules/system/system.api.php index 2bff21f..8214090 100644 --- a/core/modules/system/system.api.php +++ b/core/modules/system/system.api.php @@ -1852,7 +1852,7 @@ function hook_file_download($uri) { * shipped file. */ function hook_file_url_alter(&$uri) { - global $user; + $user = \Drupal::currentUser(); // User 1 will always see the local file in this example. if ($user->id() == 1) { @@ -2719,8 +2719,7 @@ function hook_url_outbound_alter(&$path, &$options, $original_path) { // Instead of pointing to user/[uid]/edit, point to user/me/edit. if (preg_match('|^user/([0-9]*)/edit(/.*)?|', $path, $matches)) { - global $user; - if ($user->id() == $matches[1]) { + if (\Drupal::currentUser()->id() == $matches[1]) { $path = 'user/me/edit' . $matches[2]; } } diff --git a/core/modules/system/system.module b/core/modules/system/system.module index 40c3234..e1bf500 100644 --- a/core/modules/system/system.module +++ b/core/modules/system/system.module @@ -123,8 +123,7 @@ function system_help($path, $arg) { } break; case 'admin/config/development/maintenance': - global $user; - if ($user->id() == 1) { + if (\Drupal::currentUser()->id() == 1) { return '

' . t('Use maintenance mode when making major updates, particularly if the updates could disrupt visitors or the update process. Examples include upgrading, importing or exporting content, modifying a theme, modifying content types, and making backups.') . '

'; } break; @@ -2188,7 +2187,7 @@ function system_user_login($account) { * Add the time zone field to the user edit and register forms. */ function system_user_timezone(&$form, &$form_state) { - global $user; + $user = \Drupal::currentUser(); $account = $form_state['controller']->getEntity(); $form['timezone'] = array(