bp_users_filter_activity_following_scope( array $retval = array(), array $filter = array() )
Set up activity arguments for use with the ‘following’ scope.
Description
For details on the syntax, see BP_Activity_Query.
Parameters
- $retval
-
(Optional) Empty array by default.
Default value: array()
- $filter
-
(Optional) Current activity arguments.
Default value: array()
Return
(array)
Source
File: bp-activity/bp-activity-filters.php
function bp_users_filter_activity_following_scope( $retval = array(), $filter = array() ) {
// Determine the user_id.
if ( ! empty( $filter['user_id'] ) ) {
$user_id = $filter['user_id'];
} else {
$user_id = bp_displayed_user_id()
? bp_displayed_user_id()
: bp_loggedin_user_id();
}
// Determine following of user.
$following_ids = bp_get_following( array(
'user_id' => $user_id,
) );
if ( empty( $following_ids ) ) {
$following_ids = array( 0 );
}
$retval = array(
'relation' => 'AND',
array(
'column' => 'user_id',
'compare' => 'IN',
'value' => (array) $following_ids,
),
// we should only be able to view sitewide activity content for those the user
// is following.
array(
'column' => 'hide_sitewide',
'value' => 0,
),
// overrides.
'override' => array(
'filter' => array(
'user_id' => 0,
),
'show_hidden' => true,
),
);
return $retval;
}
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.