Skip to content

Instantly share code, notes, and snippets.

@femiyb
Created February 21, 2020 10:17
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/7989cd380a7cf1d13838d3596d3475d6 to your computer and use it in GitHub Desktop.
Save femiyb/7989cd380a7cf1d13838d3596d3475d6 to your computer and use it in GitHub Desktop.
<?php
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(
'joint_account_name', // input name, will also be used as meta key
'text',
array(
'label' => 'Joint Account Name',
'profile' => true,
'required' => true,
'levels' => array(2,4,16,18) // instead of 12, type in the ID of your membership level. More than levels can be added like this, array(1,2,3)
)
);
$fields[] = new PMProRH_Field(
'joint_account_email', // input name, will also be used as meta key
'text',
array(
'label' => 'Joint Account Email',
'profile' => true,
'levels' => array(2,4,16,18) // instead of 12, type in the ID of your membership level. More than levels can be added like this, array(1,2,3)
)
);
$fields[] = new PMProRH_Field(
'birthday', // input name, will also be used as meta key
'date', // type of field
array(
'label' => "Birthday",
'required' => true, // make this field required
'profile' => true, // show in user profile
'memberslistcsv' => true, //includes in CSV export
'levels' => array(12) // instead of 12, type in the ID of your membership level. More than levels can be added like this, array(1,2,3)
));
//add the fields into new checkout_boxes area 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