Skip to:
Content
Pages
Categories
Search
Top
Bottom

How to display follow button only on specific profiles?

  • Avatar of soft_tales
    soft_tales
    Member

    @soft_tales

    Is there a way you can show the follow button only on a particular profile, as opposed to it appearing on the profile of all the users on the buddypress site.

Viewing 1 replies (of 1 total)
  • Avatar of Andrew Tegenkamp
    Andrew Tegenkamp
    Participant

    @andrewteg

    The issue is it’s a different function for every “Follow” button, so you’d have to do it in quite a few places. But here’s one idea if you’re interested… check out bp-follow-hooks.php and look for `function bp_follow_add_profile_follow_button`
    this is the function that shows that button and you can see it returns false if the user is not logged in or it is your own profile or there is no displayed user id. I’d say add your logic there. If you have a list of ID numbers you want to be able to be followed, then add something like this:

    `if ($bp->displayed_user_id != 1 || $bp->displayed_user_id != 2) return false;`

    That says if it’s not viewing user 1 or user 2, then don’t show the button. You’d have to add this in a few other spots probably to get rid of the Follow button on things like the Member Directory. If that works and you want to keep going but need a hand, let me know.

Viewing 1 replies (of 1 total)

You must be logged in to reply to this topic.