[buddypress-trac] [BuddyPress Trac] #6682: filter for @mentioned user_ids
buddypress-trac
noreply at wordpress.org
Sun Oct 25 19:27:49 UTC 2015
#6682: filter for @mentioned user_ids
----------------------------------+------------------------------
Reporter: wdfee | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Component - Activity | Version: 2.3.3
Severity: normal | Resolution:
Keywords: |
----------------------------------+------------------------------
Comment (by wdfee):
Hi @DJPaul
in our case the networks don't have subblogs, so we can use
`is_user_member_of_blog()`, my filter function's like this:
{{{
function my_activity_mentions_usernames_filter($usernames) {
foreach( $usernames as $u => $username):
$mentioned_user = get_user_by( 'login', $username );
if( empty($mentioned_user) ||
!is_user_member_of_blog($mentioned_user->ID) ):
unset($usernames[$u]);
endif;
endforeach;
return $usernames;
}
}}}
In bbPress btw there's an equivalent filter offered a little bit later in
`bbp_find_mentions()` includes/extend/buddypress/functions.php 346.
--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/6682#comment:2>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac
More information about the buddypress-trac
mailing list