Created
October 25, 2018 18:49
-
-
Save itsjusteileen/809f9796c786c8d9d90731101973677a to your computer and use it in GitHub Desktop.
PMPro Adding Registration Fields
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 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