Support

Home Forums WP User Integration Prepopulate registration form dropdown from user info

Prepopulate registration form dropdown from user info

Posted: July 25, 2021 at 10:04 pm


wkcde

July 25, 2021 at 10:04 pm

I’m using the User Integration Add-on. I’m also using Profile Builder Pro to store the users’ full profile. In the profile, a user can store multiple pets they own. In the event registration form, I want to prepopulate the “pet” dropdown with the pet names from their profile so they can indicate WHICH pet they are registering for this class. I see several forum topics that are very similar but nothing quite the same. Also, will it goof up EE if it’s a dropdown question but User A picks “Fido” and User B picks “Maggie” and those names are not stored with the registration form? I am able to get the profile information through Profile Builder Pro functions if you can point me to the filter function in EE to use. Another approach: Would it be easier to store every pet name in the system in that dropdown and use a filter to limit which ones show for any given user?


Seth Shoultes

  • Support Staff

July 27, 2021 at 12:03 pm

Hi there,

I asked our developers about your question, and they shared this code for you to try:


        add_filter(
            'FHEE__EE_Form_Section_Proper___construct__options_array',
            function (array $options_array, $reg_form) {
                if (
                    ! isset($options_array['name'])
                    || $options_array['name'] !== 'ee-spco-attendee_information-reg-step-form'
                ) {
                    return $options_array;
                }
                // do stuff to options array like modify 'subsections'
                return $options_array;
            }
        );

The code will need to be customized and placed in your theme’s functions.php file or added to a custom plugin.

The support post ‘Prepopulate registration form dropdown from user info’ 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.

Event Espresso