bp_add_member_follow_scope_filter( array|string $qs, str $object )
Filter the members loop on a follow page.
Description
This is done so we can return users that:
- the current user is following (on a user page or member directory); or
- are following the displayed user on the displayed user’s followers page
Parameters
- $qs
-
(Required) The querystring for the BP loop.
- $object
-
(Required) The current object for the querystring.
Return
(array|string) Modified querystring
Source
File: bp-activity/bp-activity-filters.php
function bp_add_member_follow_scope_filter( $qs, $object ) {
// not on the members object? stop now!
if ( 'members' !== $object ) {
return $qs;
}
// members directory
if ( ! bp_is_user() && bp_is_members_directory() ) {
$qs_args = wp_parse_args( $qs );
// check if members scope is following before manipulating.
if ( isset( $qs_args['scope'] ) && 'following' === $qs_args['scope'] ) {
$qs .= '&include=' . bp_get_following_ids( array(
'user_id' => bp_loggedin_user_id(),
) );
}
}
return $qs;
}
Changelog
| Version | Description |
|---|---|
| BuddyBoss 1.0.0 | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.