Skip to content

Instantly share code, notes, and snippets.

@femiyb
Created March 21, 2019 15:26
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 femiyb/bf70ccc92df526824b85c7d8e505ba8c to your computer and use it in GitHub Desktop.
Save femiyb/bf70ccc92df526824b85c7d8e505ba8c to your computer and use it in GitHub Desktop.
<?php
// REGISTER HELPER
function my_pmprorh_init()
{
//don't break if Register Helper is not loaded
if(!function_exists( 'pmprorh_add_registration_field' )) {
return false;
}
$fields = array();
$fields[] = new PMProRH_Field(
'name', //
'text', // type of field
array(
'label' => 'Name', // custom field label
'required' => true, // make this field required
'profile' => true, // show in user profile
'memberslistcsv' => true, // Uncomment to Include in Member List CSV Export
// 'addmember' => true, // Uncomment to display in Add Member
)
);
$fields[] = new PMProRH_Field(
'email', //
'text', // type of field
array(
'label' => 'Email:', // custom field label
'required' => true, // make this field required
'profile' => true, // show in user profile
'memberslistcsv' => true, // Uncomment to Include in Member List CSV Export
// 'addmember' => true, // Uncomment to display in Add Member
)
);
$fields[] = new PMProRH_Field(
'graduation_year', //
'text', // type of field
array(
'label' => 'Graduation Year:', // custom field label
'required' => true, // make this field required
'profile' => true, // show in user profile
'memberslistcsv' => true, // Uncomment to Include in Member List CSV Export
// 'addmember' => true, // Uncomment to display in Add Member
)
);
$fields[] = new PMProRH_Field(
'coach_name', //
'text', // type of field
array(
'label' => 'Coach’s Name:', // custom field label
'required' => true, // make this field required
'profile' => true, // show in user profile
'memberslistcsv' => true, // Uncomment to Include in Member List CSV Export
// 'addmember' => true, // Uncomment to display in Add Member
)
);
$fields[] = new PMProRH_Field(
'coach_contact', //
'text', // type of field
array(
'label' => 'Coach’s Contact:', // custom field label
'required' => true, // make this field required
'profile' => true, // show in user profile
'memberslistcsv' => true, // Uncomment to Include in Member List CSV Export
// 'addmember' => true, // Uncomment to display in Add Member
)
);
//add the fields into a new checkout_boxes are of the checkout page
foreach($fields as $field)
pmprorh_add_registration_field(
'checkout_boxes', // location on checkout page
$field // PMProRH_Field object
);
//that's it. see the PMPro Register Helper readme for more information and examples.
}
add_action( 'init', 'my_pmprorh_init' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment