Skip to content

Commit

Permalink
Merge pull request phpbb#2045 from rxu/ticket/12213
Browse files Browse the repository at this point in the history
[ticket/12213] Add MCP events for custom quick moderation options
  • Loading branch information
EXreaction committed Feb 19, 2014
2 parents bd8951c + b7dea19 commit c30668b
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
11 changes: 11 additions & 0 deletions phpBB/includes/mcp/mcp_main.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ function main($id, $mode)
{
global $auth, $db, $user, $template, $action;
global $config, $phpbb_root_path, $phpEx, $request;
global $phpbb_dispatcher;

$quickmod = ($mode == 'quickmod') ? true : false;

Expand Down Expand Up @@ -151,6 +152,16 @@ function main($id, $mode)

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)
Expand Down
21 changes: 20 additions & 1 deletion phpBB/mcp.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,26 @@
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;
}
}
Expand Down

0 comments on commit c30668b

Please sign in to comment.