Hi,
my goal is to dynamically replace some html code in all E-Mails based on the selected language of the user (receiver of that E-Mail).
I therefore created a simple addon, inspired by the code in this discussion (https://xenforo.com/community/threads/parsing-smilies-in-emails.166295/) which works great as is it is. But I don't want it to change every E-Mail but only E-Mails send to users with a specific Language ID (in my case language_id = 4)
I tried to extend the if statement:
but it doesn't work.
Any ideas / suggestions / hints?
Thanks!
my goal is to dynamically replace some html code in all E-Mails based on the selected language of the user (receiver of that E-Mail).
I therefore created a simple addon, inspired by the code in this discussion (https://xenforo.com/community/threads/parsing-smilies-in-emails.166295/) which works great as is it is. But I don't want it to change every E-Mail but only E-Mails send to users with a specific Language ID (in my case language_id = 4)
I tried to extend the if statement:
PHP:
<?php
namespace emailreplace;
use XF\Mvc\Entity\Entity;
use XF\Entity\User;
class Listener
{
public static function templatePostRender(\XF\Template\Templater $templater, $type, $template, &$output)
{
if ($type !== 'email') {
return;
}
$visitor = \XF::visitor();
if ($type == 'email' AND $visitor->language_id == '4') {
$output = strtr($output, 'replace_this', 'with_that');
}
}
}
but it doesn't work.
Any ideas / suggestions / hints?
Thanks!