From e98a5afd07fdd18c8ed877655089e842a1db5f8a Mon Sep 17 00:00:00 2001 From: javiexin Date: Mon, 27 Apr 2015 13:21:23 +0200 Subject: [PATCH 1/4] [ticket/13786] Add events to add MCP post options Three new events are included: 1) Core event to perform new moderator action in includes/mcp/mcp_post.php 2) Core event to add/modify template data in includes/mcp/mcp_post.php 3) Template event to present new options in template/mcp_post.html PHPBB3-13786 --- phpBB/docs/events.md | 8 ++++ phpBB/includes/mcp/mcp_post.php | 45 ++++++++++++++++++- phpBB/styles/prosilver/template/mcp_post.html | 6 ++- .../styles/subsilver2/template/mcp_post.html | 7 ++- 4 files changed, 62 insertions(+), 4 deletions(-) diff --git a/phpBB/docs/events.md b/phpBB/docs/events.md index 8086bc9f43..2956a6ad44 100644 --- a/phpBB/docs/events.md +++ b/phpBB/docs/events.md @@ -496,6 +496,14 @@ mcp_front_latest_unapproved_before * Since: 3.1.3-RC1 * Purpose: Add content before latest unapproved posts list +mcp_post_additional_options +=== +* Locations: + + styles/prosilver/template/mcp_post.html + + styles/subsilver2/template/mcp_post.html +* Since: 3.1.5-RC1 +* Purpose: Add content within the list of post moderation actions + memberlist_body_username_append === * Locations: diff --git a/phpBB/includes/mcp/mcp_post.php b/phpBB/includes/mcp/mcp_post.php index 1687409198..6c9f04cbf7 100644 --- a/phpBB/includes/mcp/mcp_post.php +++ b/phpBB/includes/mcp/mcp_post.php @@ -26,6 +26,7 @@ function mcp_post_details($id, $mode, $action) { global $phpEx, $phpbb_root_path, $config; global $template, $db, $user, $auth, $cache; + global $phpbb_dispatcher; $user->add_lang('posting'); @@ -106,6 +107,21 @@ function mcp_post_details($id, $mode, $action) } break; + + default: + + /** + * This event allows you to handle custom post moderation options + * + * @event core.mcp_post_additional_options + * @var string action Post moderation action name + * @var array post_info Information on the affected post + * @since 3.1.5-RC1 + */ + $vars = array('action', 'post_info'); + extract($phpbb_dispatcher->trigger_event('core.mcp_post_additional_options', compact($vars))); + + break; } // Set some vars @@ -197,7 +213,7 @@ function mcp_post_details($id, $mode, $action) $l_deleted_by = ''; } - $template->assign_vars(array( + $mcp_post_template_data = array( 'U_MCP_ACTION' => "$url&i=main&quickmod=1&mode=post_details", // Use this for mode paramaters 'U_POST_ACTION' => "$url&i=$id&mode=post_details", // Use this for action parameters 'U_APPROVE_ACTION' => append_sid("{$phpbb_root_path}mcp.$phpEx", "i=queue&p=$post_id&f={$post_info['forum_id']}"), @@ -249,7 +265,32 @@ function mcp_post_details($id, $mode, $action) 'U_LOOKUP_IP' => ($auth->acl_get('m_info', $post_info['forum_id'])) ? "$url&i=$id&mode=$mode&lookup={$post_info['poster_ip']}#ip" : '', 'U_WHOIS' => ($auth->acl_get('m_info', $post_info['forum_id'])) ? append_sid("{$phpbb_root_path}mcp.$phpEx", "i=$id&mode=$mode&action=whois&p=$post_id&ip={$post_info['poster_ip']}") : '', - )); + ); + + $s_additional_opts = false; + + /** + * Event to add/modify MCP post template data + * + * @event core.mcp_post_template_data + * @var array post_info Array with the post information + * @var array mcp_post_template_data Array with the MCP post template data + * @var array attachments Array with the post attachments, if any + * @var bool s_additional_opts Must be set to true in extension if additional options are presented in MCP post panel + * @since 3.1.5-RC1 + */ + $vars = array( + 'poll_info', + 'mcp_post_template_data', + 'attachments', + 's_additional_opts', + ); + extract($phpbb_dispatcher->trigger_event('core.viewtopic_modify_poll_template_data', compact($vars))); + + $template->assign_vars($mcp_post_template_data); + $template->assign_var('S_MCP_POST_ADDITIONAL_OPTS', $s_additional_opts); + + unset($mcp_post_template_data); // Get User Notes $log_data = array(); diff --git a/phpBB/styles/prosilver/template/mcp_post.html b/phpBB/styles/prosilver/template/mcp_post.html index 10ec6f3ea9..fc62abc7b9 100644 --- a/phpBB/styles/prosilver/template/mcp_post.html +++ b/phpBB/styles/prosilver/template/mcp_post.html @@ -144,7 +144,7 @@ - +
@@ -168,6 +168,10 @@ + + + +
diff --git a/phpBB/styles/subsilver2/template/mcp_post.html b/phpBB/styles/subsilver2/template/mcp_post.html index f5052ee2d0..0a9f803b4d 100644 --- a/phpBB/styles/subsilver2/template/mcp_post.html +++ b/phpBB/styles/subsilver2/template/mcp_post.html @@ -143,7 +143,7 @@ - +
@@ -156,6 +156,11 @@ + + + + + From 18e8f281be21e241c50d7ed55a16475d222e144a Mon Sep 17 00:00:00 2001 From: javiexin Date: Mon, 27 Apr 2015 15:35:09 +0200 Subject: [PATCH 2/4] [ticket/13786] Add events to add MCP post options Three new events are included: 1) Core event to perform new moderator action in includes/mcp/mcp_post.php 2) Core event to add/modify template data in includes/mcp/mcp_post.php 3) Template event to present new options in template/mcp_post.html Fix typo. PHPBB3-13786 --- phpBB/includes/mcp/mcp_post.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/mcp/mcp_post.php b/phpBB/includes/mcp/mcp_post.php index 6c9f04cbf7..03bf7cb1d7 100644 --- a/phpBB/includes/mcp/mcp_post.php +++ b/phpBB/includes/mcp/mcp_post.php @@ -280,7 +280,7 @@ function mcp_post_details($id, $mode, $action) * @since 3.1.5-RC1 */ $vars = array( - 'poll_info', + 'post_info', 'mcp_post_template_data', 'attachments', 's_additional_opts', From f80dc9dc16ec0addf286dfdfe853dc696d7d8ece Mon Sep 17 00:00:00 2001 From: javiexin Date: Mon, 27 Apr 2015 17:36:43 +0200 Subject: [PATCH 3/4] [ticket/13786] Add events to add MCP post options Three new events are included: 1) Core event to perform new moderator action in includes/mcp/mcp_post.php 2) Core event to add/modify template data in includes/mcp/mcp_post.php 3) Template event to present new options in template/mcp_post.html Fix another typo. PHPBB3-13786 --- phpBB/includes/mcp/mcp_post.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/mcp/mcp_post.php b/phpBB/includes/mcp/mcp_post.php index 03bf7cb1d7..47ff065fe4 100644 --- a/phpBB/includes/mcp/mcp_post.php +++ b/phpBB/includes/mcp/mcp_post.php @@ -285,7 +285,7 @@ function mcp_post_details($id, $mode, $action) 'attachments', 's_additional_opts', ); - extract($phpbb_dispatcher->trigger_event('core.viewtopic_modify_poll_template_data', compact($vars))); + extract($phpbb_dispatcher->trigger_event('core.mcp_post_template_data', compact($vars))); $template->assign_vars($mcp_post_template_data); $template->assign_var('S_MCP_POST_ADDITIONAL_OPTS', $s_additional_opts); From 9951458ebfb3bdf9845859fe409436afad7e4498 Mon Sep 17 00:00:00 2001 From: javiexin Date: Thu, 28 May 2015 14:28:41 +0200 Subject: [PATCH 4/4] [ticket/13786] Add events to add MCP post options Three new events are included: 1) Core event to perform new moderator action in includes/mcp/mcp_post.php 2) Core event to add/modify template data in includes/mcp/mcp_post.php 3) Template event to present new options in template/mcp_post.html Remove extra template variable around the new event. PHPBB3-13786 --- phpBB/styles/prosilver/template/mcp_post.html | 2 -- phpBB/styles/subsilver2/template/mcp_post.html | 2 -- 2 files changed, 4 deletions(-) diff --git a/phpBB/styles/prosilver/template/mcp_post.html b/phpBB/styles/prosilver/template/mcp_post.html index fc62abc7b9..81d1be795e 100644 --- a/phpBB/styles/prosilver/template/mcp_post.html +++ b/phpBB/styles/prosilver/template/mcp_post.html @@ -168,9 +168,7 @@ - -
diff --git a/phpBB/styles/subsilver2/template/mcp_post.html b/phpBB/styles/subsilver2/template/mcp_post.html index 0a9f803b4d..1a29df94b0 100644 --- a/phpBB/styles/subsilver2/template/mcp_post.html +++ b/phpBB/styles/subsilver2/template/mcp_post.html @@ -157,9 +157,7 @@
- -

[ {L_FIND_USERNAME} ]
{S_FORM_TOKEN}
{L_MOD_OPTIONS}