Skip to content

Commit

Permalink
Merge pull request phpbb#4153 from gn36/ticket/14443
Browse files Browse the repository at this point in the history
[ticket/14443] Introduce additional parameter to messenger
  • Loading branch information
marc1706 committed Feb 28, 2016
2 parents 747a709 + 5d57963 commit a4040e5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
12 changes: 7 additions & 5 deletions phpBB/includes/functions_messenger.php
Original file line number Diff line number Diff line change
Expand Up @@ -210,10 +210,12 @@ function set_mail_priority($priority = MAIL_NORMAL_PRIORITY)
/**
* Set email template to use
*/
function template($template_file, $template_lang = '', $template_path = '')
function template($template_file, $template_lang = '', $template_path = '', $template_dir_prefix = '')
{
global $config, $phpbb_root_path, $phpEx, $user, $phpbb_extension_manager;

$template_dir_prefix = (!$template_dir_prefix || $template_dir_prefix[0] === '/') ? $template_dir_prefix : '/' . $template_dir_prefix;

$this->setup_template();

if (!trim($template_file))
Expand All @@ -232,7 +234,7 @@ function template($template_file, $template_lang = '', $template_path = '')
if ($template_path)
{
$template_paths = array(
$template_path,
$template_path . $template_dir_prefix,
);
}
else
Expand All @@ -241,7 +243,7 @@ function template($template_file, $template_lang = '', $template_path = '')
$template_path .= $template_lang . '/email';

$template_paths = array(
$template_path,
$template_path . $template_dir_prefix,
);

// we can only specify default language fallback when the path is not a custom one for which we
Expand All @@ -251,14 +253,14 @@ function template($template_file, $template_lang = '', $template_path = '')
$fallback_template_path = (!empty($user->lang_path)) ? $user->lang_path : $phpbb_root_path . 'language/';
$fallback_template_path .= basename($config['default_lang']) . '/email';

$template_paths[] = $fallback_template_path;
$template_paths[] = $fallback_template_path . $template_dir_prefix;
}
}

$this->set_template_paths(array(
array(
'name' => $template_lang . '_email',
'ext_path' => 'language/' . $template_lang . '/email'
'ext_path' => 'language/' . $template_lang . '/email' . $template_dir_prefix,
),
), $template_paths);

Expand Down
2 changes: 1 addition & 1 deletion phpBB/phpbb/notification/method/messenger_base.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ protected function notify_using_messenger($notify_method, $template_dir_prefix =
continue;
}

$messenger->template($template_dir_prefix . $notification->get_email_template(), $user['user_lang']);
$messenger->template($notification->get_email_template(), $user['user_lang'], '', $template_dir_prefix);

$messenger->set_addresses($user);

Expand Down

0 comments on commit a4040e5

Please sign in to comment.