Posted: January 26, 2019 at 12:26 pm
Hello EE4 community,
The code you’ve posted will require setting a custom field of “hide_email_fields” for the event. Do you have that custom field set?
In the future, please do not post blocks of code directly into the forum topic or reply. You can post the code to http://wpbin.io/ then link to the bin here.
That code, hides all of the ‘Email’ fields on the registration form other than the first, the copies the value entered into the visible field into all of the others. It will not copy all of the information from the first registrant to all of the others.
What is it you are trying to do? Do you just want the CSV to contain the ‘parent info’ entered for the primary registrant on all of the registrations in the group?
Also another question: Is there any code/function that would loop through and fix the registrations in the database copying the parent info to each child registration?
Ok, so each ticket is a registration in Event Espresso and the questions asked for each specific registration save with a relationship to that specific registration.
So it sounds like you have Event Espresso set up to ask ONLY the ‘Primary Registrant’ the ‘Parent Info’ and then additional registrations just fill in their personal info, correct?
If so that’s fine, but taking note of what I mentioned above, it means the Parent info will only save in relation to the Primary Registrant, not all registrations.
I’ve previously created a snippet for the CSV reports that may help you in that it populates the additional registrant’s info with the with the answers provided by the primary registrant IF the additional registrant didn’t have an answer for that question. Meaning if you only ask the Primary Registrant the parent info questions, those exact answers will also show for the additional registrations, but only in the CSV.
Will that help?
I want to be very clear, that this does not alter the database and save the answers to those questions to each individual registrant, it simply pulling the primary registrants details and using those if the additional registrant does not have an answer.
The reason I’m repeatidly stating the above is I don’t want to give you the snippet, your CSV reports work fine but then in 6 months (when you have a LOT more registrations like this) you realised you actually need the details saved with each registration and your stuck.
(Note that if you do need the answers to save with each individual registrant, you’ll need some custom development and will need the help of a developer familiar with Event Espresso to do it)
Adding a custom field is simple enough and we can help show you how to do that, but (and no offence intended here) it sounds like your using code to solve a problem that you aren’t really sure you have, nor want to fix.
I wrote the above snippet, so here’s an explanation of what it does, when you select more than 1 ticket but require the ‘Personal Info’ question group for additional registrants, those additional tickets require First Name, Last Name and Email Address. In a parent/child setup that’s not always ideal because you don’t want to use your child’s email just include their, right?
So what the above does is hide any ’email’ question in the registration form, except the first one. Then when a value is entered into the first, it copies that value to all of the hidden email fields.
In the example you are using, there is a check for a custom value on the event, that is to allow you (the admin) to enable/disable that feature on specific events rather than it just being applied all the time.
I had a quick look at your events and what will happen with your setup is ‘Parent Email Address’ fields will all be hidden (again except the first) so your registration form will look like this:
Then for additional tickets, it will look like this:
Note the email field is hidden, if I unhide it, it has the value I entered in the first field:
I haven’t manully typed that into that field.
To do that on your events right now you can add a custom field to your events to enable it, or, remove the check from the snippet so it always enabled if preferred. We can give you more info on doing this but is the above what you want to do?
No, you can do it with the CSV fairly easily using the snippet I mentioned, but if you want each registration to save the parent info within it, you’ll need to ask the parent info on each registration.
You could do something similar to my snippet and hide the parent groups except the first, then copy the details as they are entered, OR it might be possible to hook into the registration save and use the primary registrants questions but your going to need custom development for that either way and there’s a lot more to take into consideration with the latter.
I should note, the registrations aren’t “broken” as they are now, they are working as expected.
Just noting here that I made a mistake with my formatting and the forum blew up a section of my reply, I’ve now fixed it and just noting here in case you’ve had an email with a reply that made no sense.
The snippet to pull the primary registrant details for all is here:
You can add that to a custom functions plugin on your site, we have some documentation on creating one here:
The support post ‘When 2 tickets are purchased, parent/purchaser information is not copied to both’ is closed to new replies.
Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.