mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-27 21:58:52 +00:00
Merge branch 'develop-ascraeus' into develop
* develop-ascraeus: [ticket/12584] Redirect only on non-empty $message [ticket/12584] Add event core.mcp_warn_user_before/after
This commit is contained in:
commit
d29ca3d4f3
1 changed files with 52 additions and 7 deletions
|
@ -318,7 +318,7 @@ class mcp_warn
|
||||||
function mcp_warn_user_view($action)
|
function mcp_warn_user_view($action)
|
||||||
{
|
{
|
||||||
global $phpEx, $phpbb_root_path, $config, $module;
|
global $phpEx, $phpbb_root_path, $config, $module;
|
||||||
global $template, $db, $user, $auth;
|
global $template, $db, $user, $auth, $phpbb_dispatcher;
|
||||||
|
|
||||||
$user_id = request_var('u', 0);
|
$user_id = request_var('u', 0);
|
||||||
$username = request_var('username', '', true);
|
$username = request_var('username', '', true);
|
||||||
|
@ -376,16 +376,61 @@ class mcp_warn
|
||||||
{
|
{
|
||||||
if (check_form_key('mcp_warn'))
|
if (check_form_key('mcp_warn'))
|
||||||
{
|
{
|
||||||
add_warning($user_row, $warning, $notify);
|
$s_mcp_warn_user = true;
|
||||||
$msg = $user->lang['USER_WARNING_ADDED'];
|
|
||||||
|
/**
|
||||||
|
* Event for before warning a user from MCP.
|
||||||
|
*
|
||||||
|
* @event core.mcp_warn_user_before
|
||||||
|
* @var array user_row The entire user row
|
||||||
|
* @var string warning The warning message
|
||||||
|
* @var bool notify If true, we notify the user for the warning
|
||||||
|
* @var bool s_mcp_warn_user If true, we add the warning else we omit it
|
||||||
|
* @since 3.1.0-b4
|
||||||
|
*/
|
||||||
|
$vars = array(
|
||||||
|
'user_row',
|
||||||
|
'warning',
|
||||||
|
'notify',
|
||||||
|
's_mcp_warn_user',
|
||||||
|
);
|
||||||
|
extract($phpbb_dispatcher->trigger_event('core.mcp_warn_user_before', compact($vars)));
|
||||||
|
|
||||||
|
if ($s_mcp_warn_user)
|
||||||
|
{
|
||||||
|
add_warning($user_row, $warning, $notify);
|
||||||
|
$message = $user->lang['USER_WARNING_ADDED'];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Event for after warning a user from MCP.
|
||||||
|
*
|
||||||
|
* @event core.mcp_warn_user_after
|
||||||
|
* @var array user_row The entire user row
|
||||||
|
* @var string warning The warning message
|
||||||
|
* @var bool notify If true, the user was notified for the warning
|
||||||
|
* @var string message Message displayed to the moderator
|
||||||
|
* @since 3.1.0-b4
|
||||||
|
*/
|
||||||
|
$vars = array(
|
||||||
|
'user_row',
|
||||||
|
'warning',
|
||||||
|
'notify',
|
||||||
|
'message',
|
||||||
|
);
|
||||||
|
extract($phpbb_dispatcher->trigger_event('core.mcp_warn_user_after', compact($vars)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$msg = $user->lang['FORM_INVALID'];
|
$message = $user->lang['FORM_INVALID'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($message))
|
||||||
|
{
|
||||||
|
$redirect = append_sid("{$phpbb_root_path}mcp.$phpEx", "i=notes&mode=user_notes&u=$user_id");
|
||||||
|
meta_refresh(2, $redirect);
|
||||||
|
trigger_error($message . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . $redirect . '">', '</a>'));
|
||||||
}
|
}
|
||||||
$redirect = append_sid("{$phpbb_root_path}mcp.$phpEx", "i=notes&mode=user_notes&u=$user_id");
|
|
||||||
meta_refresh(2, $redirect);
|
|
||||||
trigger_error($msg . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . $redirect . '">', '</a>'));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generate the appropriate user information for the user we are looking at
|
// Generate the appropriate user information for the user we are looking at
|
||||||
|
|
Loading…
Add table
Reference in a new issue