Adding {****} to emails

Get help with installation and running phpBB 3.0.x here. Please do not post bug reports, feature requests, or MOD-related questions here.
Get Involved
Forum rules
END OF SUPPORT: 1 January 2017 (announcement)
User avatar
Registered User
Posts: 266
Joined: Sun Jan 06, 2008 10:06 pm
Location: Witney, Oxfordshire, UK

Adding {****} to emails

Post by oxfordsi »


A quick question regarding the generic system emails.

Looking at the plain text emails in the language files, there's reference to numerous tags such as {USERNAME} etc. My question is, is it possible to create my own tag and write the text within the common.php file (or wherever {USERNAME} text is defined?!

So, for example, the language file for the email would read:


blah blah balah blah


In my language files i can define the custom tag as:

'CUSTOM_TAG' => 'Here is your custom tag'

I'm aware that i may have just answered my own question and the 2 could just be put in place but i wasn't sure if there had to be any file edits elsewhere to facilate this?

Any help would be greatful.

User avatar
Registered User
Posts: 5759
Joined: Tue Jun 15, 2010 11:33 am
Location: グリーン ヒル ゾーン

Re: Adding {****} to emails

Post by AmigoJack »


The e-mail templates are already fully localized texts, so it would make no sense to use a tag like {HELLO} for a constant substitution based on the language. The variables in there are not defined in your language files, because they're not language specific at all. {USERNAME} is defined and handed over to the e-mail template in /includes/functions_posting.php (line 1323 on a default 3.0.8 installation), whereas $addr['name'] has been filled earlier.

So the real question is: what do you want to achieve? Give an example as precise as possible.
The worst thing about censorship is ███████████
Affin wrote:
Tue Nov 20, 2018 9:51 am
The problem is probably not my English but you do not want to understand correctly.
We will not come anybody anyway, nevertheless, it's best to shit this.
User avatar
Registered User
Posts: 292
Joined: Sat Sep 15, 2007 10:26 pm

Re: Adding {****} to emails

Post by AGC »

{USERNAME},{WELCOME_MSG} EXT. are template variables, that mean they assign with the assign_vars() function and then process, so you can add a custom tag but you need to assign it in the .php files and set a lang var to it when it process.

Code: Select all

assign_var('CUSTOM_TAG' => $user->lang['CUSTOM_TAG']);
(phpBB 2.0.x): []Admin Topics List[] MOD. << Description & Download. , []Highlight Author[] MOD.

(phpBB 3.0.x)[ver] MODs: [RC1] >Import old *.pak files MOD. + . . .[8] > ACP - Modules Quick Access (MQA) MOD. + . . . [7-PL1] > Multi Smile (actions) MOD
User avatar
Support Team Member
Support Team Member
Posts: 52075
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}

Re: Adding {****} to emails

Post by Brf »

As AmigoJack is explaining, there is already a separate email txt file for each language.
To put a language tag in an email template would be redundant. It is much simpler to put the text directly in the template.
User avatar
Martin Truckenbrodt
Registered User
Posts: 3045
Joined: Sun Mar 23, 2003 6:22 pm
Location: Franconia
Name: Martin Truckenbrodt

Re: Adding {****} to emails

Post by Martin Truckenbrodt »

you can use the variables successfully together with browser language detection.
There's a validated MOD in the MOD database adding this core feature.
BTW: Perhaps in my signature there could be a link called My MODs.

Bye Martin
Free tutorial: Installing MODs in phpBB 3.0
Advanced Block MOD - Prevent spam on your phpBB 3.0 board with Stop Forum Spam, BotScout, Akismet, Project Honey Pot and several IP-RBL and Domain-RBL DNS blacklists!
Use the official phpBB Ideas to vote missing core features!!!

Return to “[3.0.x] Support Forum”