Created
November 22, 2019 02:44
-
-
Save wptraining/d57229dfe2898d7eeba80be342e15ad1 to your computer and use it in GitHub Desktop.
BuddyPress Friends-Only Activity Stream Plugin
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
| function friends_only_activity_args($args) | |
| { | |
| if (!bp_is_activity_directory() || !is_user_logged_in()) | |
| { | |
| return $args; | |
| } | |
| $user_id = get_current_user_id(); | |
| $user_ids = friends_get_friend_user_ids($user_id); | |
| // include users own too | |
| array_push($user_ids, $user_id); | |
| $args['user_id'] = $user_ids; | |
| // print_r($args); | |
| return $args; | |
| } | |
| add_filter('bp_after_has_activities_parse_args', 'friends_only_activity_args'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment