Support

Home Forums WP User Integration WP user integration to auto-fill custom fields ONLY on a NEW registration

WP user integration to auto-fill custom fields ONLY on a NEW registration

Posted: March 4, 2020 at 11:14 am


echobrin

March 4, 2020 at 11:14 am

I implemented the code snippets on this page https://eventespresso.com/topic/auto-fill-in-form-all-fields-with-user-integration/ to auto-fill all fields including custom question fields. It works, and I understand that it will use the most recently entered info to pre-populate the fields.

The problem I’m running into is in the case when a user clicks to edit registration details for a previous event. It pre-fills the info from the most recent event and a user would be led to believe that their answers were changed for their previous registrations.

Hence, I was wondering if there is a way to only pre-populate those custom fields on a NEW event registration to avoid confusion for users who may think their previous registration answers were changed. Otherwise I will disable the snippet to pre-populate the fields because I don’t want to confuse users. We run a dog training center and often have the same person sign up for various classes with different dogs, so this could cause issues for them. Thanks for any ideas!


Josh

  • Support Staff

March 4, 2020 at 2:49 pm

Hi,

I made an update to the snippet which adds a check to see if it’s a revisit to edit information. So that should work for you now.

https://github.com/eventespresso/ee-code-snippet-library/blob/master/addons/eea-wp-user/mn_wp_user_addon_save_custom_answers_too.php


echobrin

March 5, 2020 at 7:22 am

Perfect, thank you!


Jarred

March 9, 2020 at 2:37 pm

Hey Josh, to achieve the goal of only autofilling all the info if it’s not a revisit, can I just place your code and it work properly? Or do I need to place all the codes from the 2016 post in addition to your code on March 4th 2020? And do I need to make it a plugin or can I just place it on custom php file? thanks


Josh

  • Support Staff

March 9, 2020 at 3:25 pm

Hi Jarred,

You copy the code snippet once onto your site, not every iteration of it.

Generally speaking, you’d add the code into a plugin. If you just place it into a custom php file then you’ll need to make a way for WordPress to load the file and execute the code at the correct hook point. To keep things simple we recommend this guide:

https://eventespresso.com/wiki/create-site-specific-plugin-wordpress-site/


Jarred

March 9, 2020 at 8:33 pm

thanks Josh

The support post ‘WP user integration to auto-fill custom fields ONLY on a NEW registration’ 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.

Do NOT follow this link or you will be banned from the site!