-
-
Save MaryOJob/b0015af1ee21d3efcb0b273e497eb1d1 to your computer and use it in GitHub Desktop.
Paid Memberships Pro Register Helper Adding Emergency Contact Fields
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// We have to put everything in a function called on init, so we are sure Register Helper is loaded. | |
function pmpro_register_field_peakbagger_init() { | |
// Don't break if Register Helper is not loaded. | |
if ( ! function_exists( 'pmprorh_add_registration_field' ) ) { | |
return false; | |
} | |
pmprorh_add_checkout_box( 'contact', 'Contact Information' ); | |
pmprorh_add_checkout_box( 'emergency', 'Emergency Contact Information' ); | |
// Define the fields. | |
$fields_contact = array(); | |
$fields_contact[] = new PMProRH_Field( | |
'firstname', | |
'text', | |
array( | |
'label' => 'First Name', | |
'size' => 40, | |
'class' => 'firstname', | |
'profile' => true, | |
'required' => true, | |
) | |
); | |
$fields_contact[] = new PMProRH_Field( | |
'lastname', | |
'text', | |
array( | |
'label' => 'Last Name', | |
'size' => 40, | |
'class' => 'lastname', | |
'profile' => true, | |
'required' => true, | |
) | |
); | |
$fields_contact[] = new PMProRH_Field( | |
'phone', | |
'text', | |
array( | |
'label' => 'Phone Number', | |
'size' => 40, | |
'class' => 'lastname', | |
'profile' => true, | |
'required' => true, | |
) | |
); | |
$fields_contact[] = new PMProRH_Field( | |
'email', | |
'text', | |
array( | |
'label' => 'Email Address', | |
'size' => 40, | |
'class' => 'email', | |
'profile' => true, | |
'required' => true, | |
) | |
); | |
$fields_emergency = array(); | |
$fields_emergency[] = new PMProRH_Field( | |
'emergency_firstname', | |
'text', | |
array( | |
'label' => 'Emergency Contact First Name', | |
'size' => 40, | |
'class' => 'ec-firstname', | |
'profile' => true, | |
'required' => true, | |
) | |
); | |
$fields_emergency[] = new PMProRH_Field( | |
'emergency_lastname', | |
'text', | |
array( | |
'label' => 'Emergency Contact Last Name', | |
'size' => 40, | |
'class' => 'ec-lastname', | |
'profile' => true, | |
'required' => true, | |
) | |
); | |
$fields_emergency[] = new PMProRH_Field( | |
'emergency_phone', | |
'text', | |
array( | |
'label' => 'Emergency Contact Phone Number', | |
'size' => 40, | |
'class' => 'ec-phone', | |
'profile' => true, | |
'required' => true, | |
) | |
); | |
foreach ( $fields_contact as $field ) { | |
pmprorh_add_registration_field( | |
'contact', | |
$field | |
); | |
} | |
foreach ( $fields_emergency as $field ) { | |
pmprorh_add_registration_field( | |
'emergency', | |
$field | |
); | |
} | |
} | |
add_action( 'init', 'pmpro_register_field_peakbagger_init' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment