Posted: October 1, 2021 at 3:17 pm
What I would like to do:
I do not think these snippets quite suffice: https://github.com/eventespresso/ee-code-snippet-library/blob/master/addons/eea-wp-user/mn_wp_user_addon_save_custom_answers_too.php or https://github.com/eventespresso/ee-code-snippet-library/blob/master/addons/eea-wp-user/jf_filter_address_answer_for_wpuser.php or https://github.com/eventespresso/ee-code-snippet-library/blob/master/addons/eea-wp-user/jf_ee_process_multi_wpuser_for_attendees.php
I’ve looked thru: https://eventespresso.com/topic/wp-user-integration-to-auto-fill-custom-fields-only-on-a-new-registration/ and https://eventespresso.com/topic/sync-event-registration-form-with-custom-user-fields/ and https://eventespresso.com/topic/linking-exiting-user-fields-with-the-user-integration-plugin/ and https://eventespresso.com/topic/auto-fill-in-form-all-fields-with-user-integration/ and https://eventespresso.com/topic/upon-registration-create-user-and-store-all-registration-fields-in-user-meta/ -this last one seemingly the closest to my goals.
But I’m not sure I’ve found what I’m looking for. Also thinking, as ACF and EE4 are both widely used plugins, ‘I can’t be the first person to try this’ :). Any guidance or suggestions would be deeply appreciated. Or if I’m missing something. Thank you.
The bigger picture for this is you’ll now have multiple places where those details are stored which needs to be managed.
Event Espresso stores the address info with the EE_Contact, aka the Attendee. You can see that in Event Espresso -> Registrations -> Click on the icon for a registration.
Now you are editing the EE_Contact for that registration and you can see it stores the address info there. You’ll need to keep that in sync with your custom values and it adds an extra layer that we (Event Espresso) don’t need to include in the mix so don’t support currently, although anyone who wants to do so is more than welcome to 🙂
For example, if you are allowing users to edit those values outside of just the EE registration form there will be times when the WP User ACF values won’t match up to the EE_Contact address values (unless you write a custom function to sync them on update from wherever they are being updated). The method I’m referring to below works around that a little, but it’s still very easy for those values to be out of sync for some time.
This can be done with the
The model system makes getting the data you need fairly straight forward and if you are not familiar with using it I recommend reading these:
A lot of what you need to do in this step is completely outside of Event Espresso.
So you’re making the ACF files the ‘primary values’ for those fields?
You already have most of what you need for this with this snippet:
That snippet is checking the registration form files as they are generated and for the address fields, it populates a value using the
For example on this line:
Rather than using
Now the fact that the above values are pulled from the ACF values means that the attendee will be updated with those values when the user registers onto the event, so if the ACF values were updated outside of an EE registration, they should now sync up with the EE_Attendee.