Try my plugin here: https://buddypress.org/community/groups/buddypress-friendpress/ see this is what your after. After installation, and activation go to dashboard/settings/ bp friendpress and change the setting to current user / friends activity. Just be aware it also make buddypress specific pages private so only members can view them. make sure to read the readme.txt regarding group forums or sitewide forums and make changes appropriately. If you do not want the buddypress specific pages private you can go in the bp-friendpress.php file and comment out the part that says “The walled garden.” Hope this helps!
I think buddypress dont accept multi scope just only one scope,
try this shortcode, it work for me
/**
* comparator
*/
function cmp($a, $b) {
return strtotime($a->date_recorded) date_recorded);
}
/**
* show friends+groups+mentions actitivity in stream
*/
function bp_get_interests_activity($atts, $content = null){
$activities = null;
if ( is_user_logged_in() ) :
extract(shortcode_atts(array(
'max' => '20'
), $atts));
do_action( 'bp_before_activity_loop' );
global $activities_template;
//get last friends activity ( default 20)
bp_has_activities( 'scope=friends' );
$friends_activities = $activities_template->activities;
//get last groups activity ( default 20 )
bp_has_activities( 'scope=groups' );
$groups_activity = $activities_template->activities;
//get last mentions ( default 20 )
bp_has_activities( 'scope=mentions' );
$mentions_activity = $activities_template->activities;
$intersting_activity = array_merge($friends_activities, $groups_activity, $mentions_activity);
usort($intersting_activity, "cmp");
$activities_template->activities = $intersting_activity;
$activities_template->activity_count = $max;
$activities = '';
do_action( 'bp_after_activity_loop' );
endif;
return $activities;
}
add_shortcode('interests', 'bp_get_interests_activity');
and you can call it with this
echo do_shortcode('[interests max=20]');
this code, will join the friends + groups + mentions of the current user.
the only problem, it not a join from database, because the code do a join with last activiy from each scope ( i mean mybe we lose the chronologic order of some activity).
hope this help.
You can also look at the original plugin that Shawn has copied his code from: http://wpmu.org/create-a-better-community-experience-with-the-new-buddypress-friends-only-activity-stream-plugin/
There are also some earlier posts on here about how to achieve this.
hi @rogercoathup,
can you share with as, these posts about how to achieve this if you get the link please.
thanks advance.
That plugin does not work the way @fanoop requested. That plugin only shows friends activity, and not your own. Just to clarify this bp friendpress shows your own and friend only activity and has admin options. Thanks!
@shawn38. @djpaul @hnla @nuprn1 @pollyplummer
Did you make reference in the plugin to where you took your code from?
It’s really bad practice to take other developer’s code and not credit them.
the code i share work like that:
he extract :
– the last 20 activity of friends
– the last 20 activity of groups
– the last 20 activity of mentions
– he join all activities in one list
– order the activities by date
– he return the $max of activity
you can personlize the code to get more that 20 activites in each set.
@megainfo – my outline solution from the other threads is:
“If you have a look in the code for bp_has_activities(), you can
see how it’s implemented scope searching internally, and then create your own version:
e.g. for scope=>friends, it builds an array of the friend IDs and sets that array as the user_id element of the filter.
Therefore, you should be able to do the same in your template — create an array of friend IDs, add the users own ID to the array, and then pass the array as the user ID filter to bp_has_activities().”
Rich Fuller’s version: http://wpmu.org/create-a-better-community-experience-with-the-new-buddypress-friends-only-activity-stream-plugin/ takes an alternative approach.
There’s some coding involved, but either of those solutions should help you.
@megainfo hello, I tried to use your code but at the time of ordering by date, but does not take into account the date of comments to an activity, you have no idea how I could fix it