Buddypress Profile privacy for non-friends
-
Hi,
i was looking around for a privacy solution in buddypress. Means, that a user will not be able to see a non friend’s profile. There is a plugin called “BuddyPress Profile Privacy” that work great for some people. However for me and for many other the plugin gives error and i couldn’t find a fix for it.
i did manage to find a solution that for now seems to work for me. the original function of the function below i found here (http://premium.wpmudev.org/forums/topic/additional-buddypress-profile-privacy-settings) thanks to Richie_KS. the original function direct a user to a different page (non-friend.php) when he is trying to see a non friend profile. which can work just fine. However, i changed the function and now if i will go to a non friend page i will see his picture , “Add Friend” button and “Send private message” button. but no profile information will be displayed. This way i can also choose in which pages to block the information. (profile , activity , blogs…..)few simple steps :
1) paste this function in your function,php :
`
//
check if member is a friend
//function bp_displayed_user_is_friend() {
global $bp;
if ( bp_is_profile_component() || bp_is_member() ) {
if ( (‘is_friend’ != BP_Friends_Friendship::check_is_friend( $bp->loggedin_user->id, $bp->displayed_user->id )) && (bp_loggedin_user_id() != bp_displayed_user_id()) )
if ( !is_super_admin( bp_loggedin_user_id() ) )return true;
}
}
`2) i created a template file called “not-friend.php” where i put the message i want to be displayed . this is how mine looks like :
`
This information is avaliable only for friends
`
simple!!
* i uploaded the file to the buddypress theme folder under /members/single/
2) now you can go to the pages you want to make private (pages found in buddypress theme folder under /members/single) and add this to the top of the page:
`
`
//////////////////////////////////////////////////////
here goes the original information of the page.
///////////////////////////////////////////////////////and add this below the information( should be at the bottom of the page):
``
as for now it works great for me. if any of you try it and find something wrong please let me know.
- The topic ‘Buddypress Profile privacy for non-friends’ is closed to new replies.