diff --git a/core/modules/forum/forum.module b/core/modules/forum/forum.module index e8c104f..25caf0e 100644 --- a/core/modules/forum/forum.module +++ b/core/modules/forum/forum.module @@ -164,7 +164,7 @@ function forum_menu() { * Implements hook_menu_local_tasks(). */ function forum_menu_local_tasks(&$data, $router_item, $root_path) { - global $user; + $user = Drupal::currentUser(); // Add action link to 'node/add/forum' on 'forum' sub-pages. if ($root_path == 'forum' || $root_path == 'forum/%') { @@ -826,7 +826,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::currentUser(); $forum_topic_list_header = array( array('data' => t('Topic'), 'field' => 'f.title'), @@ -1042,8 +1043,9 @@ function template_preprocess_forums(&$variables) { * - tid: Taxonomy term ID of the current forum. */ function template_preprocess_forum_list(&$variables) { - global $user; + $user = Drupal::currentUser(); $row = 0; + // Sanitize each forum so that the template can safely print the data. foreach ($variables['forums'] as $id => $forum) { $variables['forums'][$id]->description = filter_xss_admin($forum->description->value); @@ -1239,7 +1241,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::currentUser(); $history = &drupal_static(__FUNCTION__, array()); if (empty($history)) {