Skip to content

Instantly share code, notes, and snippets.

@eighty20results
Created January 6, 2016 00:39
Show Gist options
  • Save eighty20results/c5a65325fa2c51fecbf6 to your computer and use it in GitHub Desktop.
Save eighty20results/c5a65325fa2c51fecbf6 to your computer and use it in GitHub Desktop.
<?php
//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(
"location", // input name, will also be used as meta key
"select2", // type of field
array(
"label" => "Location",
"class" => "location", // custom class
"profile" => true, // show in user profile
"memberslistcsv" => true,
"addmember" => true,
"options" => array(
"International" => "International",
"Alabama" => "Alabama",
"Alaska" => "Alaska",
"Arizona" => "Arizona",
"Arkansas" => "Arkansas",
"California" => "California",
"Colorado" => "Colorado",
"Connecticut" => "Connecticut",
"Delaware" => "Delaware",
"District of Columbia" => "District of Columbia",
"Florida" => "Florida",
"Georgia" => "Georgia",
"Hawaii" => "Hawaii",
"Idaho" => "Idaho",
"Illinois" => "Illinois",
"Indiana" => "Indiana",
"Iowa" => "Iowa",
"Kansas" => "Kansas",
"Kentucky" => "Kentucky",
"Louisiana" => "Louisiana",
"Maine" => "Maine",
"Maryland" => "Maryland",
"Massachusetts" => "Massachusetts",
"Michigan" => "Michigan",
"Minnesota" => "Minnesota",
"Mississippi" => "Mississippi",
"Missouri" => "Missouri",
"Montana" => "Montana",
"Nebraska" => "Nebraska",
"Nevada" => "Nevada",
"New Hampshire" => "New Hampshire",
"New Jersey" => "New Jersey",
"New Mexico" => "New Mexico",
"New York" => "New York",
"North Carolina" => "North Carolina",
"North Dakota" => "North Dakota",
"Ohio" => "Ohio",
"Oklahoma" => "Oklahoma",
"Oregon" => "Oregon",
"Pennsylvania" => "Pennsylvania",
"Rhode Island" => "Rhode Island",
"South Carolina" => "South Carolina",
"South Dakota" => "South Dakota",
"Tennessee" => "Tennessee",
"Texas" => "Texas",
"Utah" => "Utah",
"Vermont" => "Vermont",
"Virginia" => "Virginia",
"Washington" => "Washington",
"Washington DC" => "Washington DC",
"West Virginia" => "West Virginia",
"Wisconsin" => "Wisconsin",
"Wyoming" => "Wyoming",
)
));
$fields[] = new PMProRH_Field(
"grtl_date_location", // input name, will also be used as meta key
"textarea", // type of field
array(
"label"=>"If applicable, GRTL Training date and Location", // custom field label
"class" => "location", // custom class
"profile" => true, // show in user profile
"memberslistcsv" => true,
"addmember" => true,
));
$fields[] = new PMProRH_Field(
"used_for", // input name, will also be used as meta key
"select", // type of field
array(
"label" => "Program will be used for",
"class" => "used_for",
"profile" => true,
"memberslistcsv" => true,
"addmember" => true,
"options" => array( // <option> elements for select field
"Classroom" => "Classroom", // blank option - cannot be selected if this field is required
"Home" => "Home", // <option value="male">Male</option>
"Other" => "Other" // <option value="female">Female</option>
)));
//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