Skip to content

Instantly share code, notes, and snippets.

@Pebblo
Last active February 11, 2020 13:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Pebblo/f27056f2bcf220f5d391 to your computer and use it in GitHub Desktop.
Save Pebblo/f27056f2bcf220f5d391 to your computer and use it in GitHub Desktop.
A small example of how to hide the 'email' address field for additional registrants when using EE4. The function hides all but the first email address fields then copies any text input into the email field to all of the hidden fields, this means you can request the 'personal information' group for additional registrants but they will not need to…
<?php // Please do not include the opening PHP tag if you already have one.
// This function hides all the the Primary Registrant's email address question
// and then copies any value set in that question to the other fields.
add_action( 'wp_enqueue_scripts', 'tw_ee_hide_additional_email_questions', 11 );
function tw_ee_hide_additional_email_questions() {
wp_add_inline_script(
'single_page_checkout',
"jQuery( document ).ready(function( $ ) {
$('.ee-reg-qstn-email').on('keyup change paste', function(e){
$('.ee-reg-qstn-email').val($(this).val())
});
$('.spco-attendee-panel-dv:not(:first)').each( function() {
$(this).find('.ee-reg-qstn-email').hide();
});
});"
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment