Skip to content

Instantly share code, notes, and snippets.

@femiyb
Last active April 9, 2019 09: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 femiyb/a094b5e8a27fc3d1f017980b793fe196 to your computer and use it in GitHub Desktop.
Save femiyb/a094b5e8a27fc3d1f017980b793fe196 to your computer and use it in GitHub Desktop.
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();
//member_number field
$fields[] = new PMProRH_Field(
"member number",
"text",
array(
"label"=>"Membership #",
"size"=>12,
"profile"=>only,
"required"=>false,
"memberslistcsv" => true,
)
);
//gender field
$fields[] = new PMProRH_Field(
'gender', // input name, will also be used as meta key
'select', // type of field
array(
'options' => array( // <option> elements for select field
'Female' => 'Female', // <option value="Female">Female</option>
'Male' => 'Male', // <option value="Male">Male</option>
'Gender Non-Conforming' => 'Gender Non-Conforming', // <option value="Gender Non-Conforming">Gender Non-Conforming</option>
'I prefer not to say' => 'I prefer not to say', // <option value="I prefer not to say">I prefer not to say</option>
),
"profile" => true,
"memberslistcsv" => true,
"required" => true,
)
);
//member_birthdate field
$fields[] = new PMProRH_Field(
"birth date",
"date",
array(
"label"=>"Birth Date",
"size"=>50,
"profile"=>true,
"required"=>false,
"memberslistcsv" => true,)
);
//cell_area field
$fields[] = new PMProRH_Field(
"cell",
"text",
array(
"label"=>"Cell Phone #",
"size"=>50,
"profile"=>true,
"required"=>false,
"memberslistcsv" => true,)
);
//income field
$fields[] = new PMProRH_Field(
'community', // input name, will also be used as meta key
'select', // type of field
array(
'options' => array( // <option> elements for select field
'' => '', // blank option - cannot be selected if this field is required
'Aberdeen' => 'Aberdeen', // <option value="Aberdeen">Aberdeen</option>
'Admirals Cove' => 'Admirals Cove', // <option value="Admirals Cove">Admirals Cove</option>
'Atlantis' => 'Atlantis', // <option value="Atlantis">Atlantis</option>
'Avalon Estates' => 'Avalon Estates', // <option value="Avalon Estates">Avalon Estates</option>
'Ballen Isles' => 'Ballen Isles', // <option value="Ballen Isles">Ballen Isles</option>
'Banyan Springs' => 'Banyan Springs', // <option value="Banyan Springs">Banyan Springs</option>
'Bellaggio' => 'Bellaggio', // <option value="Bellaggio">Bellaggio</option>
'Boca Grove' => 'Boca Grove', // <option value="Boca Grove">Boca Grove</option>
'Boca Pointe' => 'Boca Pointe', // <option value="Boca Pointe">Boca Pointe</option>
'Breakers West' => 'Breakers West', // <option value="Breakers West">Breakers West</option>
'Buena Vida' => 'Buena Vida', // <option value="Buena Vida">Buena Vida</option>
'Canyon Isles' => 'Canyon Isles', // <option value="Canyon Isles">Canyon Isles</option>
'Casa Costa' => 'Casa Costa', // <option value="Casa Costa">Casa Costa</option>
'Cascade Lakes' => 'Cascade Lakes', // <option value="Cascade Lakes">Cascade Lakes</option>
'Cascades' => 'Cascades', // <option value="Cascades">Cascades</option>
'Century Village' => 'Century Village', // <option value="Century Village">Century Village</option>
'Club Royale' => 'Club Royale', // <option value="Club Royale">Club Royale</option>
'Coral Lakes' => 'Coral Lakes', // <option value="Coral Lakes">Coral Lakes</option>
'Eastpointe' => 'Eastpointe', // <option value="Eastpointe">Eastpointe</option>
'Evergreen' => 'Evergreen', // <option value="Evergreen">Evergreen</option>
'Fountains' => 'Fountains', // <option value="Fountains">Fountains</option>
'Frenchmans Creek' => 'Frenchmans Creek', // <option value="Frenchmans Creek">Frenchmans Creek</option>
'Glen Eagles' => 'Glen Eagles', // <option value="Glen Eagles">Glen Eagles</option>
'Golden Lakes' => 'Golden Lakes', // <option value="Golden Lakes">Golden Lakes</option>
'Golden Lakes Village' => 'Golden Lakes Village', // <option value="Golden Lakes Village">Golden Lakes Village</option>
'Hunters Run' => 'Hunters Run', // <option value="Hunters Run">Hunters Run</option>
'Ibis' => 'Ibis', // <option value="Ibis">Ibis</option>
'Indian Spring' => 'Indian Spring', // <option value="Indian Spring">Indian Spring</option>
'Ironhorse' => 'Ironhorse', // <option value="Ironhorse">Ironhorse</option>
'Jonathans Landing' => 'Jonathans Landing', // <option value="Jonathans Landing">Jonathans Landing</option>
'Lakeridge Falls' => 'Lakeridge Falls', // <option value="Lakeridge Falls">Lakeridge Falls</option>
'Lakes of Delray' => 'Lakes of Delray', // <option value="Lakes of Delray">Lakes of Delray</option>
'Land of the Presidents' => 'Land of the Presidents', // <option value="Land of the Presidents">Land of the Presidents</option>
'Marabella' => 'Marabella', // <option value="Marabella">Marabellan</option>
'Mirasol' => 'Mirasol', // <option value="Mirasol">Mirasol</option>
'Ocean Ridge' => 'Ocean Ridge', // <option value="Ocean Ridge">Ocean Ridge</option>
'Old Port Cove' => 'Old Port Cove', // <option value="Old Port Cove">Old Port Cove</option>
'Palm Beach Polo' => 'Palm Beach Polo', // <option value="Palm Beach Polo">Palm Beach Polo</option>
'PGA National' => 'PGA National', // <option value="PGA National">PGA National</option>
'Pine Ridge North' => 'Pine Ridge North', // <option value="Pine Ridge North">Pine Ridge North</option>
'Polo West Estates' => 'Polo West Estates', // <option value="Polo West Estates">Polo West Estates</option>
'Porta Bella East' => 'Porta Bella East', // <option value="Porta Bella East">Porta Bella East</option>
'Prosperity Harbor' => 'Prosperity Harbor', // <option value="Prosperity Harbor">Prosperity Harbor</option>
'Prosperity Oaks' => 'Prosperity Oaks', // <option value="Prosperity Oaks">Prosperity Oaks</option>
'Rainberry Lake' => 'Rainberry Lake', // <option value="Rainberry Lake">Rainberry Lake</option>
'Riverbridge' => 'Riverbridge', // <option value="Riverbridge">Riverbridge</option>
'Rivers Landing' => 'Rivers Landing', // <option value="Rivers Landing">Rivers Landing</option>
'Riverwalk' => 'Riverwalk', // <option value="Riverwalk">Riverwalk</option>
'San Marco' => 'San Marco', // <option value="San Marco">San Marco</option>
'Saturnia' => 'Saturnia', // <option value="Saturnia">Saturnia</option>
'Southpoint' => 'Southpoint', // <option value="Southpoint">Southpoint</option>
'Stonegate' => 'Stonegate', // <option value="Stonegate">Stonegate</option>
'The Bluffs' => 'The Bluffs', // <option value="The Bluffs">The Bluffs</option>
'The Classic at WPB' => 'The Classic at WPB', // <option value="The Classic at WPB">The Classic at WPB</option>
'The Harbors' => 'The Harbors', // <option value="The Harbors">The Harbors</option>
'Traditions' => 'Traditions', // <option value="Traditions">Traditions</option>
'Valencia Cove' => 'Valencia Cove', // <option value="Valencia Cove">Valencia Cove</option>
'Valencia Pointe' => 'Valencia Pointe', // <option value="Valencia Pointe">Valencia Pointe</option>
'Venetian Isles' => 'Venetian Isles', // <option value="Venetian Isles">Venetian Isles</option>
'Village Walk' => 'Village Walk', // <option value="Village Walk">Village Walk</option>
'Villaggio' => 'Villaggio', // <option value="Villaggio">Villaggio</option>
'Woodland Lakes' => 'Woodland Lakes', // <option value="Woodland Lakes">Woodland Lakes</option>
'Woods Walk' => 'Woods Walk', // <option value="Woods Walk">Woods Walk</option>
'Wycliffe' => 'Wycliffe', // <option value="Wycliffe">Wycliffe</option>
'Other' => 'Other', // <option value="Other">Other</option>
),
"profile" => true,
"memberslistcsv" => true,
"required" => true,
)
);
//precinct_area field
$fields[] = new PMProRH_Field(
"precinct area",
"text",
array(
"label"=>"Your Voting Precinct Area (look up districts here: https://www.pbcelections.org)",
"size"=>50,
"profile"=>true,
"required"=>false,
"memberslistcsv" => true,)
);
//income field
$fields[] = new PMProRH_Field(
'income', // input name, will also be used as meta key
'select', // type of field
array(
'options' => array( // <option> elements for select field
'' => '', // blank option - cannot be selected if this field is required
'lessthan24000' => '&lt; $24,000', // <option value="lessthan24000">&lt; $24,000</option>
'24000to50000' => '$24,000-$50,000', // <option value="24000to50000">$24,000-$50,000</option>
'50000to85000' => '$50,000-$85,000', // <option value="50000to85000">$50,000-$85,000</option>
'85000to125000' => '$85,000-$125,000', // <option value="85000to125000">85,000-$125,000</option>
'125000to250000' => '$125,000-$250,000', // <option value="125000to250000">$125,000-$250,000</option>
'morethan250000' => '&gt; $250,000', // <option value="morethan250000">&gt; $250,000</option>
),
"profile" => true,
"memberslistcsv" => true,
"required" => false,
)
);
//add_a_household_member field
$fields[] = new PMProRH_Field(
'Adding a Household Member?', // input name, will also be used as meta key
'select', // type of field
array(
'options' => array( // <option> elements for select field
'' => '', // blank option - cannot be selected if this field is required
'Yes' => 'Yes', // <option value="Yes">Yes</option>
),
"profile" => false,
"memberslistcsv" => true,
"required" => false,
)
);
$fields[] = new PMProRH_Field(
"household member name",
"text",
array(
"label"=>"Enter additional Household Member's Name",
"size"=>50,
"profile"=>true,
"required"=>false,
"memberslistcsv" => true,
)
);
$fields[] = new PMProRH_Field(
"How did you hear about us",
"text",
'referral', // input name, will also be used as meta key
'select', // type of field
array(
'options' => array( // <option> elements for select field
'' => '', // blank option - cannot be selected if this field is required
'Facebook' => 'Facebook', // <option value="Facebook">Facebook</option>
'Friend' => 'Friend', // <option value="Friend">Friend</option>
'Website' => 'Website', // <option value="Website">Website</option>
'Twitter' => 'Twitter', // <option value="Twitter">Twitter</option>
'Other' => 'Other', // <option value="Other">Other</option>
),
"profile" => true,
"memberslistcsv" => true,
"required" => false,
)
);
/*
Define the global array below for your main accounts and sponsored levels.
Array keys should be the main account level.
*/
global $pmprosm_sponsored_account_levels;
$pmprosm_sponsored_account_levels = array(
//set 1 seat at checkout
3 => array(
'main_level_id' => 3, //redundant but useful
'sponsored_level_id' => array(7), //array or single id
'seats' => 1
),
4 => array(
'main_level_id' => 4, //redundant but useful
'sponsored_level_id' => array(7), //array or single id
'seats' => 1
),
);
//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
);
//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