MyBB Community Forums

Full Version: My forum post view count is zero, help me solve it please
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4
(2021-09-22, 01:00 AM)HLFadmin Wrote: [ -> ]On your server is easiest, especially if your host provides cPanel access.
Log in to your accounts cpanel, start up phpmyadmin, select your database, select the table, mybb_forums.

Browse first, look at the values for usepostcounts. If it's already set to 1, there's nothing to change.

Otherwise, click the SQL tab and enter your update query.

UPDATE mybb_forums SET usepostcounts = 1;

There will be an button to SIMULATE QUERY so you can see how many records will be changed. If all is as you expect, click the Go button to make it happen.

All that said, I don't believe you will fix your problem that way. Your problem is views, not post count.
The new 1.8.27 added some conditionals that influence the forum view count.
I'm still on 1.8.26 and do not have experience with the new settings yet.

I observe that, with 2 exceptions, all threads in NEWS DEPARTMENTS forums created or posted to before 9/16 approximately 12:54pm have view counts. Threads and posts after that date have zero views. Something changed on that date. Whether it was a plugin or something else, I can't see. But there's your first clue. I did not continue to look in the other forum groups.

Your next clue might be in seeing what core files have been changed. (whether a manual edit or changed by a plugin). AdminCP / Tools and Maintenance / File Verification.

Your next answer might be from asking of the community in general "Has anyone seen the view count not change in forumdisplay with a new installation of 1.8.27?"

I can't answer that, I have not yet updated.

Finally, I also observe that guest views don't count, but neither do member views. I signed up, viewed the truck overturn news item, replied to the thread, and the view count did not change.

So, if file verification shows no changes to forumdisplay.php or showthread.php, then the only other place I could think is in the templates.

AdminCP / Templates and Style, click Templates, then tab Find Updated Templates. Look for forumdisplay_thread in your current theme. If it is not listed there, then it is most likely unchanged. But you could go and look at its coding. You're looking for 2 lines similar to

	<td align="center" class="{$bgcolor}{$thread_type_class}"><a href="{$mybb->settings['bburl']}/misc.php?action=whoposted&tid={$thread['tid']}" onclick="MyBB.whoPosted({$thread['tid']}); return false;">{$thread['replies']}</a>{$unapproved_posts}</td>
	<td align="center" class="{$bgcolor}{$thread_type_class}">{$thread['views']}</td>

{$thread['views']} is the variable that shows the thread views currently being counted.

Since some older thread views are not zero, then the template is most likely ok.

Showthread.php is where the views count gets updated.

In AdminCP / Configuration / Show Thread Options, what is your setting for Delayed Thread View Updates? Is it On or Off? Set it to Off. If it is On, thread view update occurs every 15 minutes with the Task Manager / Thread Views.

If it is supposed to update as a task, and your theme has been edited to delete the required code at the bottom, then the task is not running, hence no update.

Try this as a double check. AdminCP / Tools and Maintenance / Task Manager / Scheduled Tasks, locate Thread Views task and click the associated Run Task link. View the forum to see if it updated.

If that's the case, you need to fix the theme or change the Showthread option I mentioned earlier.

Thank you very much for your time, support and efforts, I really appreciate. I will do as you have well explained and get back to you with the results I got.

Thanks.

I have checked everything as you said, the template settings are all OK.

I can't just figure out where the problem is!

I was unable to edit the code through phpmyadmin. I couldn't find any code related to mybb_ in there.

Even the template doesn't update new registered user, until I manually rebuild and recount statistics.

The problem now is not just only VIEWS issue, general auto update is a serious issue of the forum.

Sir, can I make you admin of my forum so you can use your super experience to check for this issue for me please?
Quote:In AdminCP / Configuration / Show Thread Options, what is your setting for Delayed Thread View Updates? Is it On or Off?
what is / was the setting? Did you change it?

Your update query is not code to edit. It is an action to be taken on the database. phpmyadmin is where that action takes place.

And, please explain what you mean by "general auto update is a serious issue of the forum".
I made a test account, if you can make that an admin I can check some settings. The fact the stats don't update for new users suggests there's an issue with shutdown functions not running, but I have no idea why that would be.
I observe that the last known time/date when your forum *was* counting views properly corresponds closely with your last post in this thread.
https://community.mybb.com/thread-233555...pid1371138
Ok sir. I will do that now. Thanks
(2021-09-21, 09:49 PM)obeyafriday Wrote: [ -> ]
(2021-09-21, 11:14 AM)Matt Wrote: [ -> ]Go to ACP > Configuration > General Configuration > set Disable All Plugins to yes. I remember a problem from about 10 year ago of a plugin preventing views increasing but can't remember which one it was.

OK, Thank you sir,

I don't know if you tried this, but I just enabled this setting and it fixed the issue. So it's a plugin causing it.

I tried to view the plugins list though and it's a blank page. Can you screenshot what's in the ./inc/plugins/ folder?
File Verification -- OK.
Plugins do not list a page at all. This might be overridden by the Upload Plugin tool which I do not have access to.
Delayed Thread View Updates is Off. All 4 options for Increment thread View are Yes.

In AdminCP / Configuration / Settings / General Configuration, I set Disable All Plugins to Yes, and continued to browse threads. The View count started to increment.

While the plugins were disabled, the browser back button started working correctly. In other words, a single click on Back took me to the previous page. With the plugins enabled, the first click on Back does nothing, the second click takes me back to the previous page.

It appears there is a plugin which is causing the view count problem. I cannot access them, so cannot determine which one is at fault.

I made no other changes, and restored the one setting to enable plugins.
I established that above re a plugin being the cause.

Also the back button is a browser feature and can't be affected by a plugin, and not seeing any issues with that anyway.
I looked in a lot of places just to find any anomalies. The only one is the plugin problem where Upload Plugin does not permit access, and therefore makes it impossible to continue to evaluate.

It is not theme-related, at least that I can see. I created a new theme MyBBDefault based on the Master MyBB theme. No change in Views count.

I believe the problem is plugin related.

The process by which troubleshooting continues is to deactivate all the plugins from the plugin control panel, then activate them one by one to discover which one is at fault. This can only be done by you, assuming you have limited access to them.

If it is not possible to fix it this way, the next step is to investigate at the server level.

@Matt
We were both looking for the trouble at about the same time.
Yours and my conclusions were identical, yours was posted first. Smile

The double Back click problem may be a Firefox oddity. That's the browser I use. Not tested with another. However, I did confirm the change in browser behavior several times in different iterations of disabling all plugins.
My guess is that the plugin that's causing this problem is generating an error on showthread.php, which would, it seems, given line #145 of inc/functions.php, cause an early return from the shutdown function, which in turn would prevent the shutdown DB queries - on which updating of the thread view counts depends - from running.

Edit: Hmm. It seems though that any error/warning would be displayed on that page, but there aren't any errors/warnings being displayed, so my guess is probably wrong.

Edit2: In any case, the run_shutdown() function in inc/functions.php seems like a good place to focus debugging on.
Pages: 1 2 3 4