BuddyDev

Hide Logged In Users from all the listings( directory, search, members, friends list, widgets etc ) on BuddyPress Site

Do you want to hide the logged in users from all the listing on your BuddyPress site? Mihail asked me about it in a comment and I thought It is an interesting Idea.

The code below will hide the logged in users from

  • Members Directory
  • Other Users Friends List( when the logged in user is viewing it )
  • Members search
  • Group Members Listing
  • All the widgets( Who is online, Recently active members etc).

Please put the following code into bp-custom.php

That's it. Loging to your site and see if you are visible or not? Let me know in comments if you liked it, whether it worked for you or not ?

9 Responses to Hide Logged In Users from all the listings( directory, search, members, friends list, widgets etc ) on BuddyPress Site

  • BRAVO! Super fast!

    I've put it in theme functions.php and it works like charm!

    I believe people would use it a lot as a plugin …

    Thank you!!!

    (Only thing that is still to fix is the "count" in the members tabs. It counts the current user "me" as member also)

    Cheers!

    • Hi Mihail,
      Thank you.
      I left the count intentionally as It will cause issues with my other plugins like BP Limit Group Membership and BP Limit Groups Per User. Will put a plugin today..

      Thank you
      Brajesh

  • Hi @sbrajesh,

    Thanks for this great tips as usual, but what of if you just want to hide the current member that is viewing the members directory from the directory alone and not the rest?

    Currently BP will display you first in members directory if you are viewing it.

    It seems the support has improved greatly on this site so I will renew my membership soon.

    Thanks

    Naijaping

  • @sbrajesh,

    just what i needed but it make the person unsearchable which may be a little problem.

    regards

    • Hi Abbey,
      I have updated the gist to not hide users on search. Please check it here https://gist.github.com/sbrajesh/11038074

    • Hi abbey,

      Sine we both are implementing similar members listing behavior, can you please explain me the benefits of being able to search for myself? or as you mentioned, what could be the "little problem" if a logged in user becomes unsearchable?

      Thank you.

      Cheers!

  • Hi Brajesh,

    Is there a way to include in this code to hide specific user or specific role from specific listings (or all listings)?
    For example I don't want site-admin to be listed anywhere except in fiends or following (bp-follow plugin)…

    Thanks!

  • Hii
    How to approve
    user profile image by admin