diff options
author | Marc Alexander <admin@m-a-styles.de> | 2016-11-12 13:53:24 +0100 |
---|---|---|
committer | Marc Alexander <admin@m-a-styles.de> | 2016-11-12 13:53:24 +0100 |
commit | 577d669ba73c0ff10bfe663079bbd13416092917 (patch) | |
tree | 584df8717ab48a9a0984f7daf8d22dbf4f76a48a /phpBB/includes | |
parent | a298ed1a66c11c6f67d6f55877e0b0dd5747d85d (diff) | |
parent | 59b52d6312cd10631532f6d1dcdabef141081fdc (diff) | |
download | forums-577d669ba73c0ff10bfe663079bbd13416092917.tar forums-577d669ba73c0ff10bfe663079bbd13416092917.tar.gz forums-577d669ba73c0ff10bfe663079bbd13416092917.tar.bz2 forums-577d669ba73c0ff10bfe663079bbd13416092917.tar.xz forums-577d669ba73c0ff10bfe663079bbd13416092917.zip |
Merge pull request #4472 from dsinn/ticket/14804
[ticket/14804] Add core event to MCP after merging topics
Diffstat (limited to 'phpBB/includes')
-rw-r--r-- | phpBB/includes/mcp/mcp_forum.php | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/phpBB/includes/mcp/mcp_forum.php b/phpBB/includes/mcp/mcp_forum.php index 5e4dce2de7..e4c0640ec7 100644 --- a/phpBB/includes/mcp/mcp_forum.php +++ b/phpBB/includes/mcp/mcp_forum.php @@ -396,7 +396,7 @@ function mcp_resync_topics($topic_ids) */ function merge_topics($forum_id, $topic_ids, $to_topic_id) { - global $db, $template, $user, $phpEx, $phpbb_root_path, $auth; + global $db, $template, $user, $phpEx, $phpbb_root_path, $auth, $phpbb_dispatcher; if (!sizeof($topic_ids)) { @@ -411,9 +411,9 @@ function merge_topics($forum_id, $topic_ids, $to_topic_id) $sync_topics = array_merge($topic_ids, array($to_topic_id)); - $topic_data = phpbb_get_topic_data($sync_topics, 'm_merge'); + $all_topic_data = phpbb_get_topic_data($sync_topics, 'm_merge'); - if (!sizeof($topic_data) || empty($topic_data[$to_topic_id])) + if (!sizeof($all_topic_data) || empty($all_topic_data[$to_topic_id])) { $template->assign_var('MESSAGE', $user->lang['NO_FINAL_TOPIC_SELECTED']); return; @@ -421,13 +421,13 @@ function merge_topics($forum_id, $topic_ids, $to_topic_id) $sync_forums = array(); $topic_views = 0; - foreach ($topic_data as $data) + foreach ($all_topic_data as $data) { $sync_forums[$data['forum_id']] = $data['forum_id']; $topic_views = max($topic_views, $data['topic_views']); } - $topic_data = $topic_data[$to_topic_id]; + $to_topic_data = $all_topic_data[$to_topic_id]; $post_id_list = request_var('post_id_list', array(0)); $start = request_var('start', 0); @@ -475,10 +475,10 @@ function merge_topics($forum_id, $topic_ids, $to_topic_id) if (confirm_box(true)) { - $to_forum_id = $topic_data['forum_id']; + $to_forum_id = $to_topic_data['forum_id']; move_posts($post_id_list, $to_topic_id, false); - add_log('mod', $to_forum_id, $to_topic_id, 'LOG_MERGE', $topic_data['topic_title']); + add_log('mod', $to_forum_id, $to_topic_id, 'LOG_MERGE', $to_topic_data['topic_title']); // Update topic views count $sql = 'UPDATE ' . TOPICS_TABLE . ' @@ -511,6 +511,20 @@ function merge_topics($forum_id, $topic_ids, $to_topic_id) $redirect = request_var('redirect', "{$phpbb_root_path}viewtopic.$phpEx?f=$to_forum_id&t=$to_topic_id"); $redirect = reapply_sid($redirect); + /** + * Perform additional actions after merging topics. + * + * @event core.mcp_forum_merge_topics_after + * @var array all_topic_data The data from all topics involved in the merge + * @var int to_topic_id The ID of the topic into which the rest are merged + * @since 3.1.11-RC1 + */ + $vars = array( + 'all_topic_data', + 'to_topic_id', + ); + extract($phpbb_dispatcher->trigger_event('core.mcp_forum_merge_topics_after', compact($vars))); + meta_refresh(3, $redirect); trigger_error($user->lang[$success_msg] . '<br /><br />' . $return_link); } |