Created
April 11, 2019 22:05
-
-
Save ipokkel/412134adc86cc727c21fe37248c8f27b to your computer and use it in GitHub Desktop.
Register Helper example including user's church fields.
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
<?php | |
/* | |
Plugin Name: PMPro Customizations | |
Plugin URI: https://www.paidmembershipspro.com/wp/pmpro-customizations/ | |
Description: Customizations for my Paid Memberships Pro Setup | |
Version: .1 | |
Author: Paid Memberships Pro | |
Author URI: https://www.paidmembershipspro.com | |
*/ | |
//Now start placing your customization code below this line | |
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( | |
'address1', | |
'text', | |
array( | |
'label' => 'Address 1', | |
'profile' => true, | |
'required' => false, | |
'addmember' => true, | |
) | |
); | |
$fields[] = new PMProRH_Field( | |
'address2', | |
'text', | |
array( | |
'label' => ' Address 2', | |
'profile' => true, | |
'required' => false, | |
'addmember' => true, | |
) | |
); | |
$fields[] = new PMProRH_Field( | |
'city', | |
'text', | |
array( | |
'label' => 'City', | |
'profile' => true, | |
'required' => false, | |
'addmember' => true, | |
) | |
); | |
$fields[] = new PMProRH_Field( | |
'county', | |
'text', | |
array( | |
'label' => 'County', | |
'profile' => true, | |
'required' => false, | |
'addmember' => true, | |
) | |
); | |
$fields[] = new PMProRH_Field( | |
'zipcode', | |
'text', | |
array( | |
'label' => 'Postcode', | |
'size' => 10, | |
'profile' => true, | |
'required' => false, | |
'addmember' => true, | |
) | |
); | |
$fields[] = new PMProRH_Field( | |
'mobile', | |
'text', | |
array( | |
'label' => 'Mobile Phone', | |
'profile' => true, | |
'required' => false, | |
'addmember' => true, | |
) | |
); | |
$fields[] = new PMProRH_Field( | |
'phone', | |
'text', | |
array( | |
'label' => 'Landline Phone', | |
'profile' => true, | |
'required' => false, | |
'addmember' => true, | |
) | |
); | |
$fields[] = new PMProRH_Field( | |
'html_church_details', | |
'html', | |
array( | |
'html' => '<p><strong>Church Details</strong></p>', | |
'showmainlabel' => false, | |
) | |
); | |
$fields[] = new PMProRH_Field( | |
'church_name', | |
'text', | |
array( | |
'label' => 'Name of Church', | |
'profile' => true, | |
'required' => false, | |
'addmember' => true, | |
) | |
); | |
$fields[] = new PMProRH_Field( | |
'church_denomination', | |
'text', | |
array( | |
'label' => 'Denomination', | |
'profile' => true, | |
'required' => false, | |
'addmember' => true, | |
) | |
); | |
$fields[] = new PMProRH_Field( | |
'church_city', | |
'text', | |
array( | |
'label' => 'City', | |
'profile' => true, | |
'required' => false, | |
'addmember' => true, | |
) | |
); | |
$fields[] = new PMProRH_Field( | |
'church_county', | |
'text', | |
array( | |
'label' => 'County', | |
'profile' => true, | |
'required' => false, | |
'addmember' => true, | |
) | |
); | |
$fields[] = new PMProRH_Field( | |
'church_zipcode', | |
'text', | |
array( | |
'label' => 'Postcode', | |
'size' => 10, | |
'profile' => true, | |
'required' => false, | |
'addmember' => true, | |
) | |
); | |
$fields[] = new PMProRH_Field( | |
'gift_aid', | |
'radio', | |
array( | |
'label' => 'Can Gift Aid be reclaimed on your subscription:', | |
'options' => array( | |
'yes' => 'Yes', | |
'no' => 'No', | |
), | |
'profile' => true, | |
'required' => false, | |
'addmember' => 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