Commit ba69ad0a authored by alexpott's avatar alexpott
Browse files

Issue #2061935 by m1r1k, danylevskyi, joelpittet: Remove calls to deprecated...

Issue #2061935 by m1r1k, danylevskyi, joelpittet: Remove calls to deprecated global $user in forum module.
parent a18f9c6e
......@@ -149,7 +149,7 @@ function forum_menu() {
* Implements hook_menu_local_tasks().
*/
function forum_menu_local_tasks(&$data, $route_name) {
global $user;
$user = \Drupal::currentUser();
// Add action link to 'node/add/forum' on 'forum' sub-pages.
if (in_array($route_name, array('forum.index', 'forum.page'))) {
......@@ -682,7 +682,7 @@ 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) {
......
......@@ -139,7 +139,8 @@ public function getTopics($tid) {
$forum_per_page = $config->get('topics.page_limit');
$sortby = $config->get('topics.order');
global $user, $forum_topic_list_header;
global $forum_topic_list_header;
$user = \Drupal::currentUser();
$forum_topic_list_header = array(
array('data' => $this->t('Topic'), 'field' => 'f.title'),
......@@ -326,7 +327,7 @@ protected function numberNew($nid, $timestamp) {
* previously viewed the node; otherwise HISTORY_READ_LIMIT.
*/
protected function lastVisit($nid) {
global $user;
$user = \Drupal::currentUser();
if (empty($this->history[$nid])) {
$result = $this->connection->select('history', 'h')
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment