Resetting view count

I ran a query to update the thread view count to 0

The database shows 0 but the front end now im seeing view count is the number of replies + 1

Any ideas how i can get this to 0?

The database shows the correct number
 
Code:
UPDATE `xf_thread` SET view_count = 0;

That sql query should reset all thread view counts to 0.

Can you screenshot that part where thread view count is not correct?
 
I have to ask, are you really sure that you excecuted that query in the database of your forum, and say, not in a database used for another forum?

Can you please screenshot the view_count field for threads from phpmyadmin?
 
This is an odd issue. The only reasons that I can think of for this not working, is that either the query is not being run in the right database, or you have a third party add on that it is manipulating thread views.
 
View counts are separated from reply counts. Your situation is very strange.

Can you check thread_list_item template, and see if you have this code there?

HTML:
<dl class="minor"><dt>{xen:phrase views}:</dt> <dd>{xen:if $thread.isRedirect, '&ndash;', {xen:number $thread.view_count}}</dd></dl>

What add ons do you have installed? Can you list them here? Do you have custom made crons that perhaps manipulate thread views? Because this is not a default behavious of xenforo. There must be an outside thing causing this.
 
Do you mind to give me access to your forum so I can have a look into this?

I do not know if this is covered by the support policy of Xenforo, but you can open a Ticket at your Helpdesk, and maybe one of Xenforo 's Team members can look into this. Because this is a very odd issue.

I will have to ask you again, are you 100% sure that you have run the query at the database where your forum is installed?
 
I submitted a ticket to support and they said theres no support =) since its not recommended.

yes i only have one db and it works just the front end view is different. If you look in the DB it works how it should.

when i use the batch update tool in xenforo the data is right as well. Its a front end view issue.
 
The view count is always going to be at least the post count (which is reply count +1).

Check the model code.

You are correct sir. I thought that they would have been independent from each other. Is there any reason why it is being calculated like that?

This is for the OP. If you do not want to be calculated like that, remove this code from the Thread.php file inside the Model folder.

PHP:
if ($thread['view_count'] <= $thread['reply_count'])
{
        $thread['view_count'] = $thread['reply_count'] + 1;
}
 
Top Bottom