As per the title, when an admin creates a new account with a certain email address, the new user correctly receives the email that should contain the credentials, but the values are not binded, i.e. one reads "Username: %s ; Password: %s ". What could the problem be and how can we fix it in J4?
1 Answer
You probably have an override of the language string in question (PLG_USER_JOOMLA_NEW_USER_EMAIL_BODY
). You need to either remove it or update it to use the new format with custom variables. Or you can use the mail template editor to customize the email body.
This is because when mail templates were introduced some of existing strings were reused with changed variable format. In J3 the format was compatible with sprintf()
:
PLG_USER_JOOMLA_NEW_USER_EMAIL_BODY="Hello %s,\n\n\nYou have been added as a User to %s by an Administrator.\n\nThis email has your username and password to log in to %s\n\nUsername: %s\nPassword: %s\n\n\nPlease do not respond to this message as it is automatically generated and is for information purposes only."
In J4 a custom format is used with variables being replaced by Joomla:
PLG_USER_JOOMLA_NEW_USER_EMAIL_BODY="Hello {NAME},\n\n\nYou have been added as a User to {SITENAME} by an Administrator.\n\nThis email has your username and password to log in to {URL}\n\nUsername: {USERNAME}\nPassword: {PASSWORD}\n\n\nPlease do not respond to this message as it is automatically generated and is for information purposes only."