Skip to content

Instantly share code, notes, and snippets.

@kimwhite
Last active September 22, 2025 15:16
Show Gist options
  • Save kimwhite/f5e142b87e15e2b66e72c979626f90b3 to your computer and use it in GitHub Desktop.
Save kimwhite/f5e142b87e15e2b66e72c979626f90b3 to your computer and use it in GitHub Desktop.
<?php // do not copy this line.
/**
* Show member email address and WordPress User ID on Membership Card.
* Requires the Membership Card Add On
*
* 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 my_show_member_email_and_id_on_card( $user ) {
// Only show if the user has at least one membership level.
if ( ! pmpro_hasMembershipLevel( '', $user->ID ) ) {
return;
}
// Display email address.
echo '<p><strong>Email:</strong> ' . esc_html( $user->user_email ) . '</p>';
// Display WordPress User ID.
echo '<p><strong>Member ID:</strong> ' . intval( $user->ID ) . '</p>';
}
add_action( 'pmpro_membership_card_after_card', 'my_show_member_email_and_id_on_card' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment