Last active
May 24, 2024 15:23
-
-
Save kimcoleman/51953b44607ac36aca7b6356aeb1aded to your computer and use it in GitHub Desktop.
This code will display the member badge on the BuddyPress Profile page using the bp_before_member_header_meta hook.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* my_pmpro_member_badge_display This code will display the member badge on the BuddyPress Profile page using the bp_before_member_header_meta hook. | |
* | |
* Add this code to your PMPro Customizations Plugin | |
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
* | |
*/ | |
function my_pmpro_member_badge_display( ) { | |
if ( function_exists( 'pmpromb_show_badge' ) && function_exists( 'pmpro_hasMembershipLevel' ) ) { | |
if ( pmpro_hasMembershipLevel( array( '1', '2' ), bp_displayed_user_id() ) ) { | |
pmpromb_show_badge( bp_displayed_user_id() ); | |
} | |
} | |
} | |
add_action( 'bp_before_member_header_meta', 'my_pmpro_member_badge_display' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It is possible to add the badge to thete members pages also using this function:
add_action( 'bp_directory_members_item', 'my_pmpro_member_badge_display' );