diff --git a/core/modules/forum/forum.module b/core/modules/forum/forum.module index 4621ddd..b99e841 100644 --- a/core/modules/forum/forum.module +++ b/core/modules/forum/forum.module @@ -162,7 +162,7 @@ function forum_menu() { * Implements hook_menu_local_tasks(). */ function forum_menu_local_tasks(&$data, $router_item, $root_path) { - global $user; + $user = Drupal::request()->attributes->get('_account'); // Add action link to 'node/add/forum' on 'forum' sub-pages. if ($root_path == 'forum' || $root_path == 'forum/%') { @@ -822,7 +822,8 @@ function _forum_topics_unread($term, $uid) { * A list of all the topics in a forum. */ function forum_get_topics($tid, $sortby, $forum_per_page) { - global $user, $forum_topic_list_header; + global $forum_topic_list_header; + $user = Drupal::request()->attributes->get('_account'); $forum_topic_list_header = array( array('data' => t('Topic'), 'field' => 'f.title'), @@ -1038,7 +1039,7 @@ function template_preprocess_forums(&$variables) { * - tid: Taxonomy term ID of the current forum. */ function template_preprocess_forum_list(&$variables) { - global $user; + $user = Drupal::request()->attributes->get('_account'); $row = 0; // Sanitize each forum so that the template can safely print the data. foreach ($variables['forums'] as $id => $forum) { @@ -1231,7 +1232,7 @@ function template_preprocess_forum_submitted(&$variables) { * previously viewed the node; otherwise HISTORY_READ_LIMIT. */ function _forum_user_last_visit($nid) { - global $user; + $user = Drupal::request()->attributes->get('_account'); $history = &drupal_static(__FUNCTION__, array()); if (empty($history)) {