Commit a7f83dbd authored by lucha's avatar lucha
Browse files

[auto] plugin: bp-mpo-activity-filter 1.2.2

parent 5de3a9c3
......@@ -4,15 +4,33 @@
* Reaches into the activity global and filters out items the user doesn't have access to
*
* Uses privacy settings from More Privacy Options
*
* @param boolean $has_activities True if there are activities, false otherwise
* @param object $activities The BP activities template object
* @param array $template_args The arguments used to init $activities_template
* @return boolean $has_activities True if there are activities, false otherwise
*/
function bp_mpo_activity_filter( $a, $activities ) {
function bp_mpo_activity_filter( $has_activities, $activities, $template_args ) {
global $bp;
if ( is_super_admin() )
return $activities;
return $has_activities;
/**
* List of activity types that this plugin filters.
*
* @param array $activity_types List of activity type identifiers.
*/
$activity_types = apply_filters( 'bp_mpo_activity_types', array(
'new_blog',
'new_blog_post',
'new_blog_comment',
'new_groupblog_post',
'new_groupblog_comment',
) );
foreach ( $activities->activities as $key => $activity ) {
if ( $activity->type == 'new_blog_post' || $activity->type == 'new_blog_comment' ) {
if ( in_array( $activity->type, $activity_types ) ) {
$current_user = $bp->loggedin_user->id;
......@@ -96,9 +114,9 @@ function bp_mpo_activity_filter( $a, $activities ) {
$activities_new = array_values( $activities->activities );
$activities->activities = $activities_new;
return $activities;
return $activities->has_activities();
}
add_action( 'bp_has_activities', 'bp_mpo_activity_filter', 10, 2 );
add_filter( 'bp_has_activities', 'bp_mpo_activity_filter', 10, 3 );
// Filter the output of 'bp_get_activity_count' to account for the fact that there are fewer items. A total hack.
......
......@@ -3,7 +3,7 @@
Plugin Name: BP MPO Activity Filter
Plugin URI: http://github.com/boonebgorges/bp-mpo-activity-filter
Description: When using More Privacy Options, this plugin removes items from BP activity streams according to user roles
Version: 1.2
Version: 1.2.2
Author: Boone Gorges
Author URI: http://boone.gorg.es
*/
......
=== Plugin Name ===
=== BP MPO Activity Filter ===
Contributors: boonebgorges, cuny-academic-commons
Tags: buddypress, activity, privacy, more privacy options, filter
Requires at least: WP 2.8, BuddyPress 1.2
Tested up to: WP 3.4.2, BuddyPress 1.6.1
Requires at least: 3.5
Requires PHP: 5.3
Tested up to: 4.9
Donate link: http://teleogistic.net/donate/
Stable tag: 1.2
Stable tag: 1.2.2
When using More Privacy Options, this plugin removes items from BP activity streams according to user roles.
......@@ -16,7 +17,7 @@ This plugin, BP MPO Activity Filter, does just what the name suggests: it filter
Activity items stored with BP 1.1.3 or lower have a slightly different data format, which makes them incompatible with this plugin.
I borrowed the idea, and a little bit of the code, from this plugin: http://blogs.zmml.uni-bremen.de/olio.
I borrowed the idea, and a little bit of the code, from this plugin: http://blogs.zmml.uni-bremen.de/olio.
== Installation ==
......@@ -24,6 +25,16 @@ I borrowed the idea, and a little bit of the code, from this plugin: http://blog
== Changelog ==
= 1.2.2 =
* Removed PHP 5.3+ syntax.
* Clarified future PHP version support in plugin header.
= 1.2.1 =
* Fixed bug in activity filter callback.
* Fixed bug that caused new_blog activity items not to be filtered properly.
* Fixed compatibility with BP Groupblog.
* Added filter for additional activity types.
= 1.2 =
* Refactored some queries to avoid unnecessary switch_to_blog() usage
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment