aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB
diff options
context:
space:
mode:
authorrxu <rxu@mail.ru>2014-02-18 19:16:27 +0800
committerrxu <rxu@mail.ru>2014-02-20 00:38:28 +0800
commitb7dea19bf37de2078676e8a8c9a810fd6a48605b (patch)
treee81664ae22c6496ea5b5355326b4c33f306e5fa4 /phpBB
parent233bdfa5f639e44a8315736bc917fb8322bd0e15 (diff)
downloadforums-b7dea19bf37de2078676e8a8c9a810fd6a48605b.tar
forums-b7dea19bf37de2078676e8a8c9a810fd6a48605b.tar.gz
forums-b7dea19bf37de2078676e8a8c9a810fd6a48605b.tar.bz2
forums-b7dea19bf37de2078676e8a8c9a810fd6a48605b.tar.xz
forums-b7dea19bf37de2078676e8a8c9a810fd6a48605b.zip
[ticket/12213] Add MCP events for custom quick moderation options
Add core events to mcp.php and mcp_main.php. This allows extensions to add and to handle custom quick moderation options. PHPBB3-12213
Diffstat (limited to 'phpBB')
-rw-r--r--phpBB/includes/mcp/mcp_main.php11
-rw-r--r--phpBB/mcp.php21
2 files changed, 31 insertions, 1 deletions
diff --git a/phpBB/includes/mcp/mcp_main.php b/phpBB/includes/mcp/mcp_main.php
index d9197da07e..016094c5d4 100644
--- a/phpBB/includes/mcp/mcp_main.php
+++ b/phpBB/includes/mcp/mcp_main.php
@@ -34,6 +34,7 @@ class mcp_main
{
global $auth, $db, $user, $template, $action;
global $config, $phpbb_root_path, $phpEx, $request;
+ global $phpbb_dispatcher;
$quickmod = ($mode == 'quickmod') ? true : false;
@@ -151,6 +152,16 @@ class mcp_main
mcp_restore_topic($topic_ids);
break;
+
+ default:
+ /**
+ * This event allows you to handle custom quickmod options
+ *
+ * @event core.modify_quickmod_actions
+ * @since 3.1.0-a4
+ */
+ $phpbb_dispatcher->dispatch('core.modify_quickmod_actions');
+ break;
}
switch ($mode)
diff --git a/phpBB/mcp.php b/phpBB/mcp.php
index e2915cad78..313b24b6f1 100644
--- a/phpBB/mcp.php
+++ b/phpBB/mcp.php
@@ -183,7 +183,26 @@ if ($quickmod)
break;
default:
- trigger_error($user->lang('QUICKMOD_ACTION_NOT_ALLOWED', $action), E_USER_ERROR);
+ // If needed, the flag can be set to true within event listener
+ // to indicate that the action was handled properly
+ // and to pass by the trigger_error() call below
+ $break = false;
+
+ /**
+ * This event allows you to add custom quickmod options
+ *
+ * @event core.modify_quickmod_options
+ * @var object module Instance of module system class
+ * @var string action Quickmod option
+ * @var bool break Flag indicating if the action was handled properly
+ * @since 3.1.0-a4
+ */
+ extract($phpbb_dispatcher->trigger_event('core.modify_quickmod_options', compact(array('module', 'action', 'break'))));
+
+ if (!$break)
+ {
+ trigger_error($user->lang('QUICKMOD_ACTION_NOT_ALLOWED', $action), E_USER_ERROR);
+ }
break;
}
}