0

I need to send the member email to a custom field in a channel entry after member creation. We use Profile:Edit to create a channel entry for a member immediately after creating them in the EE admin. Currently it sets the title to the username. I would also like to pass the email address to the channel entry.

1 Answer 1

2

First things first... I would recommend that you don't do this at all and instead find a way of using the real email field for whatever purposes you need it. Mainly because the pain of having to keep dual fields in sync will become very tedious, especially if members can update their own email address.

However, if you insist on doing this there are two ways - you could use either or both:

  1. Build an extension:

Using the member_member_register_start hook you can take the real submitted email field and copy it to a new variable in the $_POST array named to match your custom field. The Channel Form (Safecracker) module should then take care of the rest for you.

or 2. Copy to a hidden field using JavaScript:

Profile:Edit is based on the Channel Form (Safecracker) module, so all it needs is a field with a name attribute matching your custom field's shortname... so it would be quite trivial to write some JavaScript or jQuery that automatically copies the value of the real email field to the hidden input.

EDIT: Sorry I've just realised you're talking about registrations via the control panel, not via the front end, so option 2 above wouldn't apply. You should be able to do it with option 1, but you'll need to use the member_create_start hook or the profile_register_start hook instead.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.