From 60596eb6756e3d2181ee6670cd123911b04524bf Mon Sep 17 00:00:00 2001
From: kasimi <mail@kasimi.net>
Date: Mon, 23 Oct 2017 22:36:29 +0200
Subject: [PATCH] [ticket/15060] Set correct forum id in user session data if
 f= is missing

PHPBB3-15060
---
 phpBB/viewtopic.php | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php
index c94675a741..3f117eef6b 100644
--- a/phpBB/viewtopic.php
+++ b/phpBB/viewtopic.php
@@ -263,6 +263,10 @@ if (!$topic_data)
 
 $forum_id = (int) $topic_data['forum_id'];
 
+// If the request is missing the f parameter, the forum id in the user session data is 0 at the moment.
+// Let's fix that now so that the user can't hide from the forum's Who Is Online list.
+$user->page['forum'] = $forum_id;
+
 // Now we know the forum_id and can check the permissions
 if ($topic_data['topic_visibility'] != ITEM_APPROVED && !$auth->acl_get('m_approve', $forum_id))
 {