aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/mcp/mcp_topic.php
diff options
context:
space:
mode:
authorNathaniel Guse <nathaniel.guse@gmail.com>2012-09-03 15:30:52 -0500
committerNathan Guse <nathaniel.guse@gmail.com>2012-12-13 20:19:27 -0600
commit05d7decdd35eac3b58807b9ced318421a6ce15da (patch)
treef62ac0c3075dcffe6afefd74000b1f165272bf76 /phpBB/includes/mcp/mcp_topic.php
parent8dd2a151cc53a5482fcf462736cf5c2eabccf599 (diff)
downloadforums-05d7decdd35eac3b58807b9ced318421a6ce15da.tar
forums-05d7decdd35eac3b58807b9ced318421a6ce15da.tar.gz
forums-05d7decdd35eac3b58807b9ced318421a6ce15da.tar.bz2
forums-05d7decdd35eac3b58807b9ced318421a6ce15da.tar.xz
forums-05d7decdd35eac3b58807b9ced318421a6ce15da.zip
[ticket/8610] Update Bookmarks when merging posts into another topic
Update bookmarks to the new topic when merging posts into another topic using the merge_posts function. PHPBB3-8610
Diffstat (limited to 'phpBB/includes/mcp/mcp_topic.php')
-rw-r--r--phpBB/includes/mcp/mcp_topic.php10
1 files changed, 9 insertions, 1 deletions
diff --git a/phpBB/includes/mcp/mcp_topic.php b/phpBB/includes/mcp/mcp_topic.php
index 7d4edaf362..36cfe1e355 100644
--- a/phpBB/includes/mcp/mcp_topic.php
+++ b/phpBB/includes/mcp/mcp_topic.php
@@ -626,6 +626,14 @@ function merge_posts($topic_id, $to_topic_id)
$db->sql_return_on_error(false);
$db->sql_query('DELETE FROM ' . TOPICS_WATCH_TABLE . ' WHERE topic_id = ' . (int) $topic_id);
+
+ // 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 topic_id = ' . (int) $topic_id);
+ $db->sql_return_on_error(false);
+
+ $db->sql_query('DELETE FROM ' . BOOKMARKS_TABLE . ' WHERE topic_id = ' . (int) $topic_id);
}
// Link to the new topic
@@ -650,4 +658,4 @@ function merge_posts($topic_id, $to_topic_id)
}
}
-?> \ No newline at end of file
+?>