Created
May 8, 2016 15:09
-
-
Save eighty20results/4550d4bc3bc71ff5188002e87594c10c to your computer and use it in GitHub Desktop.
Register Helper Fields for DPES
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: PMPro Register Helper - Extra fields | |
Plugin URI: http://www.paidmembershipspro.com/wp/pmpro-customizations/ | |
Description: Extra registration fields | |
Version: .1 | |
Author: Thomas Sjolshagen - PMPro Support <[email protected]> | |
Author URI: http://www.strangerstudios.com/ | |
*/ | |
function dpesrh_RH_fields() | |
{ | |
//require PMPro and PMPro Register Helper | |
if (!defined('PMPRO_VERSION') || !defined('PMPRORH_VERSION')) | |
return; | |
$fields = array(); | |
$fields[] = new PMProRH_Field( | |
"chapter", // Input name, will also be used as the key to access as user meta | |
"select", // The type of field to use | |
array( | |
"label" => "Chapter", // Label to use for the field when displaying it | |
"class" => "dpesrh_chapter", // Custom CSS class to add (your choice) | |
"profile" => true, // Include in the user's profile (true | false | 'only' | 'only_admin') | |
"memberslistcsv" => true, // Let field be included in "Member List" CSV export (true | false) | |
"addmember" => true, // Used if the "Add Member Admin" add-on is present (true | false) | |
"required" => true, // Make this field required (true | false) | |
'options' => array( | |
'alpha' => 'Georgetown University (Alpha)', | |
'beta' => 'New York University (Beta)', | |
'gamma' => 'Boston University (Gamma)', | |
'delta' => 'University of Southern California (Delta)', | |
'epsilon' => 'University of California, Berkeley (Epsilon)', | |
'eta' => 'The George Washington University (Eta)', | |
'theta' => 'Northwestern University (Theta)', | |
'iota' => 'Wayne State Univ./Univ. Wisconsin (Iota)', | |
'kappa' => 'Stanford University (Kappa)', | |
'mu' => 'Michigan State University (Mu)', | |
'nu' => 'University of Michigan (Nu)', | |
'xi' => 'Texas Tech (Xi)', | |
'omicron' => 'Occidental College (Omicron)', | |
'pi' => 'American University (Pi)', | |
'rho' => 'CSU Los Angeles (Rho)', | |
'sigma' => 'Pepperdine University (Sigma)', | |
'tau' => 'Loyola Marymount University (Tau)', | |
'upsilon' => 'Arizona State University (Upsilon)', | |
'phi' => 'University of South Carolina (Phi)', | |
'psi' => 'University of the Pacific (Psi)', | |
'omega' => 'Southern Methodist University (Omega)' | |
) | |
) | |
); | |
$fields[] = new PMProRH_Field( | |
"line_number", // Input name, will also be used as the key to access as user meta | |
"text", // The type of field to use | |
array( | |
"label" => "Line Number", // Label to use for the field when displaying it | |
"size" => 40, // Size of the Input field | |
"class" => "dpesrh_text", // Custom CSS class to add (your choice) | |
"profile" => true, // Include in the user's profile (true | false | 'only' | 'only_admin') | |
"memberslistcsv" => true, // Let field be included in "Member List" CSV export (true | false) | |
"addmember" => true, // Used if the "Add Member Admin" add-on is present (true | false) | |
"required" => true // Make this field required (true | false) | |
) | |
); | |
$fields[] = new PMProRH_Field( | |
"graduation_year", // Input name, will also be used as the key to access as user meta | |
"text", // The type of field to use | |
array( | |
"label" => "Graduation Year", // Label to use for the field when displaying it | |
"size" => 40, // Size of the Input field | |
"class" => "dpesrh_text", // Custom CSS class to add (your choice) | |
"profile" => true, // Include in the user's profile (true | false | 'only' | 'only_admin') | |
"memberslistcsv" => true, // Let field be included in "Member List" CSV export (true | false) | |
"addmember" => true, // Used if the "Add Member Admin" add-on is present (true | false) | |
"required" => true // Make this field required (true | false) | |
) | |
); | |
$fields[] = new PMProRH_Field( | |
' ', | |
'html', | |
array( | |
'html' => '<div style="width: 250px; margin-left: auto; margin-right: auto;"><h3 style="margin-bottom: 0;">Sections and Committees</h3><small style="font-style: italic;">Select all that apply</small></div>', | |
'profile' => true, | |
'memberslistcsv' => true, | |
'addmember' => true, | |
) | |
); | |
$fields[] = new PMProRH_Field( | |
"sections_committees[]", // input name, will also be used as meta key | |
"checkbox", // type of field | |
array( | |
"label" => " ", | |
"text" => "Students", | |
"class" => "dpesrh_checkbox", // custom class | |
"profile" => true, // show in user profile | |
"memberslistcsv" => true, | |
"addmember" => true, | |
"required" => false, // make this field required | |
) | |
); | |
$fields[] = new PMProRH_Field( | |
"sections_committees[]", // input name, will also be used as meta key | |
"checkbox", // type of field | |
array( | |
"label" => " ", | |
"text" => "Young Professionals", | |
"class" => "dpesrh_checkbox", // custom class | |
"profile" => true, // show in user profile | |
"memberslistcsv" => true, | |
"addmember" => true, | |
"required" => false, // make this field required | |
) | |
); | |
$fields[] = new PMProRH_Field( | |
"sections_committees[]", // input name, will also be used as meta key | |
"checkbox", // type of field | |
array( | |
"label" => " ", | |
"text" => "Faculty and Academia", | |
"class" => "dpesrh_checkbox", // custom class | |
"profile" => true, // show in user profile | |
"memberslistcsv" => true, | |
"addmember" => true, | |
"required" => false, // make this field required | |
) | |
); | |
$fields[] = new PMProRH_Field( | |
"sections_committees[]", // input name, will also be used as meta key | |
"checkbox", // type of field | |
array( | |
"label" => " ", | |
"text" => "Government Service and Armed Forces", | |
"class" => "dpesrh_checkbox", // custom class | |
"profile" => true, // show in user profile | |
"memberslistcsv" => true, | |
"addmember" => true, | |
"required" => false, // make this field required | |
) | |
); | |
$fields[] = new PMProRH_Field( | |
"sections_committees[]", // input name, will also be used as meta key | |
"checkbox", // type of field | |
array( | |
"label" => " ", | |
"text" => "International Business and Trade", | |
"class" => "dpesrh_checkbox", // custom class | |
"profile" => true, // show in user profile | |
"memberslistcsv" => true, | |
"addmember" => true, | |
"required" => false, // make this field required | |
) | |
); | |
$fields[] = new PMProRH_Field( | |
"sections_committees[]", // input name, will also be used as meta key | |
"checkbox", // type of field | |
array( | |
"label" => " ", | |
"text" => "Non-Governmental Organizations", | |
"class" => "dpesrh_checkbox", // custom class | |
"profile" => true, // show in user profile | |
"memberslistcsv" => true, | |
"addmember" => true, | |
"required" => false, // make this field required | |
) | |
); | |
$fields[] = new PMProRH_Field( | |
"sections_committees[]", // input name, will also be used as meta key | |
"checkbox", // type of field | |
array( | |
"label" => " ", | |
"text" => "Veterans", | |
"class" => "dpesrh_checkbox", // custom class | |
"profile" => true, // show in user profile | |
"memberslistcsv" => true, | |
"addmember" => true, | |
"required" => false, // make this field required | |
) | |
); | |
$fields[] = new PMProRH_Field( | |
"sections_committees[]", // input name, will also be used as meta key | |
"checkbox", // type of field | |
array( | |
"label" => " ", | |
"text" => "Ethics Project", | |
"class" => "dpesrh_checkbox", // custom class | |
"profile" => true, // show in user profile | |
"memberslistcsv" => true, | |
"addmember" => true, | |
"required" => false, // make this field required | |
) | |
); | |
$fields[] = new PMProRH_Field( | |
"sections_committees[]", // input name, will also be used as meta key | |
"checkbox", // type of field | |
array( | |
"label" => " ", | |
"text" => "DC Coordinating Committee", | |
"class" => "dpesrh_checkbox", // custom class | |
"profile" => true, // show in user profile | |
"memberslistcsv" => true, | |
"addmember" => true, | |
"required" => false, // make this field required | |
) | |
); | |
$fields[] = new PMProRH_Field( | |
"sections_committees[]", // input name, will also be used as meta key | |
"checkbox", // type of field | |
array( | |
"label" => " ", | |
"text" => "New York Coordinating Committee", | |
"class" => "dpesrh_checkbox", // custom class | |
"profile" => true, // show in user profile | |
"memberslistcsv" => true, | |
"addmember" => true, | |
"required" => false, // make this field required | |
) | |
); | |
$fields[] = new PMProRH_Field( | |
"sections_committees[]", // input name, will also be used as meta key | |
"checkbox", // type of field | |
array( | |
"label" => " ", | |
"text" => "San Francisco Bay Coordinating Committee", | |
"class" => "dpesrh_checkbox", // custom class | |
"profile" => true, // show in user profile | |
"memberslistcsv" => true, | |
"addmember" => true, | |
"required" => false, // make this field required | |
) | |
); | |
//Add the fields into a new checkout_boxes are of the checkout page | |
foreach($fields as $field) | |
{ | |
// Add the field(s) to the checkout page. | |
pmprorh_add_registration_field( | |
"checkout_boxes", // location on checkout page | |
$field // PMProRH_Field object | |
); | |
} | |
} | |
add_action("init", "dpesrh_RH_fields", 12); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment