MyBB Community Forums

Full Version: get posts back into forums
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I had an error on my server last night that deleted a whole category on my site. All the posts are still in the database. Is there a way to get these to rebuild into the forums once I recreate the forums?
You would have to go through the database (using phpMyAdmin or some other SQL Program) and find those posts and assign them to their forums.
Thanks but could you please be more specific. I have acces to myphp admin. I went under posts and changed the fid to match that of one of the forums but it still does not show up.
You have to do the same thing in the mybb_threads table.
thank you very much.
So to recap go into the posts table and change the fid to match the new fid then go into the threads table and do the same thing.
Is that correct?

Ok got that working now how do I get the index page to count those threads under number of threads and posts?
Recount Stats in the ACP should work.
Ryan Ashbrook Wrote:Recount Stats in the ACP should work.
Tried that doesn't seem to work. Maybe once I get all the posts switched to the new forum id's it will work.
Changing just the myybb_threads to the new fid's atleast shows them once you open the forum up.
Thanks for the help guys.
If you only have a few forums, you can just make a new test thread, and delete it afterwards, for each forum. Then the counters should read the correct value. If you have many forums, you'll probably want this script to update the forum counts all at once. Save it as a .php file and upload to your MyBB folder

<?php
// Update Forum Counts
require "./global.php";

$query = $db->query("SELECT fid FROM ".TABLE_PREFIX."forums");
$done = 0;
while($forum = $db->fetch_array($query))
{
    update_forum_count($forum['fid']);
    ++$done;
}
echo $done.' forums updated';
?>
Thank you DennisTT.
I really love mybb and the help that is given on this forum. I can not wait for v1.2
Keep up the good work.

EDIT: I get this error by using the posted code above.
Fatal error: Call to undefined function: update_forum_count() in /home/shadowdo/public_html/mybb/resetcount.php on line 9

I copied the following named it resetcount.php but still get the error
Quote:<?php
// Update Forum Counts
require "./global.php";

$query = $db->query("SELECT fid FROM ".TABLE_PREFIX."forums");
$done = 0;
while($forum = $db->fetch_array($query))
{
update_forum_count($forum['fid']);
++$done;
}
echo $done.' forums updated';
?>

EDIT: I just made a test thread in each forum and it updated my stats