Skip to content

Instantly share code, notes, and snippets.

@andrewlimaza
Last active April 5, 2016 19:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andrewlimaza/88b6b5d81a8052d3e659a38377747811 to your computer and use it in GitHub Desktop.
Save andrewlimaza/88b6b5d81a8052d3e659a38377747811 to your computer and use it in GitHub Desktop.
PMPro Register Helper - Mailing information fields
function my_pmprorh_init()
{
//create a checkout box
pmprorh_add_checkout_box("mailing_info", "Mailing Details", "This description is optional");
//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(
"mailing_name", // input name, will also be used as meta key
"text", // type of field
array(
"label"=>"Full Name",
"size"=>30, // input size
"profile"=>true, // show in user profile
));
$fields[] = new PMProRH_Field(
"mailing_address", // input name, will also be used as meta key
"text", // type of field
array(
"label"=>"Address",
"size"=>30, // input size
"profile"=>true, // show in user profile
));
$fields[] = new PMProRH_Field(
"mailing_city", // input name, will also be used as meta key
"text", // type of field
array(
"label"=>"City",
"size"=>30, // input size
"profile"=>true, // show in user profile
));
$fields[] = new PMProRH_Field(
"mailing_zip", // input name, will also be used as meta key
"text", // type of field
array(
"label"=>"Zipcode",
"size"=>30, // input size
"profile"=>true, // show in user profile
));
$fields[] = new PMProRH_Field(
"mailing_state", // input name, will also be used as meta key
"text", // type of field
array(
"label"=>"State",
"size"=>30, // input size
"profile"=>true, // show in user profile
));
$fields[] = new PMProRH_Field(
"mailing_number", // input name, will also be used as meta key
"text", // type of field
array(
"label"=>"Phone Number",
"size"=>30, // input size
"profile"=>true, // show in user profile
));
//add the fields into a new checkout_boxes are of the checkout page
foreach($fields as $field)
pmprorh_add_registration_field(
"mailing_info", // 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