[ticket/8610] Update Bookmarks when forking topics

Update bookmarks to the new topic when forking topics using
the mcp_fork_topic function.

PHPBB3-8610
This commit is contained in:
Nathaniel Guse 2012-09-03 15:18:30 -05:00 committed by Nathan Guse
parent abcc59fca6
commit 8dd2a151cc

View file

@ -1251,6 +1251,26 @@ function mcp_fork_topic($topic_ids)
{
$db->sql_multi_insert(TOPICS_WATCH_TABLE, $sql_ary);
}
$sql = 'SELECT user_id
FROM ' . BOOKMARKS_TABLE . '
WHERE topic_id = ' . $topic_id;
$result = $db->sql_query($sql);
$sql_ary = array();
while ($row = $db->sql_fetchrow($result))
{
$sql_ary[] = array(
'topic_id' => (int) $new_topic_id,
'user_id' => (int) $row['user_id'],
);
}
$db->sql_freeresult($result);
if (sizeof($sql_ary))
{
$db->sql_multi_insert(BOOKMARKS_TABLE, $sql_ary);
}
}
// Sync new topics, parent forums and board stats