From 46c658bdbf87826b003640da26b613320e91e9ec Mon Sep 17 00:00:00 2001 From: marcosbc Date: Sat, 12 Apr 2014 15:40:56 +0200 Subject: [PATCH] [ticket/12270] Correct confirm approval message for topics When clicking on approving a topic's first post in the MCP to approve the topic itself, the confirm box dialog asks whether to approve the post or not, instead of asking to approve the topic. To achieve this fix, we just need to count the topics to be approved and check if it's greater than zero. PHPBB3-12270 --- phpBB/includes/mcp/mcp_queue.php | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php index fd22a866bb..a3e6e62b07 100644 --- a/phpBB/includes/mcp/mcp_queue.php +++ b/phpBB/includes/mcp/mcp_queue.php @@ -732,20 +732,21 @@ class mcp_queue } else { + $num_topics = 0; $show_notify = false; if ($action == 'approve') { foreach ($post_info as $post_data) { - if ($post_data['poster_id'] == ANONYMOUS) + if (!$post_data['topic_posts_approved']) { - continue; + $num_topics++; } - else + + if (!$show_notify && $post_data['poster_id'] != ANONYMOUS) { $show_notify = true; - break; } } } @@ -755,7 +756,18 @@ class mcp_queue 'S_' . strtoupper($action) => true, )); - confirm_box(false, strtoupper($action) . '_POST' . ((sizeof($post_id_list) == 1) ? '' : 'S'), $s_hidden_fields, 'mcp_approve.html'); + // Create the confirm box message + $action_msg = strtoupper($action); + $num_posts = sizeof($post_id_list) - $num_topics; + if ($num_topics > 0 && $num_posts <= 0) + { + $action_msg .= '_TOPIC' . (($num_topics == 1) ? '' : 'S'); + } + else + { + $action_msg .= '_POST' . ((sizeof($post_id_list) == 1) ? '' : 'S'); + } + confirm_box(false, $action_msg, $s_hidden_fields, 'mcp_approve.html'); } redirect($redirect);