Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Hide buddypress profile groups for WPMU membership (FREE version) Level
<?php
/*
* $restricted_level is the level ID that needs to be restricted to see BP profile fields
* .bp-widget.contact-details here .contact-details should be the class name of the profile group
*/
add_action( 'wp_head', 'hide_bp_field' );
function hide_bp_field() {
if( is_user_logged_in() ){
$restricted_level = 1;
$current_user = wp_get_current_user();
$user_object = new M_Membership($current_user->ID);
$userlevels = $user_object->get_level_ids();
foreach( $userlevels as $userlevel ){
if( $userlevel->level_id == $restricted_level ){
?>
<style>
.bp-widget.contact-details{
display: none;
}
</style>
<?php
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.