Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Solved: 5 Years, 2 Weeks ago [How To?] Change years
#1
Solved: 5 Years, 2 Weeks ago Wink 
Hi my friends!

I close my forum at 2012. Now I wanna reopen it but I wanna change all posts data from year 2011 to 2013 and 2012 to 2014.
How can i do that  Huh

cheers  Heart
Reply
#2
Solved: 5 Years, 2 Weeks ago
Hi, I'm just not sure but personally, but if someone out there has a clear cut solution, I would be amazed to know because like I said, things can get messy really quick, good luck, I hope someone can give you a better answer.
Hey man, what's up?
Reply
#3
Solved: 5 Years, 2 Weeks ago
If your database is large you'd have to use pagination to do this, but here is a script you can use.

<?php
define("IN_MYBB", 1);
define("NO_ONLINE", 1);
require_once "global.php";
if(!$mybb->usergroup['cancp'])
{
error_no_permission();
}
$query = $db->simple_select("posts", "pid, dateline");
// First posts.
while($post = $db->fetch_array($query))
{
$updated_post['dateline'] = $post['dateline'] + 63072000;
$pid = $post['pid'];
$db->update_query("posts", $updated_post, "pid=$pid");
}
// Now threads
$query = $db->simple_select("threads", "tid, dateline, lastpost");
while($thread = $db->fetch_array($query))
{
$updated_thread['dateline'] = $thread['dateline'] + 63072000;
$updated_thread['lastpost'] = $thread['lastpost'] + 63072000;
$tid = $thread['tid'];
$db->update_query("threads", $updated_thread, "tid=$tid");
}
echo "Times updated.<br /> <a href=\"index.php\">Click Here to return to the forum</a>";
?>

1) Upload a file with that code in it into your forums directory.
2) Point your browser to that file and it will update everything.
3) Delete the file.
Reply
#4
Solved: 5 Years, 2 Weeks ago
@dragonexpert - wow it works, I dont know how... but I dont care!
Big thanx
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)