Skip to content

Instantly share code, notes, and snippets.

@femiyb
Last active July 9, 2019 09:40
Show Gist options
  • Save femiyb/855b5c5da269b93a6b066c86452e0032 to your computer and use it in GitHub Desktop.
Save femiyb/855b5c5da269b93a6b066c86452e0032 to your computer and use it in GitHub Desktop.
<?php
/**
* Add the code below to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
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(
'membership_overdue',
'select',
array(
'label' => 'Application Type:',
'required' => true,
'options' => array(
'' => '',
'new_member' => 'New Member',
'membership_renewal' => 'Membership Renewal',
'donation' => 'Donation',
)
)
);
$fields[] = new PMProRH_Field(
"USPC_Bylaws:",
"checkbox",
array(
"label" => "USPC Bylaws: I have read and agree with the principles and rules outlined in the U.S. Pleace Council Bylaws.",
"profile" => true,
"required" => true,
)
);
$fields[] = new PMProRH_Field(
"phone",
"text",
array(
"label" => "Phone:",
"profile" => true,
"required" => true,
)
);
$fields[] = new PMProRH_Field(
"city_state",
"text",
array(
"label" => "City, State:",
"profile" => true,
"required" => true,
)
);
$fields[] = new PMProRH_Field(
"chapter",
"text",
array(
"label" => "Chapter:",
"profile" => true,
"required" => true,
)
);
//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