Last active
July 5, 2021 19:26
-
-
Save greathmaster/49c5d81e87b1acd084fd590bee47a3e8 to your computer and use it in GitHub Desktop.
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
/* | |
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