Created
August 2, 2014 18:36
-
-
Save bappi-d-great/9a6d265b3d74f4dcc5d6 to your computer and use it in GitHub Desktop.
Hide buddypress profile groups for WPMU membership (FREE version) Level
This file contains 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 | |
/* | |
* $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