MyBB Community Forums

Full Version: Mark all threads as read for all users
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello everyone,

I need to mark all threads as read for all users. The idea is that new users are confused by the vast amount of unread threads and it is easier for them if the threads are marked as read already.

I understand this can only by done using SQL. There is a table called mybb_threadsread with columns tid, uid and dateline. I need to somehow select all the tid entries from mybb_threads and all the uid entries from mybb_users, and join them in the mybb_threadsread table. (I can change the dateline entries after that using update, that is easy.)

Do you have any idea which SQL query to use in order to populate mybb_threadsread with the tid's from mybb_threads and uid's from mybb_users? Thank you very much.

bhy
You'd be better off using the mybb_forumsread table.
$forumcache = $cache->read("forums");
$query = $db->simple_select("users", "uid");
while($users = $db->fetch_array($query))
{
$update_data = array(
"uid" => $users['uid'],
"dateline" => TIME_NOW
);
foreach($forumcache as $fid)
{
$update_data['fid'] = $fid;
$db->insert_query("forumsread", $update_data);
}
}