Created
August 31, 2014 23:22
-
-
Save strangerstudios/c2b743a268317b007993 to your computer and use it in GitHub Desktop.
Custom Fields for PMPro (Church Site)
This file contains 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 Fields | |
Plugin URI: http://www.paidmembershipspro.com/wp/pmpro-fields/ | |
Description: Register Helper Initialization Example | |
Version: .1 | |
Author: Stranger Studios | |
Author URI: http://www.strangerstudios.com | |
*/ | |
/* | |
Custom PMPro Fields | |
1. Copy pmpro-fields.php to your /wp-content/plugins/ folder. | |
2. Activate the PMPro Fields plugin. | |
(or copy the lines below into your own custom plugin) | |
*/ | |
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( | |
"church_name", | |
"text", | |
array( | |
"label"=>"Church Name", | |
"size"=>40, | |
"profile"=>true, | |
"required"=>true, | |
"memberslistcsv"=>true | |
)); | |
$fields[] = new PMProRH_Field( | |
"heard", | |
"select", | |
array( | |
"label"=>"How did you hear about us?", | |
"profile"=>true, | |
"options"=>array( | |
""=>"- Choose One -", | |
"email"=>"Email", | |
"word-of-mouth"=>"Word of Mouth", | |
"twitter"=>"Twitter", | |
"facebook"=>"Facebook", | |
"other"=>"Other" | |
), | |
"required"=>true, | |
"memberslistcsv"=>true | |
)); | |
$fields[] = new PMProRH_Field( | |
"heard_other", | |
"text", | |
array( | |
"label"=>"Other", | |
"size"=>40, | |
"profile"=>true, | |
"depends"=>array( | |
array('id'=>'heard', 'value'=>'other') | |
), | |
"memberslistcsv"=>true | |
)); | |
$fields[] = new PMProRH_Field( | |
"size", | |
"select", | |
array( | |
"label"=>"Size of your church.", | |
"profile"=>true, | |
"options"=>array( | |
"Under 100"=>"Under 100", | |
"100-300"=>"100-300", | |
"300-700"=>"300-700", | |
"700-1200"=>"700-1200", | |
"1200-2000"=>"1200-2000", | |
"2000-4500"=>"2000-4500", | |
"4500-8000"=>"4500-8000", | |
"Over 8000"=>"Over 8000" | |
), | |
"required"=>true, | |
"memberslistcsv"=>true | |
)); | |
$fields[] = new PMProRH_Field( | |
"denomination", | |
"select", | |
array( | |
"label"=>"Denomination of your church.", | |
"profile"=>true, | |
"options"=>array( | |
"" => "- Choose One -", | |
"Adventist"=>"Adventist", | |
"Assembly of God"=>"Assembly of God", | |
"Baptist"=>"Baptist", | |
"Catholic"=>"Catholic", | |
"Charismatic"=>"Charismatic", | |
"Church of England"=>"Church of England", | |
"Church of God"=>"Church of God", | |
"Eastern"=>"Eastern", | |
"Orthodox Evangelical"=>"Orthodox Evangelical", | |
"Episcopal"=>"Episcopal", | |
"Lutheran"=>"Lutheran", | |
"Methodist"=>"Methodist", | |
"Nazarene"=>"Nazarene", | |
"Presbyterian"=>"Presbyterian", | |
"Pentecostal"=>"Pentecostal", | |
"Reformed"=>"Reformed", | |
"Other"=>"Other" | |
), | |
"required"=>true, | |
"memberslistcsv"=>true | |
)); | |
$fields[] = new PMProRH_Field( | |
"denomination_other", | |
"text", | |
array( | |
"label"=>"Other", | |
"size"=>40, | |
"profile"=>true, | |
"depends"=>array( | |
array('id'=>'denomination', 'value'=>'Other') | |
), | |
"memberslistcsv"=>true | |
)); | |
//add the fields into a new checkout_boxes are of the checkout page | |
foreach($fields as $field) | |
pmprorh_add_registration_field( | |
"checkout_boxes", | |
$field | |
); | |
//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