Last active
October 22, 2025 06:09
-
-
Save JarrydLong/c33e312c8504532a39c2fd4d58877da8 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
| // Make all fields editable on the orders page in the PMPro dashboard | |
| add_filter( 'pmpro_orders_read_only_fields', function( $fields ) { | |
| return array(); | |
| } ); | |
| /** | |
| * Register the Stripe Customer ID field for admin profiles | |
| */ | |
| function my_pmpro_add_stripe_customerid_field() { | |
| // Ensure PMPro_Field class exists (PMPro 2.11+) | |
| if ( ! class_exists( 'PMPro_Field' ) ) { | |
| return; | |
| } | |
| // Don't load at checkout | |
| if ( ! empty( $_REQUEST['pmpro_level'] ) ) { | |
| return; | |
| } | |
| $fields = array(); | |
| // Define the field | |
| $fields[] = new PMPro_Field( | |
| 'pmpro_stripe_customerid', // meta key | |
| 'text', // field type | |
| array( | |
| 'label' => 'Stripe Customer ID', | |
| 'size' => 40, | |
| 'profile' => 'admins', // visible to admins only | |
| 'memberslistcsv' => false, // exclude from CSV exports | |
| 'required' => false, | |
| 'profile' => 'only_admin', | |
| ) | |
| ); | |
| // Add field to the profile section (admin side) | |
| // Add all of our fields into that group. | |
| foreach ( $fields as $field ) { | |
| pmpro_add_user_field( | |
| 'More Information', // Which group to add to. | |
| $field // PMPro_Field object | |
| ); | |
| } | |
| } | |
| add_action( 'init', 'my_pmpro_add_stripe_customerid_field' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment