I am using BuddyBoss and Paid Membership Pro, I have installed the Paid Memberships Pro – BuddyPress & BuddyBoss Add On plugin too.
In PMPRO I have only one plan with ID 2.
I want to add on the members list and on the profile page a badge that says PRO only for users that have active the PMPRO plan.
I have tried this
function pro_member_badge () {
$user_id = get_current_user_id();
if(pmpro_hasMembershipLevel ('2', $user_id)) {
?>
<span class='pro-member-badge' data-balloon-pos="up" data-balloon="Pro Member">
<img src="https://ecastify.com/wp-content/uploads/2022/05/pro-budge.png">
</span>
<?php
}
else {
?>
<span class='pro-member-badge' data-balloon-pos="up" data-balloon="Pro Member">
<p>No Membership</p>
</span>
<?php
}
}
add_action( 'bp_member_members_list_item', 'pro_member_badge' );
// add_action( 'bp_profile_field_item', 'pro_member_badge' );
But this gets the current user subscription and adds it everywhere.
I want to check every users subscription and show the badge only to the users with active the plan with ID 2.
Any ideas?
Thanks!
Sry about my English and my code, they are bad 😀
2
Answers
Try:
About your Question to input in user profile, put this