Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save itsjusteileen/809f9796c786c8d9d90731101973677a to your computer and use it in GitHub Desktop.
Save itsjusteileen/809f9796c786c8d9d90731101973677a to your computer and use it in GitHub Desktop.
PMPro Adding Registration Fields
<?php
/**
* Plugin Name: PMPro Customizations
* Author: Paid Memberships Pro
* Description: Custom Fields for PMPro Registration Process. Install along with Register Helper Add On.
*/
function initialize_pmprorh_fields() {
// 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(
'telegram_username',
'text',
array(
'label' => 'Telegram Username',
'id' => 'telegram-username',
'size' => 40,
'profile' => true,
'required' => true,
)
);
$fields[] = new PMProRH_Field(
'telegram_chat_id',
'text',
array(
'label' => 'Telegram Chat ID',
'id' => 'telegram-chat-id',
'size' => 40,
'profile' => true,
'required' => true,
)
);
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', 'initialize_pmprorh_fields' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment