you can’t really hid the entire profile out of the box but you can hide most of the fields and info by setting the default visibility in the profile field setup screens.
My portal theme only lets admin / editor users view all members profiles or other users view other profiles if they are friends. If you want more info on how I did this let me know.
@mossyoak How did you accomplish that?
I need a solution that allows only the user (and the admin) to see their own profile. I need it so members not involved (@mentioned) in conversations on activity strea cannot see them.
Only the members involved and the admin should be able to see the conversation.
Thanks,
Adam
I use a WordPress theme I made to accomplish this. I’ve been asking on the forums if anyone wants me to release it for free but I’ve had no response/ interest from anyone yet. https://buddypress.org/support/topic/flat-portal-client-area-child-theme-of-twenty-thirteen/
It has all the functionality you want.
I made it so that only admin can see all the users and only friends can see each others profiles if not admin.
I mis-read your question sorry. I found a solution which lets users only view other users profiles if they are a friend of that user. The admin can see all members regardless of them being his/her friend.
I put the function in my functions.php:
// BuddyPress create conditional if friend
function flatportal_bp_is_friend() {
global $bp;
if (friends_check_friendship( bp_loggedin_user_id(), bp_displayed_user_id() ) )
return true;
return false;
}
and created a custom header file with this at the top:
// Global $bp variable holds all of our info
global $bp;
// The user ID of the currently logged in user
$current_user_id = (int) trim($bp->loggedin_user->id);
// The author that we are currently viewing
$author_id = (int) trim($bp->displayed_user->id);
if ($current_user_id !== $author_id && !current_user_can('delete_others_pages') && !flatportal_bp_is_friend() )
{
wp_redirect( home_url() );
exit();
}
Then in header php (using multiple headers)
elseif ( bp_is_user()):
get_header('restrict-profile');
If they are not a friend they will be redirected to the home page or wherever you want them. I suppose you could re-direct them to a “you are not a friend of this user” page if you wanted.
You can use a plugin like s2Member: http://www.s2member.com/
Not as clean as hard-coding it, but this can potentially solve your problem. You could use it to redirect users off of profiles you don’t want them to see.
Otherwise you’ll need to hard code it using a combo of IF statements.
// Check if user is logged in
if ( is_user_logged_in() )
// Check if user is on his/her own profile while logged in
if ( bp_is_my_profile() )