Skip to:
Content
Pages
Categories
Search
Top
Bottom

How to hide the friends tab from other users while displaying it to owner and admin only

  • @sameeraperera

    Member

    Hi,
    I want to hide the “Friends” tab on the users profile page to all other users except for admin and owner of the profile only. I want this to work the way Messages and Settings tabs work => If another user types
    `http: // [site] / [username] / messages`
    BP shows an error message saying the user does not have access to the page.

    If I use (with !bp_is_my_profile()),
    `bp_core_remove_nav_item(‘friends’)`
    it just shows a 404 type page for the `http: // [site] / [username] / friends`.

    I tried
    `$bp->bp_nav = false;`
    but that doesn’t prevent the user from seeing the friends by going to `http: // [site] / [username] / friends`

    I prevent the user from seeing the friends list by editing the members/home.php file. But, I’d like to use the same mechanism that settings and messages pages use.
    I looked at messages/single.php, but didn’t see anything that could be taking care of this logic.

    Can anybody help please?

Viewing 4 replies - 1 through 4 (of 4 total)
  • @modemlooper

    Moderator

    Install BuddyPress Profile Privacy plugin

    @modemlooper

    Moderator

    Just read you don’t want to edit home.php. There isn’t a filter for privacy like there is with messages for showing profile sections. Messages and xprofile fields has logic for output and can be filtered but the actual page needs a code edit.

    @sameeraperera

    Member

    Thanks for your reply. I don’t mind editing home.php because I’m doing it in my theme file. I’ve figured out a way to prevent the friends tab to other users. Just trying to figure out the way it’s done for messages, so that I’m not reinventing anything.

    @lavishdhand

    Participant

    Hi!

    Can you kindly share how did you actually do this? I need the same for my site.

    1. How did you prevent the friends tab to other users?
    2. Have you figured out the way for messages?

    regards

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How to hide the friends tab from other users while displaying it to owner and admin only’ is closed to new replies.
Skip to toolbar