Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save MaryOJob/4b3d94db57517df103ddc3d1feb882f3 to your computer and use it in GitHub Desktop.
Save MaryOJob/4b3d94db57517df103ddc3d1feb882f3 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
<?php // Do not copy this line
/*
* Remove "Membership Level" on the BuddyPress profile page, and instead only show the membership level name
* Add the code below to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-* * * customizations/
*/
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