This is an update of older post
www.joomlapolis.com/forum/149-usage/220089-custom-fields-in-cb-registration-admin-email
.
This one is for CB 2.0.xx:
REQUIREMENT:
I needed to show/add a custom field in the CB registration form, and have it included in the automated email sent to the moderator.
SOLUTION:
First; Jot down the Field Name of your custom field as it appears after you type it in. Community builder should add a cb_ prefix to the name. This will be the name as it appears in the database, and you will need it for the following steps. E.g. "Yourfield" will become "cb_yourfield".
You then need to backup and modify the original version of
components/com_comprofiler/plugin/language/default_language/language.php.
(If you use a diffenerent language, you need to work on the language pack. E.g. if you run Danish, you need to modify components/com_comprofiler/plugin/language/da-dk/language.php.)
Around line 134, find the code for UE_REG_ADMIN_PA_MSG.
It is a quite long line looking like:
Code:
'UE_REG_ADMIN_PA_MSG' => "A new user has signed up at [SITEURL] and requires approval.\nThis email contains their details\n\nName - [NAME]\nE-mail - [EMAILADDRESS]\nUsername - [USERNAME]\n\n\nPlease do not respond to this message as it is automatically generated and is for informational purposes only.\n",
It makes sense to break this line in more lines using dots, and then adding your own field(s) in a line below the line with "USERNAME".
Like:
Code:
'UE_REG_ADMIN_PA_MSG' => 'A new user has signed up at [SITEURL] and requires approval.\n'
.'This email contains their details\n\n'
.'Name - [NAME]\n'
.'E-mail - [EMAILADDRESS]\n'
.'Username - [USERNAME]\n\n'
.'CustomFieldName - [cb_yourfield]\n\n\n'
.'Please do not respond to this message as it is automatically generated and is for informational purposes only.\n',
Keep in mind that the trailing n’s represent space lines, so adjust those accordingly if you want a neat email.
A similar change can be applied to 'UE_REG_ADMIN_MSG' around line 136.
UE_REG_ADMIN_PA_MSG applies to a system where Admin approval is required, whereas UE_REG_ADMIN_MSG is where no approval is required, so probably you only need to modify one of them; the one that applies to your setup.