MyBB Community Forums

Full Version: Where is the reference in a theme to increase the number of visits of a thread?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello,

What I need to know is which and where is the reference that increases the number of visits of a thread.

I have searched header, headerinclude, showthread, postbit and I do not see the reference.

I need this because I am working on 2 themes, they are almost the same but I made them modifications in several templates, and now in one of the themes the number of visits does not increase, and I am going crazy looking for that reference that makes a thread increase its views.


I hope someone can help!  Blush
showthread.php

if($mybb->settings['delayedthreadviews'] == 1)
{
$db->shutdown_query("INSERT INTO ".TABLE_PREFIX."threadviews (tid) VALUES('{$tid}')");
}
else
{
$db->shutdown_query("UPDATE ".TABLE_PREFIX."threads SET views=views+1 WHERE tid='{$tid}'");
}
++$thread['views'];

most likely you would not have changed this. So you would have to review those changes you made to the templates.
Edit: 

I am almost sure that the reference for the increase is a DIV CLASS or DIV ID.

It must be that, since the .js files I have the same in both themes.

(2019-07-18, 10:53 PM)Ashley1 Wrote: [ -> ]showthread.php

if($mybb->settings['delayedthreadviews'] == 1)
{
$db->shutdown_query("INSERT INTO ".TABLE_PREFIX."threadviews (tid) VALUES('{$tid}')");
}
else
{
$db->shutdown_query("UPDATE ".TABLE_PREFIX."threads SET views=views+1 WHERE tid='{$tid}'");
}
++$thread['views'];

most likely you would not have changed this. So you would have to review those changes you made to the templates.

My showthread.php is the same, the problem is in the theme, I think it is a DIV the reference that executes some JS for the increase of visits.
Are you having the 2 themes on the same forum, or different forums?
In the same forum, I'm working on localhost and all mybb files are the same, only the theme changes, the theme is the same, but it has html and css changed, just that.
html and css can't cause the count to be out. The count is queried from the database on each pageload. I don't see how the value can be different on theme switches.

Are you using php conditionals in the theme ?
(2019-07-18, 11:04 PM)Ashley1 Wrote: [ -> ]html and css can't cause the count to be out. The count is queried from the database on each pageload. I don't see how the value can be different on theme switches.

Are you using php conditionals in the theme ?

I have located the problem.

The problem is the template 'postbit_first' of the Xthreads plugin of ZiNGa BuRGa, that makes my views stop working, I have deleted the variable {$ first_post} in the template 'showthread' and now the views increment works correctly.

PD: Ashley1, Thank you very much for trying to help me, really, thank you.