Forked from JarrydLong/pmpro-membership-profile-display.php
Last active
August 5, 2021 07:37
-
-
Save femiyb/f3c52c84e269731f7fd2d7fe5cc56484 to your computer and use it in GitHub Desktop.
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 | |
/* | |
* Display Member Number on Edit Profile Page for Admin | |
* | |
*/ | |
// We have to put everything in a function called on init, so we are sure Register Helper is loaded. | |
function my_pmprorh_init_member_number() { | |
// 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( | |
'member_number', // input name, will also be used as meta key | |
'readonly', // type of field | |
array( | |
'label' => 'Member Number', // custom field label | |
'size' => 40, // input size | |
'class' => 'member_number', // custom class | |
'profile' => 'only_admin', // show in user profile for admins | |
) | |
); | |
// 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_member_number' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment