Created
June 23, 2021 11:59
-
-
Save wbcomdev/7ebd2cfa7a1accac27b504a1e2354776 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Sidewide activity stream only for friends. | |
| * | |
| * @param array $args Arguments. | |
| */ | |
| function wbcom_friends_only_activity_args( $args ) { | |
| if ( ! bp_is_activity_directory() || ! is_user_logged_in() || ! empty( $args['scope'] ) ) { | |
| return $args; | |
| } | |
| $user_id = get_current_user_id(); | |
| $user_ids = friends_get_friend_user_ids( $user_id ); | |
| array_push( $user_ids, $user_id ); | |
| $args['user_id'] = $user_ids; | |
| return $args; | |
| } | |
| add_filter( 'bp_after_has_activities_parse_args', 'wbcom_friends_only_activity_args' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment