diff options
author | Tristan Darricau <tristan.darricau@sensiolabs.com> | 2016-03-26 18:59:31 +0100 |
---|---|---|
committer | Tristan Darricau <tristan.darricau@sensiolabs.com> | 2016-03-26 18:59:31 +0100 |
commit | 640070e13304c9cd0f5c76e5802e36b70e45395b (patch) | |
tree | a4f10d3551d3f7d994629561636d2e07b09262f8 /phpBB/includes/mcp | |
parent | 9f3ee5859569bd9e66488890d7cb00fe9eceb4cb (diff) | |
parent | 18a4505b235c64ec33934876b8a1c98a0ef66f50 (diff) | |
download | forums-640070e13304c9cd0f5c76e5802e36b70e45395b.tar forums-640070e13304c9cd0f5c76e5802e36b70e45395b.tar.gz forums-640070e13304c9cd0f5c76e5802e36b70e45395b.tar.bz2 forums-640070e13304c9cd0f5c76e5802e36b70e45395b.tar.xz forums-640070e13304c9cd0f5c76e5802e36b70e45395b.zip |
Merge pull request #3874 from lavigor/ticket/14134
[ticket/14134] Send warning notification PM in user's language.
* lavigor/ticket/14134:
[ticket/14134] Fix Okay in a comment.
[ticket/14134] Fix code comments.
[ticket/14134] Send warning notification PM in user's language.
Diffstat (limited to 'phpBB/includes/mcp')
-rw-r--r-- | phpBB/includes/mcp/mcp_warn.php | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/phpBB/includes/mcp/mcp_warn.php b/phpBB/includes/mcp/mcp_warn.php index d724b8703b..33c898ffc2 100644 --- a/phpBB/includes/mcp/mcp_warn.php +++ b/phpBB/includes/mcp/mcp_warn.php @@ -530,12 +530,28 @@ function add_warning($user_row, $warning, $send_pm = true, $post_id = 0) include_once($phpbb_root_path . 'includes/functions_privmsgs.' . $phpEx); include_once($phpbb_root_path . 'includes/message_parser.' . $phpEx); - $user_row['user_lang'] = (file_exists($phpbb_root_path . 'language/' . $user_row['user_lang'] . "/mcp.$phpEx")) ? $user_row['user_lang'] : $config['default_lang']; - include($phpbb_root_path . 'language/' . basename($user_row['user_lang']) . "/mcp.$phpEx"); + // Attempt to translate warning to language of user being warned if user's language differs from issuer's language + if ($user_row['user_lang'] != $user->lang_name) + { + $lang = array(); + + $user_row['user_lang'] = (file_exists($phpbb_root_path . 'language/' . basename($user_row['user_lang']) . "/mcp." . $phpEx)) ? $user_row['user_lang'] : $config['default_lang']; + include($phpbb_root_path . 'language/' . basename($user_row['user_lang']) . "/mcp." . $phpEx); + + $warn_pm_subject = $lang['WARNING_PM_SUBJECT']; + $warn_pm_body = sprintf($lang['WARNING_PM_BODY'], $warning); + + unset($lang); + } + else + { + $warn_pm_subject = $user->lang('WARNING_PM_SUBJECT'); + $warn_pm_body = $user->lang('WARNING_PM_BODY', $warning); + } $message_parser = new parse_message(); - $message_parser->message = $user->lang('WARNING_PM_BODY', $warning); + $message_parser->message = $warn_pm_body; $message_parser->parse(true, true, true, false, false, true, true); $pm_data = array( @@ -553,7 +569,7 @@ function add_warning($user_row, $warning, $send_pm = true, $post_id = 0) 'address_list' => array('u' => array($user_row['user_id'] => 'to')), ); - submit_pm('post', $user->lang('WARNING_PM_SUBJECT'), $pm_data, false); + submit_pm('post', $warn_pm_subject, $pm_data, false); } add_log('admin', 'LOG_USER_WARNING', $user_row['username']); |