Tagged: activity, friends only activity stream
Hello Brajesh,
Do you have any code/plugin to filter user’s activity stream to friends only?
Thanks
Do you mean you want it on sitewide activity? It is very easy to do. Just need confirmation where you want it to be, on sitewide activity page or on user profile page?
Please put the following code in your bp-custom.php and it should work.
function buddydev_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', 'buddydev_friends_only_activity_args' );
hope that helps.
- This reply was modified 8 years, 11 months ago by Brajesh Singh.
Ooops….other plugins are conflicting with any code i put in the bp-custom.php.
Warning: session_start(): Cannot send session cache limiter – headers already sent (output started at /home/xyz/public_html/plugins/bp-custom.php:21) in /home/xyz/public_html/plugins/dhvc-form/dhvc-form.php on line 68
Warning: Cannot modify header information – headers already sent by (output started at /home/bkwb/public_html/wp-content/plugins/bp-custom.php:21) in /home/xyz/public_html/wp-content/plugins/hide_my_wp/hide-my-wp.php on line 1431
I’ll disable the plugins and observe the result.
Hi,
Can you please post your bp-custom.php on pastebin? There seems to be some space before opening/after closing php tag causing it. There is an easy fix to remove the spaces.Thanks Brajesh,
Its working now but the message below shows just above the filtered activity stream.
Array ( [display_comments] => threaded [include] => [exclude] => [in] => [sort] => DESC [page] => 1 [per_page] => 20 [page_arg] => acpage [max] => [count_total] => [show_hidden] => [spam] => ham_only [scope] => [user_id] => Array ( [0] => 5 ) [object] => [action] => [primary_id] => [secondary_id] => [offset] => [since] => [meta_query] => [date_query] => [filter_query] => [search_terms] => [update_meta_cache] => 1 )
the pastebin link http://pastebin.com/20UXHQKt
Hi,
I have update the code in my 2nd post. I left a print_r there that was showing the output. Sorry about that.Thanks Brajesh, It working now. 👍
I’m buying one of your premium plugin for this.
Thank you Israel.
I am glad that it is working. Appreciate your generosity 🙂
The topic ‘ [Resolved] Friends Only Activity Stream’ is closed to new replies.