Skip to content

Instantly share code, notes, and snippets.

@greathmaster
Last active July 5, 2021 19:26
Show Gist options
  • Save greathmaster/49c5d81e87b1acd084fd590bee47a3e8 to your computer and use it in GitHub Desktop.
Save greathmaster/49c5d81e87b1acd084fd590bee47a3e8 to your computer and use it in GitHub Desktop.
/*
Remove "Membership Level" on the BuddyPress profile page, and instead only show the membership level name
*/
function my_pmpro_bp_show_level_on_bp_profile() {
if ( !function_exists('pmpro_getMembershipLevelForUser') ) {
return;
}
$level = pmpro_getMembershipLevelForUser(bp_displayed_user_id());
$show_level = get_option('pmpro_bp_show_level_on_bp_profile');
//Only show for levels 1, and 2.
$only_show = array(1,2);
if( $show_level == 'yes' && !empty( $level ) && in_array($level->id, $only_show)) {
?>
<div class="pmpro_bp_show_level_on_bp_profile">
<strong><?php echo $level->name; ?> </strong>
</div>
<?php
}
}
remove_filter( 'bp_profile_header_meta', 'pmpro_bp_show_level_on_bp_profile' );
add_filter( 'bp_profile_header_meta', 'my_pmpro_bp_show_level_on_bp_profile' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment