Site icon Anthony Carbon

How to merge your personal and friends activity stream using Buddypress WordPress plugin?

Hi guys, having a trouble on how to merge your personal and friends activity stream using Buddypress WordPress plugin? Codes below may help you to solve the issue.

The codes will apply only in your personal activity but it is includes the friends activity also.

$user_id = '1,2,3'; // this is the list of user ID including your current ID.
$querystring = '';

// display only on your personal page, not in mention or friends activity

if($bp->current_component == 'activity' && $bp->current_action == 'just-me' ){
   $querystring = "&user_id={$user_id}&action=rtmedia_update,activity_update,friendship_created&scope=&just-me,friendssort=DESC";
}

For more details and additional parameters, read it here https://codex.buddypress.org/developer/loops-reference/the-activity-stream-loop/.

global $bp;

$user_id = '1,2,3'; // this is the list of user ID including your current ID.
$querystring = '';

// display only on your personal page, not in mention or friends activity

if($bp->current_component == 'activity' && $bp->current_action == 'just-me' ){
   $querystring = "&user_id={$user_id}&action=rtmedia_update,activity_update,friendship_created&scope=&just-me,friendssort=DESC";
}
?>
<?php if ( bp_has_activities( bp_ajax_querystring( 'activity' ) . $querystring ) ) : ?>

Copy and paste this code to activity-loop.php. It is better to override. See this article on how to override Buddypress template override https://webdevstudios.com/2015/06/02/creating-custom-templates-for-buddypress/.

Exit mobile version