Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Add Extra fields for PMPro
<?php
/*
Plugin Name: Register Helper - Extra fields
Plugin URI: http://www.paidmembershipspro.com/wp/pmpro-customizations/
Description: Extra registration fields
Version: .1
Author: Thomas Sjolshagen - PMPro Support
Author URI: http://www.strangerstudios.com/
*/
function my_pmprorh_extra_fields_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(
"local_phone", // input name, will also be used as meta key
"text", // type of field
array(
"label" => "Local Phone",
"size" => 40, // input size
"class" => "local_phone", // custom class
"profile" => false, // show in user profile
"memberslistcsv" => true,
"addmember" => true,
"required" => false // make this field required
)
);
$fields[] = new PMProRH_Field(
"local_address", // input name, will also be used as meta key
"textarea", // type of field
array(
"label" => "Local Address",
"rows" => 5,
"cols" => 80,
"class" => "local_address", // custom class
"profile" => false, // show in user profile
"memberslistcsv" => true,
"addmember" => true,
"required" => false // make this field required
)
);
$fields[] = new PMProRH_Field(
"volunteer_ability", // input name, will also be used as meta key
"radio", // type of field
array(
"label" => "Volunteer Ability",
"class" => "ability", // custom class
"profile" => false, // show in user profile
"memberslistcsv" => true,
"addmember" => true,
"required" => false, // make this field required
"options" => array(
'very' => 'Very Available',
'somewhat' => 'Somewhat Available',
'none' => 'Not Available'
)
)
);
$fields[] = new PMProRH_Field(
"volunteer_interest", // input name, will also be used as meta key
"checkbox", // type of field
array(
"label" => "Volunteer Interest",
"text" => "Flexible",
"class" => "interest", // custom class
"profile" => false, // show in user profile
"memberslistcsv" => true,
"addmember" => true,
"required" => false, // make this field required
)
);
$fields[] = new PMProRH_Field(
"volunteer_interest", // input name, will also be used as meta key
"checkbox", // type of field
array(
"label" => "&nbsp;",
"text" => "Greet visitors at CM",
"class" => "interest", // custom class
"profile" => false, // show in user profile
"memberslistcsv" => true,
"addmember" => true,
"required" => false, // make this field required
)
);
$fields[] = new PMProRH_Field(
"volunteer_interest", // input name, will also be used as meta key
"checkbox", // type of field
array(
"label" => "&nbsp;",
"text" => "Serve coffee at CM",
"class" => "interest", // custom class
"profile" => false, // show in user profile
"memberslistcsv" => true,
"addmember" => true,
"required" => false, // make this field required
)
);
/*
$fields[] = new PMProRH_Field(
"volunteer_interest", // input name, will also be used as meta key
"select", // type of field
array(
"label" => "Volunteer Interest",
"class" => "interest", // custom class
"profile" => false, // show in user profile
"memberslistcsv" => true,
"addmember" => true,
"required" => false, // make this field required
'multiple' => true,
'options' => array(
'flexible' => 'Flexible',
'greeter' => 'Greet visitors at CM',
'coffee' => 'Serve coffee at CM',
'fundraise' => '
Assist with fundraising',
'lead_committee' => 'Lead a committee or project team',
'committee' => '
Serve on a committee or project team',
'promoter' => 'Help promote the BWN',
'executive_board' => 'Serve on the Executive Board',
'donor' => 'Donate money',
'orgainizer' => 'Organize events and activities',
'assistant' => 'Assist with events and activities',
'none' => 'Not interested',
)
)
);
*/
//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
);
}
}
add_action("init", "my_pmprorh_extra_fields_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.