Support

Home Forums Event Espresso Premium Hide and change question to optional – registration – checkout

Hide and change question to optional – registration – checkout

Posted: June 1, 2021 at 11:13 am

Viewing 2 reply threads


joost backaert

June 1, 2021 at 11:13 am

I’m using this code to check if a registration is done with a specific email adres and change the status and send a confirmation email. I also would like to hide a (registration) question and make it optional instead of required.

I tried adding css to hide ‘spco-attendee-panel-dv’ after the IF but it did not work.

Any pointers how I go about this?


add_action('AHEE__EE_Registration_Processor__trigger_registration_update_notifications', 'update_registration_based_on_email', 1, 2);
function update_registration_based_on_email(EE_Registration $registration, $update_params = array() )
{
	$attendee_email = $registration->attendee()->email();

    error_log('update_registration_based_on_email function executed');

    if (strpos($attendee_email, '@uzgent.be') || strpos($attendee_email, '@ugent.be')) {
        $registration->set_status('RAP');
        $registration->save();
		add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10);
		
			
        //EEM_Registration::maybe_registration();

        error_log('email is @uzgent or @ugent');
    } else {
        error_log('email is not @uzgent nor @ugent');
    }
}


Tony

  • Support Staff

June 2, 2021 at 4:55 am

Hi there,

The hook you are using would ‘fire’ after the registrations had been processed within Single Page CheckOut (SPCO for short).

SPCO is responsible for creating/managing the steps when creating registrations etc on the front end, it would also be what triggered the function to confirm all registration inputs were ‘valid’ (meaning required fields had values etc)

So the hook you are using for this would fire too late for you to make a change that would be useful in your situation. We have a hook you can use to hook into SPCO and access the registrations right before the reg step process them:

AHEE__Single_Page_Checkout__process_reg_step__attendee_information__process_reg_step

An example of using that hook can be found here:

https://gist.github.com/Pebblo/0b3b28c9d0c52d5425fa167da1f1a622#file-spco_hook_example-php-L3-L41

Note, I have tested switching reg questions to no longer be required with this but it would be where I would start, at least for the registration question part of your request.


joost backaert

June 2, 2021 at 3:46 pm

Tried to hide the element, but this is beyond my capabilities :/

Viewing 2 reply threads

The support post ‘Hide and change question to optional – registration – checkout’ 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