Posted: January 23, 2020 at 2:06 am
Hi, I found this code snippet: https://github.com/eventespresso/ee-code-snippet-library/blob/master/addons/eea-wp-user/jf_filter_address_answer_for_wpuser.php As far as my understanding of reading that code goes, it should populate the user’s system fields from the values that may exist in Event Espresso. Is my understanding correct? If so, is there anything that would go the other way, and populate the questions in Event Espresso if they exist in the user’s system fields? Reason I am asking is that we have a user registration form that asks those questions using WP-Members plugin. I would then like those answers to be pre-populated when the user goes on to complete their event booking. I will give a link and login details in a private reply so you can see what I mean. Kind regards, Anita |
|
This reply has been marked as private. | |
No. That code pulls values from the EE_Contact linked to the current WP user that is logged in and auto-fills the address questions on the registration form. The easiest way to highlight which values they are is with a screenshot: https://monosnap.com/file/Vfnc49XC8GQzeqjhZQgizJX6GzBjbN Event Espresso -> Registrations -> Contact list -> {click on the contact linked to the user} The address questions there are the ones being pulled and autofilled on the registration form using that snippet. All registrations made in EE are connected with a ‘EE_Contact’ object, that is created from the values in the registration form when a registration is made. EE will check its current EE_Contacts for any that match the first name, last name and email address exactly when a registration is made, if it finds one it links the registration to that contact rather than creating another. The WP User integration add-on sets up a relationship with the logged-in WP user account and EE contact create/found during the registration they make. So the code about is simply saying: 1. Pull the EE_Contact linked to the current user. Note that other than the connection between the WP User account and then EE_Contact (which is important) the WP User account details don’t come into it. You could modify that snippet to pull the values directly from the WP User account if preferred, if those are different from the values set on the contact linked at the time they will be updated on submission. |
|
Thanks for the explanation. I have done that. Can that be made to work for custom fields, eg mobile phone? Or is there a similar filter that can be changed to deal with such questions? |
|
I think I’ve found the filter I need: |
|
Yeah, that filter runs for each question input on the registration form so you can use that to autofill using User data. |
|
The support post ‘Populate Primary Registrant details from User system questions’ 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.