Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Paid Memberships Pro Register Helper Adding Emergency Contact Fields
<?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
You can’t perform that action at this time.