mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-12 06:18:52 +00:00
[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
This commit is contained in:
parent
233bdfa5f6
commit
b7dea19bf3
2 changed files with 31 additions and 1 deletions
|
@ -34,6 +34,7 @@ class mcp_main
|
||||||
{
|
{
|
||||||
global $auth, $db, $user, $template, $action;
|
global $auth, $db, $user, $template, $action;
|
||||||
global $config, $phpbb_root_path, $phpEx, $request;
|
global $config, $phpbb_root_path, $phpEx, $request;
|
||||||
|
global $phpbb_dispatcher;
|
||||||
|
|
||||||
$quickmod = ($mode == 'quickmod') ? true : false;
|
$quickmod = ($mode == 'quickmod') ? true : false;
|
||||||
|
|
||||||
|
@ -151,6 +152,16 @@ class mcp_main
|
||||||
|
|
||||||
mcp_restore_topic($topic_ids);
|
mcp_restore_topic($topic_ids);
|
||||||
break;
|
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)
|
switch ($mode)
|
||||||
|
|
|
@ -183,7 +183,26 @@ if ($quickmod)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
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;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue