diff --git a/wp-content/plugins/bp-mpo-activity-filter/bp-mpo-activity-filter-bp-functions.php b/wp-content/plugins/bp-mpo-activity-filter/bp-mpo-activity-filter-bp-functions.php index 6118d0d4d23b27de864605147aae80c67ea8ff09..d5452fa9d512ed1cd710bd6947e0c845c99be49c 100644 --- a/wp-content/plugins/bp-mpo-activity-filter/bp-mpo-activity-filter-bp-functions.php +++ b/wp-content/plugins/bp-mpo-activity-filter/bp-mpo-activity-filter-bp-functions.php @@ -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. diff --git a/wp-content/plugins/bp-mpo-activity-filter/bp-mpo-activity-filter.php b/wp-content/plugins/bp-mpo-activity-filter/bp-mpo-activity-filter.php index 697b10615dde92ba095a40fd389b406624d7ede6..83f3a7b7d392e8ae906e86cdd00034bf05cec77d 100644 --- a/wp-content/plugins/bp-mpo-activity-filter/bp-mpo-activity-filter.php +++ b/wp-content/plugins/bp-mpo-activity-filter/bp-mpo-activity-filter.php @@ -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 */ diff --git a/wp-content/plugins/bp-mpo-activity-filter/readme.txt b/wp-content/plugins/bp-mpo-activity-filter/readme.txt index de61c505247c53320dfc0f35ffc46bb587675a97..b54265c52ccd85065245a2309f80ead8b5025866 100644 --- a/wp-content/plugins/bp-mpo-activity-filter/readme.txt +++ b/wp-content/plugins/bp-mpo-activity-filter/readme.txt @@ -1,10 +1,11 @@ -=== 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