Skip to content

Instantly share code, notes, and snippets.

@travislima
Last active February 6, 2020 10:55
Show Gist options
  • Save travislima/8448052236949edd42f96925d0b2ee75 to your computer and use it in GitHub Desktop.
Save travislima/8448052236949edd42f96925d0b2ee75 to your computer and use it in GitHub Desktop.
Example of Paid Memberships Pro - Register Helper Code. This code registers the Register Helper Field
<?php
/*
* EXAMPLE ONLY of Paid Memberships Pro - Register Helper Code.
* Paste new Register Helper Fields above this line(s) of code in your PMPro Customizations Plugin
*/
$fields = array(); // this line should not be added a second time if you have previously declared it which i believe you have if you are trying to use this code recipe
$fields[] = new PMProRH_Field(
'field_name', // input name, will also be used as meta key
'text', // type of field
array(
'label' => "Label", // label of your field to be displayed
'required' => true, // make this field required
'profile' => true, // show in user profile
));
foreach ( $fields as $field ) {
pmprorh_add_registration_field(
'checkout_boxes', // location on checkout page
$field // PMProRH_Field object
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment