Skip to content

Instantly share code, notes, and snippets.

@travislima
Created December 7, 2018 10:51
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 travislima/15c23b2827c0c2af5af696bdf45781d7 to your computer and use it in GitHub Desktop.
Save travislima/15c23b2827c0c2af5af696bdf45781d7 to your computer and use it in GitHub Desktop.
RH: Example for Customer.
<?php
function my_pmprorh_init()
{
//don't break if Register Helper is not loaded
if(!function_exists( 'pmprorh_add_registration_field' )) {
return false;
}
//define the fields
$fields = array();
$fields[] = new PMProRH_Field(
'occupation', // input name, will also be used as meta key
'text', // type of field
array(
'label' => 'Position / Occupation Title', // custom field label
'size' => 40, // input size
'class' => 'position-title', // custom class
'profile' => true, // show in user profile
'required' => false, // make this field required
)
);
$fields[] = new PMProRH_Field(
'pract_name', // input name, will also be used as meta key
'text', // type of field
array(
'label' => 'Practice Name', // custom field label
'size' => 40, // input size
'class' => 'pract_name', // custom class
'profile' => true, // show in user profile
'required' => false, // make this field required
)
);
$fields[] = new PMProRH_Field(
'pract_line1', // input name, will also be used as meta key
'text', // type of field
array(
'label' => false, // custom field label
'html_attributes' => array('placeholder'=>"Practice Address Line 1"),
'size' => 40, // input size
'class' => 'pract_line1', // custom class
'profile' => true, // show in user profile
'required' => false, // make this field required
)
);
$fields[] = new PMProRH_Field(
'pract_line2', // input name, will also be used as meta key
'text', // type of field
array(
'label' => false, // custom field label
'html_attributes' => array('placeholder'=>"Practice Address Line 2"),
'size' => 40, // input size
'class' => 'pract_line2', // custom class
'profile' => true, // show in user profile
'required' => false, // make this field required
)
);
//field size changed
$fields[] = new PMProRH_Field(
'pract_county', // input name, will also be used as meta key
'text', // type of field
array(
'label' => false, // custom field label
'html_attributes' => array('placeholder'=>"County"),
'size' => 15, // input size
'class' => 'pract_county', // custom class
'profile' => true, // show in user profile
'required' => false, // make this field required
)
);
// field size changed
$fields[] = new PMProRH_Field(
'pract_postcode', // input name, will also be used as meta key
'text', // type of field
array(
'label' => false, // custom field label
'html_attributes' => array('placeholder'=>"Postal Code"),
'size' => 15, // input size
'class' => 'pract_postcode', // custom class
'profile' => true, // show in user profile
'required' => false, // make this field required
)
);
//line break added
$fields[] = new PMProRH_Field(
'html_title', // input name, will also be used as meta key
'html', // type of field
array(
'label' => '<br/>',
)
);
$fields[] = new PMProRH_Field(
'pract_phone', // input name, will also be used as meta key
'text', // type of field
array(
'label' => 'Practice Phone Number', // custom field label
'size' => 40, // input size
'class' => 'pract_phone', // custom class
'profile' => true, // show in user profile
'required' => false, // make this field required
)
);
$fields[] = new PMProRH_Field(
'prof_registration', // input name, will also be used as meta key
'text', // type of field
array(
'label' => 'Professional Registration Number', // custom field label
'size' => 20, // input size
'class' => 'prof_registration', // custom class
'profile' => true, // show in user profile
'required' => false, // make this field required
)
);
//add the fields into a new checkout_boxes are of the checkout page
foreach($fields as $field)
pmprorh_add_registration_field(
'after_email', // 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