Custom Fields in CB Registration & Admin Email

15 years 7 months ago #70283 by jenny66601
I searched the web for a way to do this with no success, and I ended up modifying the code myself.

These instructions show you how to add your custom field in the CB registration form, and have it included in the automated email sent to the administrator.

1. In Administrator, Go to Components>CB>Field Management.
2. Add your information according to your desired field.

Important! Jot down the field Name 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.

Make sure you select YES for the “show at registration?” option. If you’re only using this custom field for your own reference, you’ll want to make sure you select NO for the “show on profile” option.
3. Save changes.
4. Navigate to your CB registration via the frontend and make sure the field appears properly.
5. Now, you will modify the following files. Please backup original versions.
components/com_comprofiler/plugin/language/default_language/default_language.php
and
components/com_comprofiler/plugin/user/plug_cbcore/cb.core.php

6. In default_language.php around line 329, find the following code.

[code:1]DEFINE ('_UE_REG_ADMIN_PA_MSG','A new user has registered at [SITEURL] and requires approval.\n'

.'This email contains their details\n\n'

.'Name - [NAME]\n'

.'e-mail - [EMAILADDRESS]\n'

.'Username - [USERNAME]\n\n\n'[/code:1]

and right below it, add your custom language following the same format. The first part is the label you will see in the administrator email, and the part in the brackets [ ] is where you plug in the database name from step 2. Also, keep in mind that the trailing n’s represent spaces, so adjust those accordingly if you want a neat email. The final code should look like this:

[code:1]DEFINE ('_UE_REG_ADMIN_PA_MSG','A new user has registered at [SITEURL] and requires approval.\n'

.'This email contains their details\n\n'

.'Name - [NAME]\n'

.'e-mail - [EMAILADDRESS]\n'

.'Username - [USERNAME]\n'

.'CustomFieldName - [cb_field from step2]\n\n\n'[/code:1]

Note: You should also add the above custom code around line 355 as well.

Save all changes and upload to your server.
Do a test registration, and your new field should appear in the email to you (the administrator). Pretty cool!
The following user(s) said Thank You: shakensoul

Please Log in to join the conversation.

15 years 5 months ago #76881 by Xerosigma
[color=]In your tut, you tell us to edit 2 files but by the end I realized you only has us edit one. Did you miss something? [/color]

Please Log in to join the conversation.

15 years 5 months ago #76883 by jenny66601
Replied by jenny66601 on topic Re:Custom Fields in CB Registration & Admin Email
Sorry about that. After looking at my files, I don't see anything I edited in the cb.core file. I must have accidentally mentioned that file, and it should only be the one language file you edit. Please let me know if this works for you. If so, I'll see if I can edit the original post so there's no confusion.

Thanks for catching that.

Jennifer

Please Log in to join the conversation.

15 years 5 months ago #76885 by Xerosigma
Haha, no problem. It's works wonderfully. I was wondering I'm very new to this CB stuff I actually just purchased mine today. I'm trying to set up a decent looking page for something. Think you can lead me in the right direction?

Please Log in to join the conversation.

15 years 2 months ago #85882 by inthomes
if i want to include lists from a multi check box, what would I need to do there? As it is a loop Im not sure what to do.

Thanks for the first major step to getting extra fields emailed.

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.217 seconds

Facebook Twitter LinkedIn