Filtering out Activity Stream stuff
-
This is a simple rehash of some old code by @nuprn1 (thanks Rich), and filters out various activity messages to keep the stream from clogging up. Put the following in your theme’s functions.php file, and modify as desired;
// Remove (hide) various activities from streams.
function my_hidden_activities($a, $activities) {
//if admin we want to know
//if (is_site_admin())
// return $activities;$nothanks = array(“new_blog_post”, “created_group”, “joined_group”, “new_member”, “friendship_created”, “activity_liked”);
foreach ($activities->activities as $key => $activity) {
if (in_array($activity->type, $nothanks, true)) {
unset($activities->activities[$key]);
$activities->activity_count = $activities->activity_count-1;
$activities->total_activity_count = $activities->total_activity_count-1;
$activities->pag_num = $activities->pag_num -1;
}
}// Renumber the array keys to account for missing items.
$activities_new = array_values( $activities->activities );
$activities->activities = $activities_new;return $activities;
}
add_action(‘bp_has_activities’, ‘my_hidden_activities’, 10, 2 );
- The topic ‘Filtering out Activity Stream stuff’ is closed to new replies.