[buddypress-trac] [BuddyPress Trac] #6843: Activity @mentions in private groups for non members
buddypress-trac
noreply at wordpress.org
Fri Jan 29 03:33:02 UTC 2016
#6843: Activity @mentions in private groups for non members
----------------------------------+--------------------
Reporter: timeuser | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: 2.5
Component: Component - Activity | Version: 2.4.0
Severity: normal | Resolution:
Keywords: |
----------------------------------+--------------------
Comment (by boonebgorges):
> Does anyone have a suggestion on how best to go about that? What would I
hook or filter to check and stop the output of a post into the feed? Limit
and pagination problems seem more minor to me since they woudn't be very
obvious to users.
Roughly:
{{{#!php
<?php
function bp6843_filter_out_private_mentions( $has_activities ) {
global $activities_template;
$as = $activities_template->activities;
foreach ( $as as $k => $a ) {
if ( 'groups' === $a->component ) {
$group_id = $a->item_id;
$group = groups_get_group( array( 'group_id' => $group_id ) );
if ( 'public' !== $group && ! groups_is_user_member(
bp_loggedin_user_id(), $group_id ) ) {
unset( $as[ $k ] );
}
}
}
// reset indexes
$as = array_values( $as );
$activities_template->activities = $as;
return $has_activities;
}
add_filter( 'bp_has_activities', 'bp6843_filter_out_private_mentions' );
}}}
--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/6843#comment:9>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac
More information about the buddypress-trac
mailing list