Skip to Content Skip to Menu

Custom Fields in CB Registration Admin Email

  • Yxos
  • Yxos
  • OFFLINE
  • Posts: 29
  • Thanks: 3
  • Karma: 0
9 years 1 month ago - 9 years 1 month 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:
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.

Yxos
Last edit: 9 years 1 month ago by Yxos.
The following user(s) said Thank You: nant

Please Log in or Create an account to join the conversation.

  • spletcher
  • spletcher
  • OFFLINE
  • Posts: 54
  • Thanks: 0
  • Karma: 0
9 years 4 weeks 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 or Create an account to join the conversation.

  • nant
  • nant
  • OFFLINE
  • Posts: 12339
  • Thanks: 1467
  • Karma: 877
9 years 4 weeks 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 or Create an account to join the conversation.

  • spletcher
  • spletcher
  • OFFLINE
  • Posts: 54
  • Thanks: 0
  • Karma: 0
9 years 3 weeks 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 or Create an account to join the conversation.

  • minionion
  • minionion
  • OFFLINE
  • Posts: 10
  • Thanks: 0
  • Karma: 0
8 years 9 months 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 or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum