Skip to content

Instantly share code, notes, and snippets.

@ronalfy
Created March 6, 2020 00:01
Show Gist options
  • Save ronalfy/d37197d1dbca37d20f462cbf54085901 to your computer and use it in GitHub Desktop.
Save ronalfy/d37197d1dbca37d20f462cbf54085901 to your computer and use it in GitHub Desktop.
Paid Memberships Pro Register Helper Company Information 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_trialsofg_init() {
// Don't break if Register Helper is not loaded.
if ( ! function_exists( 'pmprorh_add_registration_field' ) ) {
return false;
}
pmprorh_add_checkout_box( 'company', 'Company Information' );
// Define the fields.
$fields_company = array();
$fields_company[] = new PMProRH_Field(
'companyname',
'text',
array(
'label' => 'Company Name',
'size' => 40,
'class' => 'companyname',
'profile' => true,
'required' => true,
)
);
$fields_company[] = new PMProRH_Field(
'phone',
'text',
array(
'label' => 'Phone Number',
'size' => 40,
'class' => 'phonenumber',
'profile' => true,
'required' => true,
)
);
$fields_company[] = new PMProRH_Field(
'cell',
'text',
array(
'label' => 'Mobile Number',
'size' => 40,
'class' => 'mobilenumber',
'profile' => true,
'required' => true,
)
);
$fields_company[] = new PMProRH_Field(
'fax',
'text',
array(
'label' => 'Fax Number',
'size' => 40,
'class' => 'faxnumber',
'profile' => true,
'required' => false,
)
);
foreach ( $fields_company as $field ) {
pmprorh_add_registration_field(
'company',
$field
);
}
}
add_action( 'init', 'pmpro_register_field_trialsofg_init' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment