Skip to content
Browse files

#599: Copy subscriptions when splitting topics.

Fixes #599.
  • Loading branch information...
1 parent 329069e commit 6b3a0b965da227e3baff440e2447c42831a70be8 @franzliedke franzliedke committed Apr 13, 2012
Showing with 3 additions and 0 deletions.
  1. +3 −0 moderate.php
3 moderate.php
@@ -195,6 +195,9 @@
// Move the posts to the new topic
$db->query('UPDATE '.$db->prefix.'posts SET topic_id='.$new_tid.' WHERE id IN('.$posts.')') or error('Unable to move posts into new topic', __FILE__, __LINE__, $db->error());
+ // Apply every subscription to both topics
+ $db->query('INSERT INTO '.$db->prefix.'topic_subscriptions (user_id, topic_id) SELECT user_id, '.$new_tid.' FROM '.$db->prefix.'topic_subscriptions WHERE topic_id='.$tid) or error('Unable to copy existing subscriptions', __FILE__, __LINE__, $db->error());
// Get last_post, last_post_id, and last_poster from the topic and update it
$result = $db->query('SELECT id, poster, posted FROM '.$db->prefix.'posts WHERE topic_id='.$tid.' ORDER BY id DESC LIMIT 1') or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());
$last_post_data = $db->fetch_assoc($result);

0 comments on commit 6b3a0b9

Please sign in to comment.
Something went wrong with that request. Please try again.