YAFLogo

Posted by: SURFThru - Sunday, 6 April 2008 13:26:17
I moved some posts around in the forums and the counts did not change in any of the forums. Is there a method to recount all the posts in the forums?

Posted by: Jaben - Sunday, 6 April 2008 15:22:12
Nope.

Posted by: cbm - Monday, 9 June 2008 13:16:26
To do this recount, you can just run this simple script in your DB. I did write and use it when I've moved my forum from phpBB to yaf. This will not only update you forum counters, but also fix any "last post" and "last topic" if broken. [code] use [your_database] -- Update users counter update yaf_User set NumPosts = (select count(*) from yaf_Message where yaf_Message.UserID = yaf_User.UserID) -- Update topics counter and last posts update yaf_Topic set LastPosted = (select top(1) yaf_Message.Posted from yaf_Message where yaf_Message.TopicID = yaf_Topic.TopicID order by Posted desc), LastMessageID = (select top(1) yaf_Message.MessageID from yaf_Message where yaf_Message.TopicID = yaf_Topic.TopicID order by Posted desc), LastUserID = (select top(1) yaf_Message.UserID from yaf_Message where yaf_Message.TopicID = yaf_Topic.TopicID order by Posted desc), NumPosts = (select count(*) from yaf_Message where yaf_Message.TopicID = yaf_Topic.TopicID) -- Update forums counters and last posts update yaf_Forum set LastTopicID = (select top(1) yaf_Topic.TopicID from yaf_Topic where yaf_Topic.ForumID = yaf_Forum.ForumID order by yaf_Topic.Posted desc), LastMessageID = (select top(1) yaf_Topic.LastMessageID from yaf_Topic where yaf_Topic.ForumID = yaf_Forum.ForumID order by yaf_Topic.LastPosted desc), LastUserID = (select top(1) yaf_Topic.LastUserID from yaf_Topic where yaf_Topic.ForumID = yaf_Forum.ForumID order by yaf_Topic.LastPosted desc), NumTopics = (select count(*) from yaf_Topic where yaf_Topic.ForumID = yaf_Forum.ForumID), NumPosts = (select sum(NumPosts) from yaf_Topic where yaf_Topic.ForumID = yaf_Forum.ForumID) [/code]