Skip to:
Content
Pages
Categories
Search
Top
Bottom

[Resolved] How To Limit/Hide The "Friends" Tab Only To Account Owner & Admin?


  • rizingsun
    Participant

    @rizingsun

    Greetings folks.

    I would like to limit access to the “Friends” tab on a user’s page to the account owner and the admin?

    Plus how can I hide the friends tab (in the same way “Messages” and “Settings” are only viewable for an account owner)?

    Any idea how to do that?

    For example, when you click on a BP user’s page, you see the “Activity”, “Profile”, “Friends, “Groups” tabs.

    How can I remove the “Friends” tab from that area, and only allow access to the account owner (like “Messages” and “Settings”?

    This is basically a privacy issue that I’m worried about.

    Any help would be appreciated.

Viewing 13 replies - 1 through 13 (of 13 total)

  • bp-help
    Participant

    @bphelp

    You can use this tutorial http://wpmu.org/how-to-add-profile-privacy-to-buddypress/
    its meant for profiles but it can be adapted for friends. Follow it exactly but instead of putting

    3. Edit your theme file to include the friendship check:
    To restrict profile info, open up /members/single/profile.php and add this at the top of the page:

    add that code in 3. instead to /members/single/friends.php

    You may also want to change the test in 2. step to:
    You must be friends in order to access users friends.


    rizingsun
    Participant

    @rizingsun

    Thanks @bphelp !

    I’m trying to make it so that a user’s “Friends” tab is only visible to that specific user (like “Settings” and “Messages”).

    I think your advice would still enable a user’s friends to see their other friends.

    Is there any way to make it so that the a user’s “Friends” tab is only visible to said user?


    bp-help
    Participant

    @bphelp

    I already tested the advice I gave you and if you click on a users friends tab that you are not friends with it displays the message “You must be friends in order to access users friends.”
    I am sure there is someway to build upon that function so it only displays the friends tab if you are friends with that user.


    rizingsun
    Participant

    @rizingsun

    Thanks @bphelp

    But my intent is that the “Friends” tab should not be visible to anyone except the account user (like “Settings” and “Messages” tabs are only visible to an account user).

    Even if you’re friends with a user, you should not be able to see his other friends.

    Complete privacy.

    I would like to make the “Friends” tab a private setting. Is there any way to do that?


    Brajesh Singh
    Participant

    @sbrajesh

    You Can put this code in your bp-custom.php and It will take care of your issue

    `
    add_action(‘bp_friends_setup_nav’,’bpdev_custom_hide_friends_if_not_self’);

    function bpdev_custom_hide_friends_if_not_self(){
    if(bp_is_my_profile()|| is_super_admin())
    return ;

    bp_core_remove_nav_item(‘friends’);

    }

    `

    hope that helps.


    rizingsun
    Participant

    @rizingsun

    Wow @sbrajesh !

    That seems to work! Thank you very much!


    Brajesh Singh
    Participant

    @sbrajesh

    No problem. You are most welcome 🙂


    bp-help
    Participant

    @bphelp

    Great job @sbrajesh !


    Ishanna
    Participant

    @ishanna

    Hallo @sbrajesh !

    I tried use code:

    
    add_action(‘bp_friends_setup_nav’,'bpdev_custom_hide_friends_if_not_self’);
    
    function bpdev_custom_hide_friends_if_not_self(){
    if(bp_is_my_profile()|| is_super_admin())
    return ;
    
    bp_core_remove_nav_item(‘friends’);
    
    }
    
    

    I copied and pasted the code into the ‘bp_custom.php’ file but it did not work for me.
    I’m new to wordpress, html, php and css but I seem to find my way til now. Some advise please? I really need this option to work and I can’t find a plugin that cover this.

    Kind regards,


    aces
    Participant

    @aces

    @ishanna

    Could your problem be a copy/paste error?

    You appear to be using ‘ and ’ – they should all be '


    Ishanna
    Participant

    @ishanna

    @aces

    Yes! Thank you, it works. 😀


    full moon
    Participant

    @leighgregg

    Hello,

    Is this still a viable script? I have tried it, but I get no effect.

    Pobpob.com

    I have changed the friends to connections in translation, but I guess that isn’t going to effect the core elements here.

    Many Thanks

    Leigh


    danbp
    Moderator

    @danbp

    @leighgregg,

    you jumped into an over 18 mounths old thread titled How To Limit/Hide The “Friends” Tab and you speak about translation….
    Please open a new topic and give details about your issue, BP version and theme.

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘[Resolved] How To Limit/Hide The "Friends" Tab Only To Account Owner & Admin?’ is closed to new replies.
Skip to toolbar