Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
//we have to put everything in a function called on init, so we are sure Register Helper is loaded
function my_pmprorh_init()
{
//don't break if Register Helper is not loaded
if(!function_exists("pmprorh_add_registration_field"))
{
return false;
}
//define the fields
$fields = array();
$fields[] = new PMProRH_Field(
"family_member_1", // input name, will also be used as meta key
"text", // type of field
array(
"size" => 40, // # of characters visible (will scroll left if more characters are entered)
"label"=>"Family member", // custom field label
"class" => "fmember_name", // custom class
"profile" => true, // show in user profile
"memberslistcsv" => true,
"addmember" => true,
)
);
$fields[] = new PMProRH_Field(
"fm_1_email", // input name, will also be used as meta key
"text", // type of field
array(
"size" => 40,
"label" => "Email",
"class" => "fmember_email",
"profile" => true,
"memberslistcsv" => true,
"addmember" => true,
)
);
$fields[] = new PMProRH_Field(
"family_member_2", // input name, will also be used as meta key
"text", // type of field
array(
"size" => 40, // # of characters visible (will scroll left if more characters are entered)
"label"=>"Family member", // custom field label
"class" => "fmember_name", // custom class
"profile" => true, // show in user profile
"memberslistcsv" => true,
"addmember" => true,
)
);
$fields[] = new PMProRH_Field(
"fm_2_email", // input name, will also be used as meta key
"text", // type of field
array(
"size" => 40,
"label" => "Email",
"class" => "fmember_email",
"profile" => true,
"memberslistcsv" => true,
"addmember" => true,
)
);
$fields[] = new PMProRH_Field(
"family_member_3", // input name, will also be used as meta key
"text", // type of field
array(
"size" => 40, // # of characters visible (will scroll left if more characters are entered)
"label"=>"Family member", // custom field label
"class" => "fmember_name", // custom class
"profile" => true, // show in user profile
"memberslistcsv" => true,
"addmember" => true,
)
);
$fields[] = new PMProRH_Field(
"fm_3_email", // input name, will also be used as meta key
"text", // type of field
array(
"size" => 40,
"label" => "Email",
"class" => "fmember_email",
"profile" => true,
"memberslistcsv" => true,
"addmember" => true,
)
);
$fields[] = new PMProRH_Field(
"family_member_4", // input name, will also be used as meta key
"text", // type of field
array(
"size" => 40, // # of characters visible (will scroll left if more characters are entered)
"label"=>"Family member", // custom field label
"class" => "fmember_name", // custom class
"profile" => true, // show in user profile
"memberslistcsv" => true,
"addmember" => true,
)
);
$fields[] = new PMProRH_Field(
"fm_4_email", // input name, will also be used as meta key
"text", // type of field
array(
"size" => 40,
"label" => "Email",
"class" => "fmember_email",
"profile" => true,
"memberslistcsv" => true,
"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
You can’t perform that action at this time.