Banner for General About Paid Memberships Pro Guide

I’ve been asked this simple question many times recently — “How do I display the current user’s membership level in my theme?” Well, here’s the very simple answer…

if(is_user_logged_in() && function_exists('pmpro_hasMembershipLevel') && pmpro_hasMembershipLevel())
{
global $current_user;
$current_user->membership_level = pmpro_getMembershipLevelForUser($current_user->ID);
echo 'Membership Level: ' . $current_user->membership_level->name;
}

Just paste this code wherever you want to display the current logged in user’s membership level name.


If you want to display more information about the current user, including a field generated by the Register Helper add on, or loop into another plugin such as BuddyPress to display this information on a user’s forum profile, please open a new topic on our member’s forum.

Adding the Recipe to Your Website

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.

Cover image from ebook 29 Nuggets of Wisdom Volume 1 - Sample Collection

Download the free ebook: Get 29 insights and ‘aha moments’ for new or veteran membership site business owners. Use these nuggets of wisdom to inspire or challenge you.



Was this article helpful?
YesNo