I do this in plugin - marking more than one forum as viewed
if (e_QUERY == 'mark_all_as_read')
{
unset($u_new);
$qry = 'WHERE thread_lastpost > ' . $lvisit;
if ($rows = $sql->retrieve('forum_thread', 'thread_id', $qry, true))
{
foreach($rows as $forumrow)
{
$forum->threadMarkAsRead($forumrow['thread_id']);
}
e107::redirect(e_REQUEST_SELF);
exit;
}
}
Because $currentUser['user_plugin_forum_viewed'] is not refreshed after adding one thread (I don't know how to call this), it's still the same and so only last thread is changed
function threadMarkAsRead($threadId)
{
global $currentUser;
$_tmp = preg_split('#\,+#', $currentUser['user_plugin_forum_viewed']);
if(!is_array($threadId)) { $threadId = array($threadId); }
foreach($threadId as $tid)
{
$_tmp[] = (int)$tid;
}
$tmp = array_unique($_tmp);
$viewed = trim(implode(',', $tmp), ',');
return e107::getDb()->update('user_extended', "user_plugin_forum_viewed = '{$viewed}' WHERE user_extended_id = ".USERID);
}

I do this in plugin - marking more than one forum as viewed
Because $currentUser['user_plugin_forum_viewed'] is not refreshed after adding one thread (I don't know how to call this), it's still the same and so only last thread is changed