Created
April 30, 2021 16:53
-
-
Save chered/e96eccde56754531e11a815809557fe2 to your computer and use it in GitHub Desktop.
This file contains 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
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( | |
'first_name', // input name, will also be used as meta key | |
'text', // type of field | |
array( | |
'label' => 'First Name', // custom field label | |
'size' => 40, // input size | |
'class' => 'first-name', // custom class | |
'profile' => true, // show in user profile | |
'required' => true, // make this field required | |
'levels' => array(1,2) // only levels 1 and 2 should have the company field | |
) | |
); | |
$fields[] = new PMProRH_Field( | |
'last_name', // input name, will also be used as meta key | |
'text', // type of field | |
array( | |
'label' => 'Last Name', // custom field label | |
'size' => 40, // input size | |
'class' => 'last-name', // custom class | |
'profile' => true, // show in user profile | |
'required' => true, // make this field required | |
'levels' => array(1,2) // only levels 1 and 2 should have the company field | |
) | |
); | |
$fields[] = new PMProRH_Field( | |
'mobile', // input name, will also be used as meta key | |
'text', // type of field | |
array( | |
'label' => 'Mobile Number', // custom field label | |
'size' => 40, // input size | |
'class' => 'mobile', // custom class | |
'profile' => true, // show in user profile | |
'required' => false, // make this field required | |
'levels' => array(1,2) // only levels 1 and 2 should have the company field | |
) | |
); | |
$fields[] = new PMProRH_Field( | |
'hometown', // input name, will also be used as meta key | |
'text', // type of field | |
array( | |
'label' => 'Hometown', // custom field label | |
'size' => 40, // input size | |
'class' => 'hometown', // custom class | |
'profile' => true, // show in user profile | |
'required' => false, // make this field required | |
'levels' => array(1,2) // only levels 1 and 2 should have the company field | |
) | |
); | |
$fields[] = new PMProRH_Field( | |
'linkedin', // input name, will also be used as meta key | |
'text', // type of field | |
array( | |
'label' => 'Linkedin Profile Link', // custom field label | |
'size' => 40, // input size | |
'class' => 'linkedin', // custom class | |
'profile' => only, // show in user profile | |
'required' => false, // make this field required | |
'levels' => array(1,2) // only levels 1 and 2 should have the company field | |
) | |
); | |
$fields[] = new PMProRH_Field( | |
'industries', // input name, will also be used as meta key | |
'select2', // type of field | |
array( | |
'label' => 'Industries', // custom field label | |
'size' => 40, // input size | |
'class' => 'industries', // custom class | |
'profile' => true, // show in user profile | |
'required' => false, // make this field required | |
'levels' => array(1,2), // only levels 1 and 2 should have the company field | |
'options' => array( | |
'administrative_services' => 'Administrative Services', | |
'advertising' => 'Advertising', | |
), | |
) | |
); | |
$fields[] = new PMProRH_Field( | |
'desired_role', // input name, will also be used as meta key | |
'text', // type of field | |
array( | |
'label' => 'Desired Role', // custom field label | |
'size' => 40, // input size | |
'class' => 'desired-role', // custom class | |
'profile' => true, // show in user profile | |
'required' => false, // make this field required | |
'levels' => array(1,2) // only levels 1 and 2 should have the company field | |
) | |
); | |
// Add the fields into a new checkout_boxes are of the checkout page. | |
foreach ( $fields as $field ) { | |
pmprorh_add_registration_field( | |
'after_billing_fields', // 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