Custom Fields in CB Registration Admin Email

8 years 6 months ago - 8 years 6 months ago #271116 by Yxos
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:
'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:
'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.

Yxos
The following user(s) said Thank You: nant

Please Log in to join the conversation.

8 years 5 months ago #272594 by spletcher
Replied by spletcher on topic Custom Fields in CB Registration Admin Email
I have been using this method for many years also to get all additional cb fields user information when someone registers.

Can someone confirm that there is not a more intuitive way to do this using the backend or a plugin with all of the recent changes. I really can't believe that this is such a unusual request to know what types of users are registering on your system without logging in to see all of the details.

Thanks ahead of time.

Please Log in to join the conversation.

8 years 5 months ago #272607 by nant

spletcher wrote: I have been using this method for many years also to get all additional cb fields user information when someone registers.

Can someone confirm that there is not a more intuitive way to do this using the backend or a plugin with all of the recent changes. I really can't believe that this is such a unusual request to know what types of users are registering on your system without logging in to see all of the details.

Thanks ahead of time.


This is the method to use.
Future improvements are planned.

Please Log in to join the conversation.

8 years 4 months ago #272714 by spletcher
Replied by spletcher on topic Custom Fields in CB Registration Admin Email
Thanks Nant.

Can you give a bit of a time table and what form the release may be in? Is it planned for the main component or would it be an addon?

Thanks.

Please Log in to join the conversation.

8 years 1 month ago #277412 by minionion
Replied by minionion on topic Custom Fields in CB Registration Admin Email
I am trying to use this method to save a field behind the scenes (I don't want users to see it in the form) and then send it with the email.

I have an auto action that is correctly saving the field (I can make it appear in the profile) but it doesn't send with the email, which makes me think my auto action isn't saving it in the right part of the process. Is there an auto action trigger that lands between submit registration form & send registration email? I tried both "After user registration" and "Start save registration" but neither of these seems to work.

If it needs to be in the form for this to work, I could add a css class of visibility hidden to the field, but I'd rather have the auto action do the work if possible so it doesn't show in the page source. Thanks!

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.737 seconds

Facebook Twitter LinkedIn