How to Get the User ID of Viewing a Topic?

@halilesen · 03 Nov 2024 · 319 views
Post Reply
User avatar
halilesen
#1 ·
Posts: 57
Joined: 24 Mar 2024, 18:09
Full Name: Halil ESEN
Has liked: 12
Been liked: 9
During one of my works, I needed the ID of the user who viewed the topic page. I found a way to do this simply. I opened the /viewtopic.php file located in the phpBB root and found the following line (786):

Code: Select all

'TOPIC_POSTER'	=> $topic_data['topic_poster'],
and I added the following code to the next line:

Code: Select all

'USER_IDD'	=> $user->data['user_id'],
After saving the file, when I used the {USER_IDD} code in the /template/viewtopic_body.html file of my style, I could now get the user ID of the user viewing the page.

Best.
Post Reply
  • Similar Topics