BuddyDev

Make your BuddyPress Sitewide Activity Stream Friends Only

By default, the site wide activity stream on a BuddyPress site contains all the updates/activities from the whole site. If your site is aimed at being more social type, you may want to make this page list friends only activity, to provide a more personalized feeling. It was asked on our Forum by Israel, and here I am presenting the code to you all.

Put this code in your bp-custom.php or your theme's functions.php and the sitewide activity stream will only list activities from current user and his/her friends.

 

 

 

9 Responses to Make your BuddyPress Sitewide Activity Stream Friends Only

  • How can I make BuddyPress Sitewide Activity Stream list followers only activity. What is the code that will support the buddypress follow plugin.

  • Does this snippet support the users I'm following as well, or how would I modify it to also show the activities of the people I'm following?

    • Hi Nathan,
      This snippet is for friends. It can be easily modified to use with the follow plugin.
      You will need to use bp_get_following_ids instead of the friends_get_friend_user_ids
      ash shown here

      https://github.com/r-a-y/buddypress-followers/blob/master/_inc/bp-follow-functions.php#L314

      If you want me to put the complete code, please do let me know. I will post that.

      Thank you
      Brajesh

      • Hi, the above code works pretty well. But I even want to display all buddy press members activity in a page called global page. Is this possible to display only me and friends activity is one page and in other page all buddy press member activities..

  • NM #

    Hi Brajesh, when there is only 1 friend or 1 follower connection…there is an error –
    array_push() expects parameter 1 to be array. What do you suggest?

    • Hi NM,
      I am not sure about the follower but the function "friends_get_friend_user_ids" will always return an array even when there are no friends. Please do check if something is filtering and causing any issue.