skip to Main Content

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.

enter image description here

enter image description here

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


  1. Try:

    $user_id = bp_get_member_user_id();
    
    Login or Signup to reply.
  2. About your Question to input in user profile, put this

      add_action('bp_before_member_header_meta', 'pro_member_badge'); 
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search