Skip to content

Instantly share code, notes, and snippets.

@kerijacoby
Created February 9, 2022 21:35
Show Gist options
  • Save kerijacoby/d689b93edc65d583cee2db4f5675c866 to your computer and use it in GitHub Desktop.
Save kerijacoby/d689b93edc65d583cee2db4f5675c866 to your computer and use it in GitHub Desktop.
PMPro Register Helper Add Text Field
<?php
/*
* Add Additional Register Helper field for: Stage/ Zoom Name
* Save All To User Profile Page
* Applies To All Levels
*/
// We have to put everything in a function called on init, so we are sure Register Helper is loaded.
function pmpro_register_helper_add_fields() {
// Don't break if Register Helper is not loaded.
if ( ! function_exists( 'pmprorh_add_registration_field' ) ) {
return false;
}
// Define the default fields array.
$fields = array();
// Stage or Zoom name.
$fields[] = new PMProRH_Field(
'user',
'text',
array(
'label' => 'Stage/Zoom Name',
'hint' => 'Please enter the name you would like to be called for performances and/or Zoom sessions.',
'class' => 'user',
'profile' => true,
'required' => true,
)
);
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', 'pmpro_register_helper_add_fields' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment