Skip to content

Instantly share code, notes, and snippets.

@kimcoleman
Created February 7, 2018 14:10
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 kimcoleman/eecde9ea7d65e7d4187e022f769cc235 to your computer and use it in GitHub Desktop.
Save kimcoleman/eecde9ea7d65e7d4187e022f769cc235 to your computer and use it in GitHub Desktop.
Register Helper field for a select2 element for Interests for thread by maxk97
<?php
function my_pmprorh_after_email_init() {
//don't break if Register Helper is not loaded
if( !function_exists( 'pmprorh_add_registration_field') ) {
return false;
}
//define the fields
$fields_after_email = array();
$fields_after_email[] = new PMProRH_Field(
'inter',
'select2',
array(
'label' => 'Interests',
'profile' => true,
'required' => false,
'memberslistcsv' => true,
'options' =>
array(
'' => '',
'athletics' => 'Athletics',
'basketball' => 'Basketball',
'boxing' => 'Boxing',
'climbing' => 'Climbing',
'cricket' => 'Cricket',
'cycling' => 'Cycling',
'gym' => 'GYM',
'football' => 'Football',
'golf' => 'Golf',
'hockey' => 'Hockey',
'motocross' => 'Motocross',
'rugby' => 'Rugby',
'running' => 'Running',
'skate' => 'Skate',
'swimming' => 'Swimming',
'tennis' => 'Tennis',
'watersports' => 'Water Sports',
'wintersports' => 'Winter Sports',
),
)
);
//add the fields in the after_email area of the checkout page
foreach( $fields_after_email as $field ) {
pmprorh_add_registration_field("after_email", $field);
}
}
add_action( 'init', 'my_pmprorh_after_email_init' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment