Last active
April 23, 2018 20:59
-
-
Save pbrocks/18a1cb0f441771427c2cfbf9da5b1185 to your computer and use it in GitHub Desktop.
Add an organization field to the 'checkout_boxes' area of the checkout page.
This file contains hidden or 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 | |
function add_organization_pmpro_RH_fields() { | |
if ( ! defined( 'PMPRO_VERSION' ) || ! defined( 'PMPRORH_VERSION' ) ) { | |
return; | |
} | |
$fields = array(); | |
$fields[] = new PMProRH_Field( | |
'organization_name', // Input name becomes usermeta key, so no hyphens or spaces | |
'text', // The type of field to use | |
array( | |
'label' => 'Organization name', // Display Label | |
'size' => 40, // Size of the input field | |
'class' => 'rh-organization', // Custom CSS class (your choice of name) | |
'profile' => true, // Include user's profile (true | false | 'only' | 'only_admin') | |
'memberslistcsv' => true, // Included in "Member List" CSV export (true | false) | |
'addmember' => true, // Used if the "Add Member Admin" add-on is present (true | false) | |
'required' => false, // Make this field required (true | false) | |
) | |
); | |
/** | |
* This part adds the fields into 'checkout_boxes' area of the checkout page. There | |
* are other areas you can add to. | |
*/ | |
foreach ( $fields as $field ) { | |
// Add the field(s) to the checkout page. | |
pmprorh_add_registration_field( | |
'checkout_boxes', // location on checkout page | |
$field // PMProRH_Field object | |
); | |
} | |
} | |
add_action( 'init', 'add_organization_pmpro_RH_fields' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment