Last active
May 25, 2016 23:13
-
-
Save eighty20results/58eccf04363acdb3fcfbfbc1876ffc9a to your computer and use it in GitHub Desktop.
Register Helper fields (customization plugin) for ACTO Online
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: Additional user data for ACTO checkout | |
Plugin URI: http://www.paidmembershipspro.com/wp/pmpro-customizations/ | |
Description: Add Register Helper fields to ACTO chekout & profile pages | |
Version: .1 | |
Author: Stranger Studios | |
Author URI: http://www.strangerstudios.com | |
*/ | |
function acto_load_rh_fields() | |
{ | |
//don't break if Register Helper or PMPro isn't active | |
if (!defined('PMPRO_VERSION') || !defined('PMPRORH_VERSION')) { | |
return; | |
} | |
global $pmpro_countries; | |
$country_class = pmpro_getClassForField("bcountry"); | |
$billing_fields = apply_filters('pmpro_include_billing_address_fields', true); | |
$fields = array(); | |
$fields[] = new PMProRH_Field( | |
"organization_name", // Input name, will also be used as the key to access as user meta | |
"text", // The type of field to use | |
array( | |
"label" => "Organization Name", // Label to use for the field when displaying it | |
"name" => "organization_name", // Input name, will also be used as the key to access as user meta | |
"class" => "acto-rh-input", // 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) | |
) | |
); | |
if ( false === $billing_fields ) { | |
$fields[] = new PMProRH_Field( | |
"pmpro_bphone", // Input name, will also be used as the key to access as user meta | |
"text", // The type of field to use | |
array( | |
"label" => "Phone", // Label to use for the field when displaying it | |
"name" => "pmpro_bphone", // Input name, will also be used as the key to access as user meta | |
"class" => "acto-rh-input", // 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( | |
"pmpro_bcountry", // Input name, will also be used as the key to access as user meta | |
"select", // The type of field to use | |
array( | |
"label" => "Country", // Label to use for the field when displaying it | |
"name" => "pmpro_bcountry", // Input name, will also be used as the key to access as user meta | |
"class" => $country_class, // 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_merge( array( -1 => '-- select country --' ), $pmpro_countries ), | |
) | |
); | |
} | |
$fields[] = new PMProRH_Field( | |
"accreditation", // Input name, will also be used as the key to access as user meta | |
"text", // The type of field to use | |
array( | |
"label" => "Home Group", // Label to use for the field when displaying it | |
"name" => "accreditation", // Input name, will also be used as the key to access as user meta | |
"class" => "acto-rh-input", // 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( | |
"business_summary", // Input name, will also be used as the key to access as user meta | |
"textarea", // The type of field to use | |
array( | |
"label" => "Business summary", // Label to use for the field when displaying it | |
"name" => "business_summary", // Input name, will also be used as the key to access as user meta | |
"class" => "acto-rh-textbox", // Custom CSS class to add (your choice) | |
"rows" => 10, // Lines of text (height) | |
"cols" => 78, // # of characters wide | |
"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) | |
) | |
); | |
foreach ($fields as $f) { | |
pmprorh_add_registration_field( | |
'checkout_boxes', | |
$f | |
); | |
} | |
} | |
add_action('init', 'acto_load_rh_fields', 11); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment