$noticeTokens = array(
'{name}' => $user['username'] !== '' ? $user['username'] : new XenForo_Phrase('guest'),
'{user_id}' => $user['user_id'],
);
XenForo_CodeEvent::fire('notices_prepare', array(&$noticeList, &$noticeTokens, $template, $containerData));
foreach ($noticeList AS $noticeId => $notice)
{
$notices[$noticeId] = array(
...
'message' => str_replace(array_keys($noticeTokens), $noticeTokens, $notice['message']),
...
);
}