Forked from greathmaster/gist:49c5d81e87b1acd084fd590bee47a3e8
Last active
July 5, 2021 19:28
-
-
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
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 // 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