Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save dwanjuki/c3c12dd84d3b37d33e4cb0b09b9427aa to your computer and use it in GitHub Desktop.
Save dwanjuki/c3c12dd84d3b37d33e4cb0b09b9427aa to your computer and use it in GitHub Desktop.
Add user fields to the invoice page
<?php
/**
* This recipe adds user fields to the invoice page.
*
* You can add this recipe to your site by creating a custom plugin
* or using the Code Snippets plugin available for free in the WordPress repository.
* Read this companion article for step-by-step directions on either method.
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function add_user_fields_to_pmpro_invoice() {
global $current_user;
$field_a = get_user_meta( $current_user->ID, 'your_field_name', true );
$field_b = get_user_meta( $current_user->ID, 'another_field_name', true );
echo '<li><strong>Field A Label :</strong> ' . $field_a . '</li>';
echo '<li><strong>Field B Label :</strong> ' . $field_b . '</li>';
}
add_action( 'pmpro_invoice_bullets_bottom', 'add_user_fields_to_pmpro_invoice' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment