aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes
diff options
context:
space:
mode:
authorNathaniel Guse <nathaniel.guse@gmail.com>2012-09-03 15:10:08 -0500
committerNathan Guse <nathaniel.guse@gmail.com>2012-12-13 20:19:26 -0600
commitabcc59fca6bd5d899adbec248ba60db6c013e6a2 (patch)
tree9b251c0856805027213c0cfa08ddb509fb737105 /phpBB/includes
parentb5f94a14f1a5c77366f824780f1120a1b5e9184a (diff)
downloadforums-abcc59fca6bd5d899adbec248ba60db6c013e6a2.tar
forums-abcc59fca6bd5d899adbec248ba60db6c013e6a2.tar.gz
forums-abcc59fca6bd5d899adbec248ba60db6c013e6a2.tar.bz2
forums-abcc59fca6bd5d899adbec248ba60db6c013e6a2.tar.xz
forums-abcc59fca6bd5d899adbec248ba60db6c013e6a2.zip
[ticket/8610] Update Bookmarks when merging topics
Update bookmarks to the new topic when merging multiple topics using the merge_topics function. PHPBB3-8610
Diffstat (limited to 'phpBB/includes')
-rw-r--r--phpBB/includes/mcp/mcp_forum.php10
1 files changed, 9 insertions, 1 deletions
diff --git a/phpBB/includes/mcp/mcp_forum.php b/phpBB/includes/mcp/mcp_forum.php
index b70601b479..865e464e81 100644
--- a/phpBB/includes/mcp/mcp_forum.php
+++ b/phpBB/includes/mcp/mcp_forum.php
@@ -422,6 +422,14 @@ function merge_topics($forum_id, $topic_ids, $to_topic_id)
$db->sql_query('DELETE FROM ' . TOPICS_WATCH_TABLE . ' WHERE ' . $db->sql_in_set('topic_id', $topic_ids));
+ // If the topic no longer exist, we will update the bookmarks table.
+ // To not let it error out on users who bookmarked both topics, we just return on an error...
+ $db->sql_return_on_error(true);
+ $db->sql_query('UPDATE ' . BOOKMARKS_TABLE . ' SET topic_id = ' . (int) $to_topic_id . ' WHERE ' . $db->sql_in_set('topic_id', $topic_ids));
+ $db->sql_return_on_error(false);
+
+ $db->sql_query('DELETE FROM ' . BOOKMARKS_TABLE . ' WHERE ' . $db->sql_in_set('topic_id', $topic_ids));
+
// Link to the new topic
$return_link .= (($return_link) ? '<br /><br />' : '') . sprintf($user->lang['RETURN_NEW_TOPIC'], '<a href="' . append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $to_forum_id . '&amp;t=' . $to_topic_id) . '">', '</a>');
}
@@ -444,4 +452,4 @@ function merge_topics($forum_id, $topic_ids, $to_topic_id)
}
}
-?> \ No newline at end of file
+?>