Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Show Following Users Activities + User Own Activities Only
<?php
/**
* Show Following Users Activities + User Own Activities!
*/
function yzc_followings_only_activity_args( $args ) {
if ( ! bp_is_activity_directory() || ! is_user_logged_in() ) {
return $args;
}
// Get User ID.
$user_id = get_current_user_id();
// Get Users.
$user_ids = (array) bp_follow_get_following( array( 'user_id' => $user_id ) );
// Include users own too?
array_push( $user_ids, $user_id );
$args['user_id'] = $user_ids;
return $args;
}
add_filter( 'bp_after_has_activities_parse_args', 'yzc_followings_only_activity_args' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment